core: new kernel device object instead of an explicit GUdevDevice
Instead of relying constantly on GUdevDevice objects reported by GUdev, we now use a new generic object (MMKernelDevice) for which we provide an initial GUdev based backend.
This commit is contained in:
@@ -229,7 +229,7 @@ try_next_usbif (MMDevice *device)
|
||||
if (g_str_equal (mm_port_probe_get_port_subsys (probe), "tty")) {
|
||||
gint usbif;
|
||||
|
||||
usbif = g_udev_device_get_property_as_int (mm_port_probe_peek_port (probe), "ID_USB_INTERFACE_NUM");
|
||||
usbif = mm_kernel_device_get_property_as_int (mm_port_probe_peek_port (probe), "ID_USB_INTERFACE_NUM");
|
||||
if (usbif == fi_ctx->first_usbif) {
|
||||
/* This is the one we just probed, which wasn't yet removed, so just skip it */
|
||||
} else if (usbif > fi_ctx->first_usbif &&
|
||||
@@ -254,7 +254,7 @@ static void
|
||||
huawei_custom_init_step (HuaweiCustomInitContext *ctx)
|
||||
{
|
||||
FirstInterfaceContext *fi_ctx;
|
||||
GUdevDevice *port;
|
||||
MMKernelDevice *port;
|
||||
|
||||
/* If cancelled, end */
|
||||
if (g_cancellable_is_cancelled (ctx->cancellable)) {
|
||||
@@ -292,7 +292,7 @@ huawei_custom_init_step (HuaweiCustomInitContext *ctx)
|
||||
|
||||
/* Try to get a port map from the modem */
|
||||
port = mm_port_probe_peek_port (ctx->probe);
|
||||
if (!ctx->getportmode_done && !g_udev_device_get_property_as_boolean (port, "ID_MM_HUAWEI_DISABLE_GETPORTMODE")) {
|
||||
if (!ctx->getportmode_done && !mm_kernel_device_get_property_as_boolean (port, "ID_MM_HUAWEI_DISABLE_GETPORTMODE")) {
|
||||
if (ctx->getportmode_retries == 0) {
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
huawei_custom_init_context_complete_and_free (ctx);
|
||||
@@ -390,8 +390,8 @@ huawei_custom_init (MMPortProbe *probe,
|
||||
ctx->getportmode_retries = 3;
|
||||
|
||||
/* Custom init only to be run in the first interface */
|
||||
if (g_udev_device_get_property_as_int (mm_port_probe_peek_port (probe),
|
||||
"ID_USB_INTERFACE_NUM") != fi_ctx->first_usbif) {
|
||||
if (mm_kernel_device_get_property_as_int (mm_port_probe_peek_port (probe),
|
||||
"ID_USB_INTERFACE_NUM") != fi_ctx->first_usbif) {
|
||||
|
||||
if (fi_ctx->custom_init_run)
|
||||
/* If custom init was run already, we can consider this as successfully run */
|
||||
@@ -433,7 +433,7 @@ propagate_port_mode_results (GList *probes)
|
||||
MMPortSerialAtFlag at_port_flags = MM_PORT_SERIAL_AT_FLAG_NONE;
|
||||
gint usbif;
|
||||
|
||||
usbif = g_udev_device_get_property_as_int (mm_port_probe_peek_port (MM_PORT_PROBE (l->data)), "ID_USB_INTERFACE_NUM");
|
||||
usbif = mm_kernel_device_get_property_as_int (mm_port_probe_peek_port (MM_PORT_PROBE (l->data)), "ID_USB_INTERFACE_NUM");
|
||||
|
||||
if (GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (device), TAG_GETPORTMODE_SUPPORTED))) {
|
||||
if (usbif + 1 == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (device), TAG_HUAWEI_PCUI_PORT))) {
|
||||
@@ -526,23 +526,23 @@ grab_port (MMPlugin *self,
|
||||
GError **error)
|
||||
{
|
||||
MMPortSerialAtFlag pflags = MM_PORT_SERIAL_AT_FLAG_NONE;
|
||||
GUdevDevice *port;
|
||||
MMKernelDevice *port;
|
||||
MMPortType port_type;
|
||||
|
||||
port_type = mm_port_probe_get_port_type (probe);
|
||||
port = mm_port_probe_peek_port (probe);
|
||||
|
||||
if (g_udev_device_get_property_as_boolean (port, "ID_MM_HUAWEI_AT_PORT")) {
|
||||
if (mm_kernel_device_get_property_as_boolean (port, "ID_MM_HUAWEI_AT_PORT")) {
|
||||
mm_dbg ("(%s/%s)' Port flagged as primary",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe));
|
||||
pflags = MM_PORT_SERIAL_AT_FLAG_PRIMARY;
|
||||
} else if (g_udev_device_get_property_as_boolean (port, "ID_MM_HUAWEI_MODEM_PORT")) {
|
||||
} else if (mm_kernel_device_get_property_as_boolean (port, "ID_MM_HUAWEI_MODEM_PORT")) {
|
||||
mm_dbg ("(%s/%s) Port flagged as PPP",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe));
|
||||
pflags = MM_PORT_SERIAL_AT_FLAG_PPP;
|
||||
} else if (g_udev_device_get_property_as_boolean (port, "ID_MM_HUAWEI_GPS_PORT")) {
|
||||
} else if (mm_kernel_device_get_property_as_boolean (port, "ID_MM_HUAWEI_GPS_PORT")) {
|
||||
mm_dbg ("(%s/%s) Port flagged as GPS",
|
||||
mm_port_probe_get_port_subsys (probe),
|
||||
mm_port_probe_get_port_name (probe));
|
||||
|
Reference in New Issue
Block a user