Thursday, March 5, 2009

USB 3G on Linux UBuntu

Ok this posting, is rather off topic, but someone gave me a USB 3G stick, only the stick, nothing else, no docs/manual what so ever. Black in colour, with 3M label and 3M Mobile warranty sticker. Others info, "Made in China" and M66 Model.

Ok, the first thing I did, plug it to my notebook and see s what happen, and as usual my ubuntu detect it as a usb storage, and look at dmesg gave me nothing as an usbserial device.

So my next step is to get few more info of the device by using 'lsusb'
xjutsu@xjutsu-laptop:~$ lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 007: ID 1c9e:1001
Bus 004 Device 002: ID 15ca:00c3
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 003: ID 413c:8103 Dell Computer Corp. Wireless 350 Bluetooth
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
xjutsu@xjutsu-laptop:~$
this usb 3g actually a two mode system. Some how u need to interact with the first system than only the usb serial device will be avalilable.

for this we need usb_modeswitch , try to google for usb_modeswitch and download the software. u need libusb to compile and running the binary.

after installation u need to edit /etc/usb_modeswitch.conf and look for something like this:

DefaultVendor= 0x1c9e
DefaultProduct= 0x1001

#TargetVendor= 0x1c9e
#TargetProduct= 0x6061

MessageEndpoint=0x05
MessageContent="55534243123456780000000000000606f50402527000000000000000000000"

next just execute usb_modeswitch in your shell cmd line.

root@xjutsu-laptop:~# usb_modeswitch

* usb_modeswitch: tool for controlling "flip flop" mode USB devices
* Version 0.9.6 (C) Josua Dietze 2009
* Works with libusb 0.1.12 and probably other versions

Looking for default devices
Found default devices (1)
Prepare switching, accessing latest device
Looking for active default driver to detach it
OK, driver found ("usb-storage")
OK, Driver "usb-storage" successfully detached
Setting up communication with device
Trying to send the message
OK, message successfully sent.
-> See /proc/bus/usb/devices (or call lsusb) for changes. Bye

now if u do lsusb again i will show diff thing:

xjutsu@xjutsu-laptop:~$ lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 007: ID 1c9e:6061
Bus 004 Device 002: ID 15ca:00c3
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 003: ID 413c:8103 Dell Computer Corp. Wireless 350 Bluetooth
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
xjutsu@xjutsu-laptop:~$

and finally just load the usbserial module

root@xjutsu-laptop:~# modprobe usbserial vendor=0x1c9e product=0x6061

look at you dmesg :

[ 195.420000] usbcore: registered new interface driver usbserial
[ 195.420000] drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
[ 195.472000] usbserial_generic 4-2:1.0: generic converter detected
[ 195.476000] usb 4-2: generic converter now attached to ttyUSB0
[ 195.476000] usbserial_generic 4-2:1.1: generic converter detected
[ 195.480000] usb 4-2: generic converter now attached to ttyUSB1
[ 195.480000] usbserial_generic 4-2:1.2: generic converter detected
[ 195.480000] usb 4-2: generic converter now attached to ttyUSB2
[ 195.484000] usbcore: registered new interface driver usbserial_generic
[ 195.484000] drivers/usb/serial/usb-serial.c: USB Serial Driver core

voila your serial interface is ready and kicking.........