Franxois
Posts: 13
Joined: Fri Apr 27, 2012 9:33 am

GPRS usb modem, Huawei E171

Mon Feb 04, 2013 11:15 am

Hello,

I would like to use an GPRS modem for my project.
I use raspbian, I allready manage to have a connection using usb_modeswitch and wvdial. The key as 2 modes, storage and modem. usb_modeswitch allows me to switch from storage to modem mode.

I have one problem. If the raspberry is already on, I plug the key and usb_modeswitch do it's job.
If I plug the key before the raspberry start, I can't use the modem. The key stays in storage mode and usb_modeswitch don't seem to run. There's no /dev/ttyUSB* links.
If I plug and unplug the key, usb_modeswitch change the mode.

Do you know why udev/usb_modeswitch don't work if the key is plugged when the raspberry boot ?
Is there a soft way to plug/unplug the key ? I would like to let the raspberry running for days without humain intervention.

jriff
Posts: 4
Joined: Tue Feb 12, 2013 8:08 am

Re: GPRS usb modem, Huawei E171

Tue Feb 12, 2013 8:11 am

I have the exact same problem with a TP-LINK MA180. Works fine if I unplug and plug in the device - if have it inserted on boot usb_modeswitch fails. Also fails if I run usb_modeswitch from the command line after boot. VERY strange.

Does anyone have an idea?

Cloudcentric
Posts: 982
Joined: Fri Sep 14, 2012 9:13 am

Re: GPRS usb modem, Huawei E171

Tue Feb 12, 2013 9:03 am

Have you tried SAKIS3G to configure the USB 3G Dongle ?

http://sourceforge.net/projects/vim-n4n0/files

On command line navigate to directory where download, unpack sakis3g.tar.gz then undertake following:

chmod +x sakis3g
./sakis3g --interactive
I know everything about nothing"

MattF
Posts: 55
Joined: Tue Feb 12, 2013 10:01 am

Re: GPRS usb modem, Huawei E171

Tue Feb 12, 2013 10:08 am

Something, and I have not been able to figure out what, is not quite right with udev in raspian.

I have also experienced 3G USB dongles that don't seem to modeswitch properly.

At the moment I am using the ugly kludge of restarting udev at the top of rc.local
(service udev stop
service udev start)

which means that things get properly modeswitched.

It's almost as if "Synthesizing the initial hotplug events" (udevadm trigger --action=add;) isn't doing it's job properly.

jriff
Posts: 4
Joined: Tue Feb 12, 2013 8:08 am

Re: GPRS usb modem, Huawei E171

Tue Feb 12, 2013 10:09 am

Got sort of a solution:

Create the file: /etc/udev/rules.d/41-usb_modeswitch.rules with this content:

ATTRS{idVendor}=="2357", ATTRS{idProduct}=="0200", RUN+="usb_modeswitch '%b/%k'"

- remember to change the vendor and product to suit your dongle. That makes it switch on boot.

Franxois
Posts: 13
Joined: Fri Apr 27, 2012 9:33 am

Re: GPRS usb modem, Huawei E171

Tue Feb 12, 2013 4:01 pm

jriff wrote:Got sort of a solution:

Create the file: /etc/udev/rules.d/41-usb_modeswitch.rules with this content:

ATTRS{idVendor}=="2357", ATTRS{idProduct}=="0200", RUN+="usb_modeswitch '%b/%k'"

- remember to change the vendor and product to suit your dongle. That makes it switch on boot.
I found a way to reboot the USB port after the raspberry was ON in http://www.raspberrypi.org/phpBB3/viewt ... 94#p284594 but your solution looks better.

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: GPRS usb modem, Huawei E171

Tue Feb 12, 2013 4:32 pm

@Franxois: please report back if the udev rule works for you, I gave up on trying to find one that would reset my usb0 connection other than a reboot and manually entering commands after that.
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

Franxois
Posts: 13
Joined: Fri Apr 27, 2012 9:33 am

Re: GPRS usb modem, Huawei E171

Tue Feb 12, 2013 5:30 pm

sdjf wrote:@Franxois: please report back if the udev rule works for you, I gave up on trying to find one that would reset my usb0 connection other than a reboot and manually entering commands after that.
I fill the /etc/udev/rules.d/41-usb_modeswitch.rules file with

Code: Select all

ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="usb_modeswitch '%b/%k'"
usb_modeswich was working allright if I unplugged and pluged the modem once the system was fully started but not if the key was plugged before the power on.

User avatar
tabbycat
Posts: 36
Joined: Thu Feb 14, 2013 5:57 pm
Location: Russia
Contact: ICQ Website

Re: GPRS usb modem, Huawei E171

Thu Feb 14, 2013 8:14 pm

I met the same problem with my E1550. I had to use AT command AT^U2DIAG=0 to make USB dongle start with "modem" mode, and not "modem+cdrom".
Maybe it will not work for E171, but why not to try? https://wiki.archlinux.org/index.php/Hu ... 0_3G_modem
Feel free to contact me anytime! email-xmpp [email protected] icq 4735902 skype nikolay.g.kim

