UPDATE: In the comments, a reader named "Big Brother" has a nicer solution, instead of using the scripts below, just follow this steps:
1- Add these lines to /lib/udev/rules.d/40-usb_modeswitch.rules:
# Vodafone K5005 (Huawei E398)2- Create file /etc/usb_modeswitch.d/12d1:14c3:
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14c3", RUN+="usb_modeswitch '%b/%k'"
# Vodafone K5005 (Huawei E398)3- Unplug device, plug it back and it should work automagically ;)
TargetVendor= 0x12d1
TargetProduct= 0x14c8
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
Deprecated method:
#!/bin/bashNote that the commands above are for the Vodafone branded (K5005) Huawei E389 dongle, for the unbranded device the product ID is different and you should use:
rmmod option
modprobe option
echo "12d1 14c8" > /sys/bus/usb-serial/drivers/option1/new_id
usb_modeswitch -v 12d1 -p 14c3 -V 12d1 -P 14c8 -M "55534243123456780000000000000011062000000100000000000000000000" -n 1
#!/bin/bashYou can check the product id with:
rmmod option
modprobe option
echo "12d1 1506" > /sys/bus/usb-serial/drivers/option1/new_id
usb_modeswitch -v 12d1 -p 1505 -V 12d1 -P 1506 -M "55534243123456780000000000000011062000000100000000000000000000" -n 1
lsusbIn my case I get:
Bus 002 Device 007: ID 12d1:14c3 Huawei Technologies Co., Ltd.
Thank you for this tutorial mate!
ReplyDeleteA question: why do you use 14c8 when in fact the lsusb gives you 14c3??
would it be possible for you to explain what these parameters mean? sudo usb_modeswitch -v 12d1 -p 1505 -V 12d1 -P 1506 -M
thank you!
I use what worked for me :P
Delete14c3 is the default ID of the original mode (when the modem is detected as a storage device)
14c8 is the target mode, I got that ID from trial and error...
Just a tip (works for me on a fresh ubuntu 12.04 lts install where i'm running broadband pen connection for the very first time).
ReplyDeleteIf you can't find /sys/bus/usb-serial/drivers/option1/new_id (/sys/bus/usb-serial does not exist) run:
sudo modprobe -v option
After this path will be allways available and you may run Luis Davim's script whenever you want (after you run Luis's script you will be prompted for pen pin, if any)
Also, after script (must be ran each time you need to connect - I'll investigate a way for auto-run this later) and if is your first time connecting using Vodafone 4g pen, you must:
1. run "Network Connections" from "Dash home" (or "nm-connection-editor" from command line)
2. under "Mobile BroadBand" tab add a new device by clicking "Add"
3. click "Continue" (after check if "Vodafone Group (Huawai) Vodafone Mobile Broadband (Huawai)" is selected under "Create a connection for this mobile broadband device:")
4. select your country and click "Continue"
5. select "Vodafone" provider and click "Continue"
6. now leave defaults(Plan: default, APN: internet.vodafone.pt <- for me) and click "Continue"
7. click "Apply"
8. you do not need to change anything on the new window, but you can change "Connection name" and set to "Connect automatically" if you want, and finally click "Save..."
Now your pen is listed on "Network Connections" app, under "Mobile Broadband" tab.
To connect just click at connection icon at top right of desktop bar (wifi icon) and you'll see your new connection available. Click on it to connect.
Cheers!
Thanks to you all, my K5005 is working! Cheers!
ReplyDeleteFor Ubuntu 12.04:
ReplyDelete- Add these lines to /lib/udev/rules.d/40-usb_modeswitch.rules:
# Vodafone K5005 (Huawei E398)
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14c3", RUN+="usb_modeswitch '%b/%k'"
- Create file /etc/usb_modeswitch.d/12d1:14c3:
# Vodafone K5005 (Huawei E398)
TargetVendor= 0x12d1
TargetProduct= 0x14c8
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
- Unplug device, plug it back and it should work automagically ;)
Thanks Big Brother :)
ReplyDeleteThanks to Big Brother, got my E389 modem to work on Debian laptop, connecting to Swedish Tele2. Tele2 support wash their hands of Linux, just refer to some Huawei software which does NOT work. So huge thanks once more.
ReplyDeleteI have just reinstalled wheezy on my HP Pavilion dm1, again using the Huawei E398 obtained from Tele2, Sweden, and now find the following:
ReplyDelete- lsusb shows the device ID to be 1506
- /lib/udev/rules.d/40-usb_modeswitch.rules already contained the line proposed by Big Brother
- I inserted a line with device ID 1506 instead of 14c3
- I made a file in /etc/usb_modeswitch.d/ 12d1:1506 with the content suggested (switching mode to whatever 14c8 would call for)
- I found that that file was superfluous, just took it away and the modem still connects
- for anyone working in Sweden with Tele2, in the Edit Network Connection dialogue I have APN 4g.tele2.se, Connect Automatically and System Connection are checked, PIN setting is Not Required.
Hope this may be helpful.