diff options
-rw-r--r-- | plugins/77-mm-longcheer-port-types.rules | 3 | ||||
-rw-r--r-- | plugins/mm-plugin-longcheer.c | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/plugins/77-mm-longcheer-port-types.rules b/plugins/77-mm-longcheer-port-types.rules index a07ebb08..7317df79 100644 --- a/plugins/77-mm-longcheer-port-types.rules +++ b/plugins/77-mm-longcheer-port-types.rules @@ -20,10 +20,12 @@ SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInte ATTRS{idProduct}=="6060", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_LONGCHEER_PORT_TYPE_MODEM}="1" ATTRS{idProduct}=="6060", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_LONGCHEER_PORT_TYPE_AUX}="1" +ATTRS{idProduct}=="6060", ENV{ID_MM_LONGCHEER_TAGGED}="1" # Alcatel One Touch X020 ATTRS{idProduct}=="6061", ENV{.MM_USBIFNUM}=="00", ENV{ID_MM_LONGCHEER_PORT_TYPE_MODEM}="1" ATTRS{idProduct}=="6061", ENV{.MM_USBIFNUM}=="02", ENV{ID_MM_LONGCHEER_PORT_TYPE_AUX}="1" +ATTRS{idProduct}=="6061", ENV{ID_MM_LONGCHEER_TAGGED}="1" GOTO="mm_longcheer_port_types_end" @@ -34,6 +36,7 @@ SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{.MM_USBIFNUM}="$attr{bInte # Alcatel One Touch X060s ATTRS{idProduct}=="0000", ENV{.MM_USBIFNUM}=="03", ENV{ID_MM_LONGCHEER_PORT_TYPE_MODEM}="1" ATTRS{idProduct}=="0000", ENV{.MM_USBIFNUM}=="01", ENV{ID_MM_LONGCHEER_PORT_TYPE_AUX}="1" +ATTRS{idProduct}=="0000", ENV{ID_MM_LONGCHEER_TAGGED}="1" GOTO="mm_longcheer_port_types_end" diff --git a/plugins/mm-plugin-longcheer.c b/plugins/mm-plugin-longcheer.c index ae5cfd29..5c19b136 100644 --- a/plugins/mm-plugin-longcheer.c +++ b/plugins/mm-plugin-longcheer.c @@ -114,12 +114,23 @@ grab_port (MMPluginBase *base, port = mm_plugin_base_supports_task_get_port (task); g_assert (port); - /* Look for port type hints */ + /* Look for port type hints; just probing can't distinguish which port should + * be the data/primary port on these devices. We have to tag them based on + * what the Windows .INF files say the port layout should be. + */ if (g_udev_device_get_property_as_boolean (port, "ID_MM_LONGCHEER_PORT_TYPE_MODEM")) ptype = MM_PORT_TYPE_PRIMARY; else if (g_udev_device_get_property_as_boolean (port, "ID_MM_LONGCHEER_PORT_TYPE_AUX")) ptype = MM_PORT_TYPE_SECONDARY; + /* If the device was tagged by the udev rules, then ignore any other ports + * to guard against race conditions if a device just happens to show up + * with more than two AT-capable ports. + */ + if ( (ptype == MM_PORT_TYPE_UNKNOWN) + && g_udev_device_get_property_as_boolean (port, "ID_MM_LONGCHEER_TAGGED")) + ptype = MM_PORT_TYPE_IGNORED; + physdev = mm_plugin_base_supports_task_get_physdev (task); g_assert (physdev); sysfs_path = g_udev_device_get_sysfs_path (physdev); |