Page 1 of 1

Huawei E173 (E173u-2) / Ubuntu 10.04 / am i doing it rite?

Posted: Wed Dec 08, 2010 4:00 am
by xxx
Hello there,
i hope this is the right place to post to.
I found a way to make things work but it doesn't seem right...
  • :~$ lsusb
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 002: ID 045e:001e Microsoft Corp. IntelliMouse Explorer
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 002 Device 002: ID 5986:0149 Acer, Inc
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 003: ID 12d1:1446 Huawei Technologies Co., Ltd.
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    :~$ sudo usb_modeswitch -v 0x12d1 -p 0x1446 -V 0x12d1 -P 0x140c -m 0x01 -M "55534243123456780000000000000011060000000000000000000000000000"

    Looking for target devices ...
    No devices in target mode or class found
    Looking for default devices ...
    Found devices in default mode or class (1)
    Accessing device 003 on bus 001 ...
    Getting the current device configuration ...
    OK, got current device configuration (1)
    Using endpoints 0x01 (out) and 0x81 (in)
    Using endpoints 0x01 (out) and 0x81 (in)
    Inquiring device details; driver will be detached ...
    Looking for active driver ...
    No driver found. Either detached before or never attached

    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
    Error resetting endpoint: -71
    Resetting message endpoint 0x01
    Error resetting endpoint: -19
    Device is gone, skipping any further commands
    -> Run lsusb to note any changes. Bye.

    :~$ lsusb |grep Huawei
    Bus 003 Device 003: ID 12d1:140c Huawei Technologies Co., Ltd.
I have installed the usb_modeswitch 1.1.5-1_i386.deb from the debian repositories on my Ubuntu 10.04.
The setup only worked once out of the box, immediately after the install, but sadly i couldn't reproduce it.

lsusb showed me for the huawei device the adress 12d1:1446.
i tried to change my default-product via commandline to a specific target-product, that i had confirmed as 140c.
(confirmation by booting into windows and then restarting into ubuntu, the usb-stick that was still switched showed 140c in lsusb).

Since this value could also be found in the TargetProductList inside of /etc/usb_modeswitch.d/12d1:1446, i wondered if things worked properly at all.
So i changed that "TargetProductList" to "TargetProduct" and wrote "0x140c" as the single value, rebooted, but still no luck.

Then i searched a lot of threats, leading me to the one where they suggest to use:

sudo usb_modeswitch -v 0x12d1 -p 0x1446 -V 0x12d1 -P 0x140c -m 0x01 -M "55534243123456780000000000000011060000000000000000000000000000"

...and that worked right away.

I then compared this MessageContent hex with the one inside of /etc/usb_modeswitch.d/12d1:1446 , and they differed.
I then disabled the line and copied the new, working value inside. Still it wouldn't work.

So my question is, how does usb_modeswitch not work with this 12d1:1446-file when it perfectly does so when i type in the command?
And since i have literally no idea what i am doing (trial and error), is this MessageContent hex number okay to use or shouldn't i be doing this at all?


Heres the content of the edited "/etc/usb_modeswitch.d/12d1:1446" :
  • ########################################################
    # Huawei, newer modems
    # TargetProductList="1001,1406,140b,140c,1412,141b,14ac"

    DefaultVendor= 0x12d1
    DefaultProduct=0x1446

    TargetVendor= 0x12d1
    TargetProduct= 0x140c


    CheckSuccess=20

    #MessageContent="55534243123456780000000000000011062000000100000000000000000000"
    MessageContent="55534243123456780000000000000011060000000000000000000000000000"
Thank you in advance,
cheers p

Posted: Wed Dec 08, 2010 11:53 am
by Josh
Regarding the two different message commands:
The one you commented out in your configuration was given to me by a Huawei engineer who asked me to replace the other message command for all Huawei devices and assured me it would work as well.

Did you try your command line with the first command (you really can leave away the -m parameter) ?

usb_modeswitch -v 0x12d1 -p 0x1446 -V 0x12d1 -P 0x140c -M "55534243123456780000000000000011062000000100000000000000000000"

If that works, please revert all your edits (re-install?) and switch on logging in "/etc/usb_modeswitch.conf" as indicated on the main doc page, paragraph "Troubleshooting".


Posted: Wed Dec 08, 2010 2:13 pm
by xxx
That was fast, thank you for the reply!
In short: huawei message command works, TargetProduct get's a different value, still no "plug&play" ability

As for the message command you posted:
  • :~$ lsusb
    Bus 003 Device 005: ID 12d1:1446 Huawei Technologies Co., Ltd.

    :~$ sudo usb_modeswitch -v 0x12d1 -p 0x1446 -V 0x12d1 -P 0x140c -M "55534243123456780000000000000011062000000100000000000000000000"

    Looking for target devices ...
    No devices in target mode or class found
    Looking for default devices ...
    Found devices in default mode or class (1)
    Accessing device 005 on bus 003 ...
    Getting the current device configuration ...
    OK, got current device configuration (1)
    Using endpoints 0x01 (out) and 0x81 (in)
    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 ...
    Device seems to have vanished right after sending. Good.
    Device is gone, skipping any further commands
    -> Run lsusb to note any changes. Bye.

    :~$ lsusb
    Bus 003 Device 006: ID 12d1:1436 Huawei Technologies Co., Ltd.
