Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
ojo
Posts: 6
Joined: 13 Aug 2014, 17:50

Weird behaviour

Post by ojo » 13 Aug 2014, 18:24

Hi!

I've seen some very strange and annoying behaviour with a Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem and Ubuntu 12.04 on my Desktop machine.

In some cases the device simply refuses to switch the mode from storage to modem. Last case was yesterday. I tried to switch it manually using different MessageContent etc. in /etc/usb_modeswitch.conf, tried rebooting, tried different usb ports (2 and 3), even tried switching the computer off (using the switch at the back), nothing worked, modeswitch was simply not done. I did not get any error message in the logs or any other messages which would lead to the source of the problem (inspecting dmesg, /var/log/syslog, lsusb etc.).

Yesterday evening I was really p*****d, switched the computer off and went to bed. Now I booted the computer and everything is working out of the box. After login I'm asked for the PIN and connecting to the internet worked perfectly.

Togehter with yesterday this is probably the fourth or fifth time I've encountered this phenomenon.

Has anyone else seen this kind of behaviour???

Regards,
Oliver

PS: System info:

Code: Select all

Linux apollo 3.8.0-44-generic #66~precise1-Ubuntu SMP Tue Jul 15 04:01:04 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

ojo@apollo:~$ dpkg -l | grep modeswitch
ii  usb-modeswitch                           1.2.3+repack0-1ubuntu2                              mode switching tool for controlling "flip flop" USB devices
ii  usb-modeswitch-data                      20120120-0ubuntu1                                   mode switching data for usb-modeswitch

ojo@apollo:~$ lsusb -vs 003:002

Bus 003 Device 002: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x1001 E169/E620/E800 HSDPA Modem
  bcdDevice            0.00
  iManufacturer           3 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           85
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          1 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
ojo@apollo:~$ 
Before modeswitch the device id is 12d1:1446

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Weird behaviour

Post by LOM » 13 Aug 2014, 19:38

Check your system log (dmesg) next time it happens, make sure that there are usb log lines showing that the device gets detected on the usb bus when it is plugged in.

ojo
Posts: 6
Joined: 13 Aug 2014, 17:50

Re: Weird behaviour

Post by ojo » 13 Aug 2014, 22:52

Hi,

the device got detected every time, confirmed by lsusb and dmesg.

Here is part of my syslog:

Not working:

Code: Select all

Aug 12 19:26:05 apollo kernel: [    3.651230] usb 3-4: new high-speed USB device number 4 using xhci_hcd
Aug 12 19:26:05 apollo kernel: [    3.669194] usb 3-4: New USB device found, idVendor=12d1, idProduct=1446
Aug 12 19:26:05 apollo kernel: [    3.669196] usb 3-4: New USB device strings: Mfr=3, Product=2, SerialNumber=0
Aug 12 19:26:05 apollo kernel: [    3.669197] usb 3-4: Product: HUAWEI Mobile
Aug 12 19:26:05 apollo kernel: [    3.669198] usb 3-4: Manufacturer: HUAWEI Technology
Aug 12 19:26:05 apollo kernel: [    3.670992] scsi7 : usb-storage 3-4:1.0
Aug 12 19:26:05 apollo kernel: [    3.671076] scsi8 : usb-storage 3-4:1.1
Aug 12 19:26:05 apollo kernel: [    3.994621] usbcore: registered new interface driver usbserial
Aug 12 19:26:05 apollo kernel: [    3.994628] usbcore: registered new interface driver usbserial_generic
Aug 12 19:26:05 apollo kernel: [    3.994633] usbserial: USB Serial support registered for generic
Aug 12 19:26:06 apollo usb_modeswitch: switching device 12d1:1446 on 003/004
Working:

Code: Select all

