Показват се публикациите с етикет 3g. Показване на всички публикации
Показват се публикациите с етикет 3g. Показване на всички публикации

неделя, 19 декември 2010 г.

How to use Alcatel One Touch X220L 3G modem in Linux

Thanks to the many and extremely unnerving problems with my Internet connection, we decided to get a 3G/HSPA USB modem, for backup. Of course, all the installation files are for Windows, so I had to Google for a solution. I found this Ubuntu HOWTO that helped me connect to Internet with the USB device.
Without getting in details, here's what I did:
Plug-in your device and type:
>$sudo lsusb
Look for a line looking like this:
>$Bus 001 Device 003: ID 1bbb:f000 T & A Mobile Phones

If you have "f000" part, then you need to install a program that will switch it to "0000".
1. Install usb_modeswitch. Sabayon Linux had it in Entropy, but you may need to download it.
2. Configure usb_modeswitch ( >$sudo nano /etc/usb_modeswitch.conf ) adding the lines:
########################################################
# Alcatel X220L

DefaultVendor=  0x1bbb
DefaultProduct= 0xf000

TargetVendor=   0x1bbb
TargetProduct=  0x0000

# only for reference
# MessageEndpoint=0x01

MessageContent="55534243123456788000000080000606f50402527000000000000000000000"
########################################################

Save and plug the device again.
3. >$sudo usb_modeswitch


4. Look at your syslog ($dmesg|tail), you should now see:
"..... Direct-Access USBModem MMC Storage 2.31 PQ: 0 ANSI: 2 "

5. Start the driver for the modem
>$sudo modprobe usbserial vendor=0x1bbb product=0x0000

In >$dmesg|tail you should now see:

Jul 11 10:24:16 eee-yard kernel: [  100.388222] usb 1-2: configuration #1 chosen from 1 choice
Jul 11 10:24:16 eee-yard kernel: [  100.390492] usbserial_generic 1-2:1.0: generic converter detected
Jul 11 10:24:16 eee-yard kernel: [  100.390658] usb 1-2: generic converter now attached to ttyUSB0
Jul 11 10:24:16 eee-yard kernel: [  100.390952] usbserial_generic 1-2:1.1: generic converter detected
Jul 11 10:24:16 eee-yard kernel: [  100.391068] usb 1-2: generic converter now attached to ttyUSB1
Jul 11 10:24:16 eee-yard kernel: [  100.394230] scsi4 : SCSI emulation for USB Mass Storage devices
Jul 11 10:24:16 eee-yard kernel: [  100.395689] usbserial_generic 1-2:1.3: generic converter detected
Jul 11 10:24:16 eee-yard kernel: [  100.395847] usb 1-2: generic converter now attached to ttyUSB2
Note the last number where your usb puts the modem, in my case, it was USB4.
To check it, just enter:
>$screen /dev/ttyUSB4

and at the prompt, ask the modem to identify itself typing:
>ATI
The answer should be:
>Manufacturer: TCT Mobile International Limited
Model: HSPA Data Card
Revision: C1111000
IMEI: 352079030611766
+GCAP: +CGSM,+DS,+ES


If you want to automate this, you can add the rules with >$sudo nano /etc/udev/rules.d/50-alcatel.rules adding

SUBSYSTEM=="usb", SYSFS{idProduct}=="f000", SYSFS{idVendor}=="1bbb", RUN+="/usr/sbin/usb_modeswitch"
SUBSYSTEM=="usb", SYSFS{idProduct}=="0000", SYSFS{idVendor}=="1bbb", RUN+="/sbin/modprobe usbserial vendor=0x1bbb product=0x0000"

Check where usb_modeswitch is, mine was in "/usr/sbin", but if it's not there, use the appropriate directory.

Connecting the modem with wvdial:

1- Remove the PIN of your SIM

2- >sudo wvdial

But first,
>$sudo gedit /etc/wvdial.conf - here is my file, which works with VIVACOM Bulgaria, for TIM Italy, check the source.

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","internet.vivacom.bg"
Modem = /dev/ttyUSB4
Check Def Route = on
Phone = *99#
Username = VIVACOM
Password = VIVACOM
Modem Type = Analog Modem
Stupid Mode = 1
Baud = 460800
New PPPD = yes
ISDN = 0
AutoDNS = 1

You should change init3 and User and Password with those given by your providers.

Once you created the file, just run wvdial (or in my case, >$sudo wvdial...) and that's it. You'll receive some messages but after you see you DNS, everything is ready for browsing!
Enjoy!