NicoVanDerDussen
Posts: 74
Joined: Sat Aug 24, 2013 2:41 pm

Problems with usb_modeswitch

Mon Nov 10, 2014 12:11 pm

Hi,

I want to connect via a 3G modem to the internet.

I installed via apt-get install ppp wvdial usb-modeswitch

When I POWERUP, with the modem in a 4-port hub (with keyboard), the mode does not switch.

If I remove the modem from the hub for 10 seconds and place it back, it appears correctly - and /dev/gsmmodem appears.

Connecting with wvdial works perfectly.

With rebooting the 3G modem mode switch happens perfectly, and with the root crontab @reboot wvdial connects perfectly to the internet

But, when going down with sudo shutdown -h now and removing power after a minute and then again plugging in the power, the switching does not happen.

I need to unplug the modem from the hub again, and the replace it. Then the mode switching happens and wvdial works like a charm again.

What am I doing wrong? :)

The Raspberry Pi must eventually operate without human intervention and connect to 3G on every reboot.


Thanks
Nico
Setting up your Raspberry Pi to work with a 3G dongle http://nvdd.info/11gKrsZ

NicoVanDerDussen
Posts: 74
Joined: Sat Aug 24, 2013 2:41 pm

Re: Problems with usb_modeswitch

Mon Nov 10, 2014 2:33 pm

As usual, I could not find any solution to the issue on Google before posting.

So I post the issue.

Next Google hits the problem spot on :)

Here is my solution:
(beware - newbie swimming among crocodiles!)

See http://www.raspberrypi.org/forums/viewt ... 7&p=285871 for a discussion on the issue.

The script below solves the problem - must be run with sudo

Code: Select all

#!/bin/bash
sleep 10
udevadm trigger
sleep 2m
wvdial

I'm very keen to learn from the experts - is there a better way of doing this?
Setting up your Raspberry Pi to work with a 3G dongle http://nvdd.info/11gKrsZ

User avatar
Douglas6
Posts: 4955
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Problems with usb_modeswitch

Mon Nov 10, 2014 4:08 pm

I'm guessing that usb-modeswitch requires parts of the file system that are not ready when the udev rules run at boot time, hence the need to re-trigger them once the OS is all set up. So that script I think would be the way to go. I'd add it to the end of /etc/rc.local (see here), if you haven't already. Those commands will be run as root, so no need for sudo, but do use full path names.

NicoVanDerDussen
Posts: 74
Joined: Sat Aug 24, 2013 2:41 pm

Re: Problems with usb_modeswitch

Tue Nov 11, 2014 9:26 am

Hi Douglas,

thanks for your comments.

I added the script to the init.d sequence - and it did not work as expected.

After removing it from there, I added it to the rc.local file, like /root/3GModem.sh & and it worked like a charm.

Question: It seems as if udevadm trigger is a bit of a sledge hammer approach. Is there a way to trigger only the modem?

Thanks
Nico

I'm busy documenting my learning as a blog.
Setting up your Raspberry Pi to work with a 3G dongle http://nvdd.info/11gKrsZ

DirkS
Posts: 10453
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Problems with usb_modeswitch

Tue Nov 11, 2014 9:52 am

Question: It seems as if udevadm trigger is a bit of a sledge hammer approach. Is there a way to trigger only the modem?
There are additional options for 'trigger' that should make it possible to be more specific. See e.g. http://linux.die.net/man/8/udevadm

User avatar
Douglas6
Posts: 4955
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Problems with usb_modeswitch

Tue Nov 11, 2014 2:30 pm

And udevmonitor is useful for seeing what goes on when the dongle is discovered (run it and hotswap the modem)

NicoVanDerDussen
Posts: 74
Joined: Sat Aug 24, 2013 2:41 pm

Re: Problems with usb_modeswitch

Wed Nov 12, 2014 8:06 am

See my blog post on this at http://nvdd.info/11gKrsZ

Many thanks to all for the inputs!
Setting up your Raspberry Pi to work with a 3G dongle http://nvdd.info/11gKrsZ

Return to “Advanced users”