I am using a 3g dongle and usb_modeswith. It works fine if I plug the device after the Raspbian Os has booted up. The thing is, it does not connect (wvdial doesnt detect modem) , if the modem is already connected to the pi, and I reboot (or power on the device after shutdown -P -h).

What do I do to make the usb mode switch everytime it detects my device connected. I am making a project that does not have a screen, so it is essential that The Pi connects without replugging and/or extra input.

Right now I have to do the following to connect to the internet(using the dongle)

  1. wait for the pi to boot
  2. Plug in the modem(replug if already plugged in)
  3. run usb_modeswitch -c /etc/usb_modeswitch.conf
  4. run wvdial

Why do I have to do the following ? Isnt there any way to reduce these steps ?

  • Think of a crontab entry to keep checking for the presence of the USB and run the usb_modeswitch... Possible?
    – Kangkan
    Commented Aug 7, 2014 at 12:43
  • does it make any difference if you plug the 3g dongle into a mains powered hub connected to the Pi?
    – rob
    Commented Aug 7, 2014 at 12:56
  • I am using the B+, do I need to connect to a powered hub ? Commented Aug 7, 2014 at 13:19
  • @Kangkan , could you please give more info on it? Commented Aug 7, 2014 at 13:20
  • My modem shows the following id when I connect 12d1:1446 , could you tell me how to check for that and then connect ? Commented Aug 7, 2014 at 13:22

1 Answer 1


I had the same problem with my RasPi B+ (with the exact same settings that works fine with a RasPi B). But I'm not using wvdial because the dongle has HiLink.

The USB-switch doesn't seem to work properly with the B+ somehow.

$lsusb Bus 001 Device 004: ID 12d1:1f01 Huawei Technologies Co., Ltd. (should be 12d1:14db Huawei Technologies Co., Ltd.)

Updated to the latest USB-modeswitch (2.2.1, release dated from 2015-01-15) but that didn't solve my problem.

Tested to manually change the ID with: $sudo usb_modeswitch -v 0x12d1 -p 0x1f01 -V 0x12d1 -P 0x14db -M "55534243123456780000000000000a11062000000000000100000000000000"

And that actually worked.

Then I just made a little shell script to make the dongle work when booting.

$sudo nano /etc/network/if-pre-up.d/modeswitch

And changed the owner to root, the script to be executable by User, Group and World.

$sudo chown root:root /etc/network/if-pre-up.d/modeswitch

$sudo chmod +x /etc/network/if-pre-up.d/modeswitch

$sudo chmod 755 /etc/network/if-pre-up.d/modeswitch

Then reboot and the dongle works again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.