Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
tytower
Posts: 3
Joined: 17 Sep 2009, 10:41

Huwai USB E160E-how to switch without usb_modeswitch ?

Post by tytower » 04 Nov 2011, 21:55

I have the above modem
I want to run it from a sparkfun USB host shield board on an Arduino Duemilanove board

What part of usb_modeswitch actually does the switch ? Can I duplicate that in C++?
I know that "HuwaeMode=1" switches it from the reference file but I don't know how to send this to the modem when it first boots
There is also a AT^DIAG= type switch which is supposed to switch the CD mode off permanently but I have not had success as yet

Can anybody help please

Josh
Site Admin
Posts: 6593
Joined: 03 Nov 2007, 00:30

Post by Josh » 04 Nov 2011, 22:59

Firstly, I recommend using the bulk message method; the control transfer mode was used for some very early Huawei modems only. See all Huawei configs in the data package.

To mode-switch a Huawei device you'd have to
1. detach the previous driver (almost always usb-storage)
2. claim the first interface
3. send the bulk message to it

This may even be possible via sysfs attributes, but the usb_modeswitch core tool is intended to be independent of the Unix flavor, thus using libusb.


tytower
Posts: 3
Joined: 17 Sep 2009, 10:41

Post by tytower » 06 Nov 2011, 00:10

Thanks for reply Josh
I'm afraid my expertise is well below whats needed .
Could you please explain a little more ? or perhaps easier if you could point me to a link that explains this bulk message method and points 1 ,2 and 3 of your post

Josh
Site Admin
Posts: 6593
Joined: 03 Nov 2007, 00:30

Post by Josh » 06 Nov 2011, 16:09

It's not as complicated as it may seem.

The steps I described translate to one function each in libusb.

See the docs:

1. detach driver - reference

2. claim interface - reference

3. send bulk message - reference

To get the device handle used in these operations, you have to conduct a search on the USB bus once and pick your device. Just start working with the example - reference

For mode switching in Huawei devices, the only interface to talk to is the first one (no. 0).


Post Reply