The TargetProduct gets messed up, instead of 140c it shows 1436.
So this doesn't look too convincing i guess but:
The modem becomes available in the NetworkManager Applet of Ubuntu after ~20 sec. and it connects.
Great job!

Now i did as you suggested:

1. reinstalling the database (checking /etc/usb_modeswitch.d/12d1:1446 , all my edits are gone)
2. editing /etc/usb_modeswitch.conf , changed logging value from 0 to 1
3. reboot
4. lsusb shows 1446
5. using 'sudo usb_modeswitch -v 0x12d1 -p 0x1446 -V 0x12d1 -P 0x140c -M "55534243123456780000000000000011062000000100000000000000000000" '
6. lsusb shows 1436
7. checking /var/log for logs:
  • usb_modeswitch_ttyUSB0
    • USB_ModeSwitch log from Wed Dec 08 12:43:43 CET 2010

      * called with --symlink-name: params /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/ttyUSB0/tty/ttyUSB0 *

      My port is ttyUSB0, my interface is 0
      devDir: /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1
      dev_top: 3-1
      sysPath: /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/ttyUSB0/tty/ttyUSB0
      Checking my endpoints in /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0
      in epDir /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/ep_81 ...
      /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/ep_81 has interrupt transfer type

      --> I am an interrupt port


      --> No interrupt interface below me

      Return symlink name "gsmmodem" and exit
    usb_modeswitch_ttyUSB1
    • USB_ModeSwitch log from Wed Dec 08 12:43:43 CET 2010

      * called with --symlink-name: params /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.3/ttyUSB1/tty/ttyUSB1 *

      My port is ttyUSB1, my interface is 3
      devDir: /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1
      dev_top: 3-1
      sysPath: /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.3/ttyUSB1/tty/ttyUSB1
      Checking my endpoints in /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.3
      in epDir /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.3/ep_85 ...
      in epDir /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.3/ep_03 ...

      --> I am not an interrupt port

      Return empty name and exit
    usb_modeswitch_ttyUSB2
    • USB_ModeSwitch log from Wed Dec 08 12:43:43 CET 2010

      * called with --symlink-name: params /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.4/ttyUSB2/tty/ttyUSB2 *

      My port is ttyUSB2, my interface is 4
      devDir: /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1
      dev_top: 3-1
      sysPath: /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.4/ttyUSB2/tty/ttyUSB2
      Checking my endpoints in /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.4
      in epDir /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.4/ep_86 ...
      in epDir /sys/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.4/ep_04 ...

      --> I am not an interrupt port

      Return empty name and exit
Hm, i would still like to know where i went wrong?
Since everything seems to be in tune, why does it only work by commandline?
Maybe i have to give usb_modeswitch privileges or sth. like that?
I really have no idea :D

Please let me know if there is something more i can do!
Thanks,
cheers p

Posted: Fri Dec 10, 2010 6:27 pm
by Josh
It may well be that the target ID is different when using the "official" Huawei command. It does not really matter if you arrive at 140c or 1436, as long as there is a usable serial port in the target mode.

So you just need to add "1436" to the TargetProductList in "/etc/usb_modeswitch.d/12d1:1446" and you should be set.

Maybe you try once more to just plug in (with the system already up!) and not doing any manual call?

Mind that Huawei devices are among the ones with the longest delay for switching; mine takes five seconds to even appear unswitched and annother 12 or so until coming back as modem after switching.


Posted: Wed Dec 29, 2010 5:18 pm
by xxx
Thx again for your fast reply!

So i tried the command with another 1446 Huawei stick. By the way both sticks were distributed by e-plus phonecompany.
After waiting a few minutes i switched the stick manually:
The new stick arrives at 1001, which is already included in the TargetProductList.
  • #after manual switch it appears at
    Bus 001 Device 003: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem

    #Huawei stick disappears completley after running lsusb again

    #reappears seconds later at
    Bus 003 Device 002: ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem

For the old stick i did as you asked me.
I added 1436 to "/etc/usb_modeswitch.d/12d1:1446".
Tried to just plug it in with system up but to no avail.
(Meaning that i manually activated the stick, unplugged it then and plugged it in again.)
A manual command is always needed as it seems.

Maybe it is a problem how i "made" the modeswitch install?
Maybe it is not running in the background already at startup and instead has to be activated by commandline?
If i should do some more testing please let me know.

However, it is working and it does not matter to me that i have to type in a command.

So thank you for this fine software!
cheers p

Posted: Thu Jan 13, 2011 9:25 am
by Josh
Some new knowledge has evolved:

The package for Debian is probably not compatible with Ubuntu !!

The packaging process for the Debian system involves a change to the hotplug script to make it rely on a component that has been eliminated from Ubuntu. If you installed from the Debian repository, you have to swap the file "/lib/udev/usb_modeswitch" with the one from the original source package where it is named "usb_modeswitch.sh".


Posted: Thu Feb 10, 2011 5:37 pm
by xxx
Thank you so much,
it works!!!

I just did try what you suggested and replaced the file /lib/udev/usb_modeswitch with the original from the source (as of now it's usb-modeswitch-1.1.6.tar.bz2).
I only had to lose the ".sh" at the end of the usb_modeswitch.sh file.
After a restart it worked like a charm!
Testing showed that plugging out and back in also works.
The switching takes a little time on my notebook,
but then again you pointed out in an earlier post that Huawei sticks are rather slow when switching.

So great, all problems solved.
Thanks for your help again.
Greetings from Berlin, p