Aug 13 17:44:48 apollo kernel: [    1.412477] usb 3-4: new high-speed USB device number 2 using xhci_hcd
Aug 13 17:44:48 apollo kernel: [    1.430586] usb 3-4: New USB device found, idVendor=12d1, idProduct=1001
Aug 13 17:44:48 apollo kernel: [    1.430588] usb 3-4: New USB device strings: Mfr=3, Product=2, SerialNumber=0
Aug 13 17:44:48 apollo kernel: [    1.430589] usb 3-4: Product: HUAWEI Mobile
AAug 13 17:44:48 apollo kernel: [    4.058861] usbcore: registered new interface driver usbserial
Aug 13 17:44:48 apollo kernel: [    4.058868] usbcore: registered new interface driver usbserial_generic
Aug 13 17:44:48 apollo kernel: [    4.058872] usbserial: USB Serial support registered for generic
Aug 13 17:44:48 apollo mtp-probe: checking bus 3, device 2: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-4"
Aug 13 17:44:48 apollo mtp-probe: checking bus 5, device 2: "/sys/devices/pci0000:00/0000:00:1c.5/0000:05:00.0/usb5/5-1"
Aug 13 17:44:48 apollo mtp-probe: checking bus 3, device 3: "/sys/devices/pci0000:00/0000:00:14.0/usb3/3-8"
Aug 13 17:44:48 apollo kernel: [    4.379255] usbcore: registered new interface driver option
Aug 13 17:44:48 apollo kernel: [    4.379266] usbserial: USB Serial support registered for GSM modem (1-port)
Aug 13 17:44:48 apollo kernel: [    4.379513] usb 3-4: GSM modem (1-port) converter now attached to ttyUSB0
Aug 13 17:44:48 apollo kernel: [    4.379581] usb 3-4: GSM modem (1-port) converter now attached to ttyUSB1
Aug 13 17:44:48 apollo kernel: [    4.379625] usb 3-4: GSM modem (1-port) converter now attached to ttyUSB2
Aug 13 17:44:48 apollo kernel: [    1.430590] usb 3-4: Manufacturer: HUAWEI Technology
In the working example the device is already in the correct mode.

But why does this happen only in approx 95% of days?

Regards,
Oliver

ojo
Posts: 6
Joined: 13 Aug 2014, 17:50

Re: Weird behaviour

Post by ojo » 29 Oct 2014, 22:46

Ok, after some experimenting this is a procedure which seems to solve the problem:

After booting and logging in, when the modem is not recognised, I pull it out and then back into the USB port and then _immediately_ start usb_modeswitch (repeating it until the device is recognised).

Code: Select all

ojo@apollo:~$ sudo usb_modeswitch -c /etc/usb_modeswitch.conf

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 No devices in default mode found. Nothing to do. Bye.

ojo@apollo:~$ sudo usb_modeswitch -c /etc/usb_modeswitch.conf

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
   found matching product ID
   adding device
 Found device in default mode, class or configuration (1)
Accessing device 006 on bus 003 ...
Getting the current device configuration ...
 OK, got current device configuration (1)
Using first interface: 0x00
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached

SCSI inquiry data (for identification)
-------------------------
  Vendor String: HUAWEI  
   Model String: Mass Storage    
Revision String: 2.31
-------------------------

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI Technology
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Setting up communication with interface 0
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Resetting response endpoint 0x81
Resetting message endpoint 0x01

Checking for mode switch (max. 20 times, once per second) ...
 Searching for target devices ...
 Searching for target devices ...

Found target device, now opening
 Found correct target device

Mode switch succeeded. Bye.

The manual modeswitch does not work after boot, although the modem is recognised correctly, visible from lsusb.

Here's the content of my /etc/usb_modeswitch.conf:

Code: Select all

# Configuration for the usb_modeswitch package, a mode switching tool for
# USB devices providing multiple states or modes
#
# Evaluated by the wrapper script /usr/sbin/usb_modeswitch_dispatcher
#
# To enable an option, set it to "1", "yes" or "true" (case doesn't matter)
# Everything else counts as "disable"


# Disable automatic mode switching globally (e.g. to access the original
# install storage)

DisableSwitching=0


# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" and probably others

EnableLogging=1

## HUAWEI dongle
DefaultVendor=0x12d1
DefaultProduct=0x1446
TargetVendor=0x12d1
TargetProductList="1001,1406,140b,140c,1412,141b,1433,1436,14ac,1506"
CheckSuccess=20
##MessageContent="55534243000000000000000000000011060000000000000000000000000000"
##MessageContent="55534243123456780000000000000011062000000100000000000000000000"
##MessageContent="55534243123456780000000000000011060000000000000000000000000000"
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
Apparently under some (unknown) circumstances some sort of race conditions prevents the modeswitch.

I'm posting this in case someone else might make use of it.

Regards,
Oliver

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Weird behaviour

Post by LOM » 30 Oct 2014, 06:35

ojo wrote:Apparently under some (unknown) circumstances some sort of race conditions prevents the modeswitch.
The most likely cause is your usage of Ubuntu 12.04 which is not very well maintained, they do for instance use a version of usb_modeswitch which was outdated already when they released 12.04 and they haven't done anything to rectify that.

usb_modeswitch.conf is for global configuration and is not meant to be used for individual dongle switching parameters. You have config files for each supported dongle, that's where you add new id's or edit an already existing id.

Post Reply