Saturday, May 12, 2012

Configuring a Tata Photon+ USB device in Linux

It has been a long time since my last post because I changed jobs three months ago, and in fact this post might give a hint about my new situation; anyway I hope to keep posting Linux and UNIX-related messages and this one is about dealing with a mobile broadband USB device. It is not so difficult to work with this kind of devices in Linux, and is very simple to configure it with NetworkManager, but first you need to have installed the usb-modeswitch software that changes the device's state from USB storage to USB modem in order to use the USB dongle as a modem. In Debian Squeeze you can do it installing the usb-modeswitch package. If you don't have the usb-modeswitch software you will see just an USB storage device, something like this:
May 12 15:23:38 olimpo kernel: [   64.172559] usb 2-1: new full speed USB device using uhci_hcd and address 2
May 12 15:23:38 olimpo kernel: [   64.339573] usb 2-1: New USB device found, idVendor=12d1, idProduct=1446
May 12 15:23:38 olimpo kernel: [   64.339584] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=4
May 12 15:23:38 olimpo kernel: [   64.339593] usb 2-1: Product: HUAWEI Mobile
May 12 15:23:38 olimpo kernel: [   64.339600] usb 2-1: Manufacturer: HUAWEI TECHNOLOGIES
May 12 15:23:38 olimpo kernel: [   64.339607] usb 2-1: SerialNumber: XXXXXXXXXXXXXXXXXX
May 12 15:23:38 olimpo kernel: [   64.339850] usb 2-1: configuration #1 chosen from 1 choice
May 12 15:23:38 olimpo kernel: [   64.350119] scsi4 : SCSI emulation for USB Mass Storage devices
May 12 15:23:38 olimpo kernel: [   64.360054] usb-storage: device found at 2
May 12 15:23:38 olimpo kernel: [   64.360061] usb-storage: waiting for device to settle before scanning
After installing the usb-modeswitch software you can plug your USB modem, and you will see at the end something like this:
May 12 15:23:40 olimpo usb_modeswitch: switching 12d1:1446 (HUAWEI TECHNOLOGIES: HUAWEI Mobile)
May 12 15:23:46 olimpo kernel: [   70.408061] usb 2-1: new full speed USB device using uhci_hcd and address 3
May 12 15:23:46 olimpo kernel: [   70.576318] usb 2-1: New USB device found, idVendor=12d1, idProduct=140b
May 12 15:23:46 olimpo kernel: [   70.576330] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=4
May 12 15:23:46 olimpo kernel: [   70.576339] usb 2-1: Product: HUAWEI Mobile
May 12 15:23:46 olimpo kernel: [   70.576345] usb 2-1: Manufacturer: HUAWEI TECHNOLOGIES
May 12 15:23:46 olimpo kernel: [   70.576352] usb 2-1: SerialNumber: XXXXXXXXXXXXXXXXXX
May 12 15:23:46 olimpo kernel: [   70.576600] usb 2-1: configuration #1 chosen from 1 choice
May 12 15:23:46 olimpo kernel: [   70.587360] scsi8 : SCSI emulation for USB Mass Storage devices
May 12 15:23:46 olimpo kernel: [   70.588245] usb-storage: device found at 3
May 12 15:23:46 olimpo kernel: [   70.588252] usb-storage: waiting for device to settle before scanning
May 12 15:23:46 olimpo kernel: [   70.785972] usbcore: registered new interface driver usbserial
May 12 15:23:46 olimpo usb_modeswitch: switched to 12d1:140b (HUAWEI TECHNOLOGIES: HUAWEI Mobile)
May 12 15:23:46 olimpo kernel: [   70.787067] USB Serial support registered for generic
May 12 15:23:46 olimpo kernel: [   70.788192] usbcore: registered new interface driver usbserial_generic
May 12 15:23:46 olimpo kernel: [   70.788201] usbserial: USB Serial Driver core
May 12 15:23:46 olimpo kernel: [   71.042606] USB Serial support registered for GSM modem (1-port)
May 12 15:23:46 olimpo kernel: [   71.048829] option 2-1:1.0: GSM modem (1-port) converter detected
May 12 15:23:46 olimpo kernel: [   71.050191] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB0
May 12 15:23:46 olimpo kernel: [   71.050242] option 2-1:1.1: GSM modem (1-port) converter detected
May 12 15:23:46 olimpo kernel: [   71.050660] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB1
May 12 15:23:46 olimpo kernel: [   71.050702] option 2-1:1.2: GSM modem (1-port) converter detected
May 12 15:23:46 olimpo kernel: [   71.056719] usb 2-1: GSM modem (1-port) converter now attached to ttyUSB2
May 12 15:23:46 olimpo kernel: [   71.056795] usbcore: registered new interface driver option
May 12 15:23:46 olimpo kernel: [   71.056803] option: v0.7.2:USB Driver for GSM modems
This is the most important part, to have detected your USB dongle as a GSM modem. If you like you can configure it easily with NetworkManager, but if you prefer something that you can do in a terminal then install the wvdial package and fill the /etc/wvdial.conf and /etc/ppp/chap-secrets files with this:
olimpo:/var/log# cat /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
ISDN = 0
Phone = #777
New PPPD = yes
Modem = /dev/ttyUSB0
Username = internet
Password = internet
Baud = 230400

olimpo:/var/log# cat /etc/ppp/chap-secrets
# Secrets for authentication using CHAP
# client server secret   IP addresses
internet * internet
And if you're using Debian you can also issue the dpkg-reconfigure wvdial command and give all the information required to the configuration program. Then you can launch wvdial as root from a terminal prompt and connect to the Internet, and you will see something like this in the syslog:
May 12 15:47:06 olimpo pppd[11490]: pppd 2.4.5 started by root, uid 0
May 12 15:47:06 olimpo kernel: [ 1770.688570] PPP generic driver version 2.4.2
May 12 15:47:06 olimpo pppd[11490]: Using interface ppp0
May 12 15:47:06 olimpo pppd[11490]: Connect: ppp0 <--> /dev/ttyUSB0
May 12 15:47:09 olimpo pppd[11490]: CHAP authentication succeeded
May 12 15:47:09 olimpo pppd[11490]: CHAP authentication succeeded
May 12 15:47:09 olimpo kernel: [ 1773.210976] PPP BSD Compression module registered
May 12 15:47:09 olimpo kernel: [ 1773.225216] PPP Deflate Compression module registered
May 12 15:47:09 olimpo pppd[11490]: local  IP address 59.161.17.54
May 12 15:47:09 olimpo pppd[11490]: remote IP address 172.29.145.65
May 12 15:47:09 olimpo pppd[11490]: primary   DNS address 4.2.2.3
May 12 15:47:09 olimpo pppd[11490]: secondary DNS address 121.242.190.181

...

May 12 15:54:11 olimpo pppd[11490]: Terminating on signal 15
May 12 15:54:11 olimpo pppd[11490]: Connect time 7.1 minutes.
May 12 15:54:11 olimpo pppd[11490]: Sent 460447 bytes, received 1883330 bytes.
Of course, this procedure might be helpful for configuring other USB modems as well.

No comments:

Post a Comment