talkeasy
Posts: 38
Joined: Sun Nov 04, 2012 10:57 pm

Re: GPRS usb modem, Huawei E171

Sat May 04, 2013 4:43 pm

tabbycat

Thanks for this suggestion. Couldn't figure out why my E1550 would not show up as a ttyUSB until your post.

Great job.

Killertechno
Posts: 173
Joined: Wed Jan 02, 2013 8:28 am

Re: GPRS usb modem, Huawei E171

Wed May 29, 2013 12:54 pm

Thanks, I had similar problem wit 3G modem ONDA MDW655.
After installed usb-modeswitch I always had device configured as USB disk at boot, so I always need to reboot rasp to find device automatically configured as USB modem.
Or should I unplug-plug USB device to start automatic conversion.

Whit following code (I had to change Vendor and PrductID) I find always USB device set as modem.

jriff wrote: I fill the /etc/udev/rules.d/41-usb_modeswitch.rules file with

Code: Select all

ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="usb_modeswitch '%b/%k'"

clewin
Posts: 1
Joined: Sat Oct 19, 2013 8:03 am

Re: GPRS usb modem, Huawei E171

Sat Oct 19, 2013 8:18 am

I think there is a real underlying problem with the way Raspbian handles the Multimode devices. I have experimented with several 3.5G & 3.75G devices Including d-link and the only one that offers solid reliable performance in the Huawei e220. This does not seem to need usb-modeswitch and works well once the at^U2diag=0 command is used.
The other devices just won't play nicely. Interestingly, they all work properly on my Ubuntu 12.04 laptop. So it must be possible to work in Linux (x86) ..just not Raspian/Arm?
Sadly, I am unable to offer constructive suggestions beyond these observations..we need someone cleverer than me to move this forward beyond workaround. :-(

gizero
Posts: 1
Joined: Fri Oct 10, 2014 8:28 am

Re: GPRS usb modem, Huawei E171

Fri Oct 10, 2014 5:33 pm

Franxois wrote:Hello,

I would like to use an GPRS modem for my project.
I use raspbian, I allready manage to have a connection using usb_modeswitch and wvdial. The key as 2 modes, storage and modem. usb_modeswitch allows me to switch from storage to modem mode.

I have one problem. If the raspberry is already on, I plug the key and usb_modeswitch do it's job.
If I plug the key before the raspberry start, I can't use the modem. The key stays in storage mode and usb_modeswitch don't seem to run. There's no /dev/ttyUSB* links.
If I plug and unplug the key, usb_modeswitch change the mode.

Do you know why udev/usb_modeswitch don't work if the key is plugged when the raspberry boot ?
Is there a soft way to plug/unplug the key ? I would like to let the raspberry running for days without humain intervention.
Found this post, while dealing with this exact issue with a huawei E173 dongle. I'll throw my two cents, trying to contribute in better understanding what's going on.
If you look at your dmesg, and I'm not getting it wrong, you'll probably notice that device enumeration for your dongle on the USB bus is happening earlier in boot sequence than udevd process startup. Mine look like this:

[ 3.508594] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[ 3.651232] usb 1-1.3: New USB device found, idVendor=12d1, idProduct=1446
[ 3.664753] usb 1-1.3: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[ 3.678314] usb 1-1.3: Product: HUAWEI Mobile
[ 3.688700] usb 1-1.3: Manufacturer: HUAWEI Technology

^^^^ kernel generates "add" event here ^^^^

[ 3.703954] usb-storage 1-1.3:1.0: USB Mass Storage device detected
[ 3.717203] scsi0 : usb-storage 1-1.3:1.0
[ 3.730312] usb-storage 1-1.3:1.1: USB Mass Storage device detected
[ 3.743627] scsi1 : usb-storage 1-1.3:1.1
[ 4.441566] udevd[160]: starting version 175

^^^^ udevd process initializes here ^^^^

[ 4.745904] scsi 0:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
[ 4.794191] scsi 1:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2

In such a situation, usb-modeswitch udev rules won't see the "add" event for your device. This in fact invalidates what's usb-modeswitch is supposed to do. See i.e. [1] for an explanation of how this is an expected scenario.

That said, many workarounds have already been described in this thread. In particular all the following worked for me:
  • sudo sh -c 'echo add >/sys/bus/usb/devices/1-1.3\:1.0/uevent'
  • sudo udevadm trigger
They can be placed in late boot scripts for automating the process. There might be better ways to handle this, but this is what I can contribute.

I guess the reason why this is happening on a Raspberry and not on different hardware is Pi's relatively slow access to the rootfs where udevd executable must be loaded from. On the other end, the dongle is probably quick enough to identify itself as soon as power is available from the bus, causing the kernel to emit events accordingly.

[1] http://doc.opensuse.org/products/draft/ ... .udev.boot

This is for the records, hoping it can help anyone facing this or similar issues.

Return to “Advanced users”