Unixbhaskar's Blog

Saturday, August 20, 2011

How to make USB modem work on Arch Linux

I think this topic is an uncanny one..YMMV. Anyway I have done it hundred times before and thought to share it with people.Plug in the USB modem and think it just work in GNU/Linux laptop is not the case(tell me the exception if you have come across one!!).

It basically require few thing to be checked out in the box,which are mandatory for the USB modem to work..which are:

1) You need to figure out whether usbserial driver is loaded into the system or not.But how do you detect that?(kidding!! I know all of you know that). Still give away the steps to do that:

A) at the terminal,please type the following:

sudo /sbin/lsmod |grep usbserial

and you should get a response like below:

bhaskar@bhaskar-laptop_09:47:44_Sat Aug 20:~> sudo /bin/lsmod | grep usbserial
usbserial 26639 4
usbcore 119644 9 uas,ums_realtek,usb_storage,uvcvideo,btusb,usbserial,xhci_hcd,ehci_hcd

Now if you don't get a response from that command,that means kernel haven't load the driver to detect the USB thing.So you need to do the following:

sudo /sbin/modprobe usbserial

It basically get that driver initialize into the system to work with it.So the story is not end on..

Step number 2:

It is essentially driven by the UDEV until you make the UDEV aware of will still hinder you from using it.

So how do you do that?

Now you need to go to the directory called /etc/udev/ should be there already and you need to add a udev rule file to in this dir like below:

ACTION!="add", GOTO="ZTE_End"

# Is this the ZeroCD device?
SUBSYSTEM=="usb", SYSFS{idProduct}=="2000",
SYSFS{idVendor}=="191g, GOTO="ZTE_ZeroCD"

# Is this the actual modem?
SUBSYSTEM=="usb", SYSFS{idProduct}=="0001",
SYSFS{idVendor}=="191g", GOTO="ZTE_Modem"

# This is the ZeroCD part of the card, remove
# the usb_storage kernel module so
# it does not get treated like a storage device
#RUN+="/sbin/rmmod usb_storage"

# This is the Modem part of the card, let's
# load usbserial with the correct vendor
# and product ID's so we get our usb serial devices
RUN+="/sbin/modprobe usbserial vendor=0x191g product=0xffff",
# Make users belonging to the dialout group
# able to use the usb serial devices.
MODE="660", GROUP="dialout"


I think the file is almost self explain itself.Now you need to restart the network one more time and put in your USB modem into the usb socket.

Then fire the command at the terminal..I am assuming you have wvdial installed in the system..

sudo wvdial providername

The USBmodem should able to ring back to the ISP; that you have already configured and provide you dynamic ip and dns names..voila!!!

You are connected to the internet through the wireless modem on GNU/Linux.To automate the thing in my laptop I have wrote a very very ordinary and mundane script to invoke from command line to get connected to the internet.The script look like below:


if [[ "$UID" = "0" ]]


echo " You have the super power to invoke this sript"
echo "Sorry, you don't have the power to run this script"

echo " Let's check whether the usb modem is connected to system or not"

/usr/sbin/lsusb | gawk -F: ' { print $2"===>"$3 }'


echo "probing the usb modem...loading driver too....."

/sbin/modprobe usbserial vendor=0x191g product=0xffff


echo "Connecting to ISP...."

/usr/bin/wvdial ProvidernameISP &>/var/log/wvdial&


sleep 5

echo "PID of of the WvDial..."

ps -ef | grep wvdial


sleep 3
echo "Checking the connection...."

/bin/ping -c 3


echo " Looking for live stat....."

/usr/bin/vnstat -i ppp0 -l

O yeah, I have written some information about vnstat in some other blog.It is a nice utility to measure net bandwidth.

Hope this will help.


No comments:

Post a Comment