Package: network-manager Version: 0.7.1-1 Severity: normal Executive summary ------------------ Upgrading N-M from 0.7.0(ish) to 0.7.1 apparently broke 3G connectivity with my Huawei E220 HSDSPA modem (which might actually be an E270 HSUPA/HSDPA unit).
After some gnashing of teeth, the problem appears to be with the Huawei E220 requiring a little more settle time (8 to 10 seconds) than what is afforded by NetworkManager's udev scripts and helpers. Patch ready. -- Cyrille Analysis (typed as events happened) This bug is different from #525066 as in that other case, one of the /dev/ttyUSB* avatars from that modem were accepted as 3G-capable units. In the E220 case, both ttyUSB0 and ttyUSB1 are rejected with the following messages: lt-NetworkManager: <info> (ttyUSB1): ignoring due to lack of mobile broadband capabilties lt-NetworkManager: <info> (ttyUSB0): found serial port (udev: hal:GSM) lt-NetworkManager: <info> (ttyUSB0): ignoring due to lack of probed mobile broadband capabilties apparently, what this means is that the ttyUSB1 side of the modem is just not that interesting for my purpose, and for ttyUSB0, we fall on /* Case (c): HAL thinks it's a modem, but udev doesn't */ from nm-hal-manager.c udev is version 0.141-1, which apparently is the latest. Kernel is 2.6.29-2 version 2.6.29-5 (in Debian at least) After build-deping network-manager, ./configure --as-in-debian-rules gave #define HAVE_LIBUDEV 0 wihen not using HAVE_LIBUDEV, a different function is used to query udev about the modem than when HAVE_LIBUDEV. In the "have not" case, we call /sbin/udevadm (yes, hardcoded name without regards to the prefix..) Manually calling /sbin/udevadm info --query=env --path=/sys/class/tty/ttyUSB0 returns the following: UDEV_LOG=3 DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/ttyUSB0/tty/ttyUSB0 MAJOR=188 MINOR=0 DEVNAME=/dev/ttyUSB0 ID_PORT=0 ID_PATH=pci-0000:00:1d.1-usb-0:1:1.0 ID_VENDOR=HUAWEI_Technologies ID_VENDOR_ENC=HUAWEI\x20Technologies ID_VENDOR_ID=12d1 ID_MODEL=HUAWEI_Mobile ID_MODEL_ENC=HUAWEI\x20Mobile ID_MODEL_ID=1003 ID_REVISION=0000 ID_SERIAL=HUAWEI_Technologies_HUAWEI_Mobile ID_TYPE=generic ID_BUS=usb ID_USB_INTERFACES=:ffffff: ID_USB_INTERFACE_NUM=00 ID_USB_DRIVER=option ID_IFACE=00 NM_MODEM_DRIVER=option NM_MODEM_USB_INTERFACE_NUMBER=00 ID_NM_MODEM_PROBED=1 DEVLINKS=/dev/char/188:0 /dev/serial/by-path/pci-0000:00:1d.1-usb-0:1:1.0-port0 / /dev/serial/by-id/usb-HUAWEI_Technologies_HUAWEI_Mobile-if00-port0 bearing in mind the following constants: #define PROP_GSM "ID_NM_MODEM_GSM" #define PROP_CDMA "ID_NM_MODEM_IS707_A" #define PROP_EVDO1 "ID_NM_MODEM_IS856" #define PROP_EVDOA "ID_NM_MODEM_IS856_A" it appears that my modem stopped being supported, even though HAL detected it properly as a GSM modem, just because udev now doesn't advertise it as a GSM module. Oh but udev advertises what the NM support modules are telling it to advise?! Running: /lib/udev/nm-modem-probe -x /dev/ttyUSB0 returns ID_NM_MODEM_GSM=1 ID_NM_MODEM_PROBED=1 which is what I expect. /lib/udev/rules.d/77-nm-probe-modem-capabilities.rules exists and seems sane at first glance. Ran /sbin/udevd --debug, in the same console as NM, and plugged the modem back in. A sea of messages ensued, including: [3183] udev_rules_apply_to_event: LINK 'serial/by-id/usb-HUAWEI_Technologies_HUAWEI_Mobile-if00-port0' /lib/udev/rules.d/60-persistent-serial.rules:18 [3183] udev_rules_apply_to_event: IMPORT 'nm-modem-probe --vid 0x12d1 --pid 0x1003 --usb-interface 00 --driver option --delay 3000 --export /dev/char/188:0' /lib/udev/rules.d/77-nm-probe-modem-capabilities.rules:20 [3183] util_run_program: 'nm-modem-probe --vid 0x12d1 --pid 0x1003 --usb-interface 00 --driver option --delay 3000 --export /dev/char/188:0' [3183] util_run_program: '/lib/udev/nm-modem-probe' (stdout) 'ID_NM_MODEM_PROBED=1' [3183] util_run_program: '/lib/udev/nm-modem-probe' returned with status 0 This proves the NM-supplied udev rule is applied as expected. Running nm-modem-probe manually, this way: /lib/udev/nm-modem-probe --vid 0x12d1 --pid 0x1003 \ --usb-interface 00 --driver option --delay 3000 /dev/ttyUSB0 \ --export returns not one but two lines: ID_NM_MODEM_GSM=1 ID_NM_MODEM_PROBED=1 which is indeed what I want. I finally traced the problem by intercepting /lib/udev/nm-modem-probe with a wrapper script, and adding a couple seconds worth of delay just before calling the real nm-modem-probe. That did work around the problem ! This Huawei dongle simply requires more time before it is ready. Turns out the --delay cannot be increased beyond 3000 even for slow devices, because a test in nm-modem-probe.c rejects this. -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (800, 'testing'), (600, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.29-2-686 (SMP w/2 CPU cores) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages network-manager depends on: ii adduser 3.110 add and remove users and groups ii dbus 1.2.12-1 simple interprocess messaging syst ii dhcp3-client 3.1.1-6 DHCP client ii hal 0.5.12~git20090406.46dc48-2 Hardware Abstraction Layer ii ifupdown 0.6.8+nmu1 high level tools to configure netw ii libc6 2.9-12 GNU C Library: Shared libraries ii libdbus-1-3 1.2.12-1 simple interprocess messaging syst ii libdbus-glib 0.80-4 simple interprocess messaging syst ii libgcrypt11 1.4.4-2 LGPL Crypto library - runtime libr ii libglib2.0-0 2.20.0-2 The GLib library of C routines ii libgnutls26 2.6.6-1 the GNU TLS library - runtime libr ii libgpg-error 1.6-1 library for common error values an ii libhal1 0.5.12~git20090406.46dc48-2 Hardware Abstraction Layer - share ii libnl1 1.1-5 library for dealing with netlink s ii libnm-glib0 0.7.1-1 network management framework (GLib ii libnm-util1 0.7.1-1 network management framework (shar ii libpolkit-db 0.9-3 library for accessing PolicyKit vi ii libpolkit2 0.9-3 library for accessing PolicyKit ii libtasn1-3 1.8-1 Manage ASN.1 structures (runtime) ii libuuid1 1.41.3-1 universally unique id library ii lsb-base 3.2-22 Linux Standard Base 3.2 init scrip ii wpasupplican 0.6.9-2 client support for WPA and WPA2 (I ii zlib1g 1:1.2.3.3.dfsg-13 compression library - runtime Versions of packages network-manager recommends: ii dnsmasq-base 2.47-3 A small caching DNS proxy and DHCP ii iptables 1.4.3.2-2 administration tools for packet fi ii network-manager-gnome 0.7.1-1 network management framework (GNOM ii policykit 0.9-3 framework for managing administrat ii ppp 2.4.4rel-10.1 Point-to-Point Protocol (PPP) - da Versions of packages network-manager suggests: ii avahi-autoipd 0.6.25-1 Avahi IPv4LL network address confi -- no debconf information
diff -ur network-manager-0.7.1.vanilla/callouts/77-nm-probe-modem-capabilities.rules network-manager-0.7.1/callouts/77-nm-probe-modem-capabilities.rules --- network-manager-0.7.1.vanilla/callouts/77-nm-probe-modem-capabilities.rules 2009-04-13 00:29:59.000000000 +0200 +++ network-manager-0.7.1/callouts/77-nm-probe-modem-capabilities.rules 2009-06-10 01:22:26.000000000 +0200 @@ -11,13 +11,21 @@ GOTO="nm_modem_probe_end" LABEL="probe" +# default settle time +SUBSYSTEMS=="usb", ENV{NM_MODEM_PROBE_DELAY}="3000" # Don't probe new-style beagleboard cdc-acm ports SUBSYSTEMS=="usb", ATTRS{idVendor}=="0525", GOTO="nm_modem_probe_end" SUBSYSTEM=="tty", SUBSYSTEMS=="usb", DRIVERS=="?*", ENV{NM_MODEM_DRIVER}="$attr{driver}" SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="?*", ENV{NM_MODEM_USB_INTERFACE_NUMBER}="$attr{bInterfaceNumber}" -SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="?*", ATTRS{idProduct}=="?*", IMPORT{program}="nm-modem-probe --vid 0x$attr{idVendor} --pid 0x$attr{idProduct} --usb-interface $env{NM_MODEM_USB_INTERFACE_NUMBER} --driver $env{NM_MODEM_DRIVER} --delay 3000 --export $tempnode", GOTO="nm_modem_probe_end" + +# some Huawei modems require a longer settle time +SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", ENV{NM_MODEM_PROBE_DELAY}="12000" +# on Huawei modems, better not touch interface #1. +SUBSYSTEMS=="usb", ATTRS{idVendor}=="12d1", ENV{NM_MODEM_USB_INTERFACE_NUMBER}=="01", GOTO="nm_modem_probe_end" + +SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="?*", ATTRS{idProduct}=="?*", IMPORT{program}="nm-modem-probe --vid 0x$attr{idVendor} --pid 0x$attr{idProduct} --usb-interface $env{NM_MODEM_USB_INTERFACE_NUMBER} --driver $env{NM_MODEM_DRIVER} --delay $env{NM_MODEM_PROBE_DELAY} --export $tempnode", GOTO="nm_modem_probe_end" LABEL="nm_modem_probe_end" diff -ur network-manager-0.7.1.vanilla/callouts/nm-modem-probe.c network-manager-0.7.1/callouts/nm-modem-probe.c --- network-manager-0.7.1.vanilla/callouts/nm-modem-probe.c 2009-04-13 00:29:59.000000000 +0200 +++ network-manager-0.7.1/callouts/nm-modem-probe.c 2009-06-10 01:21:01.000000000 +0200 @@ -455,6 +455,11 @@ guint32 delay_ms = 0; unsigned int vid = 0, pid = 0, usbif = 0, last_err = 0; unsigned long int tmp; + GTimeVal probe_start, probe_end, probe_diff; + glong probe_time_ms; + + g_get_current_time (&probe_start); + while (1) { int option; @@ -469,7 +474,7 @@ break; case 'a': tmp = strtoul (optarg, NULL, 10); - if (tmp < 1 || tmp > 3000) { + if (tmp < 1 || tmp > 30000) { fprintf (stderr, "Invalid delay: %s\n", optarg); return 1; } @@ -613,6 +618,11 @@ printf ("ID_NM_MODEM_PROBED=1\n"); } + g_get_current_time (&probe_end); + g_timeval_subtract (&probe_diff, &probe_end, &probe_start); + probe_time_ms = (probe_diff.tv_sec * 1000) + (probe_diff.tv_usec / 1000); + printf ("ID_NM_MODEM_PROBE_TIME_MS=%ld\n", probe_time_ms); + verbose ("%s: caps (0x%X)%s%s%s%s\n", device, caps, caps & MODEM_CAP_GSM ? " GSM" : "", caps & (MODEM_CAP_IS707_A | MODEM_CAP_IS707_P) ? " CDMA-1x" : "", diff -ur network-manager-0.7.1.vanilla/ChangeLog network-manager-0.7.1/ChangeLog --- network-manager-0.7.1.vanilla/ChangeLog 2009-03-03 17:55:45.000000000 +0100 +++ network-manager-0.7.1/ChangeLog 2009-06-10 01:26:55.000000000 +0200 @@ -1,3 +1,14 @@ +2009-06-10 Cyrille Chépélov <cyri...@chepelov.org> + + * callouts/nm-modem-probe.c: + - increase the maximum admissible probe time to 30 seconds + - add another property ID_NM_MODEM_PROBE_TIME_MS to report the actual + probe time + * callouts/77-nm-probe-modem-capabilities.rules: + - Huawei modems' interface #1 is dangerous, don't probe it + - Set a larger probe time (12 seconds) for Huawei modems, leave others + at the default 3 seconds. + 2008-12-11 Dan Williams <d...@redhat.com> * Move NetworkManager to git.freedesktop.org