неделя, 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!

5 коментара:

  1. Great solution. I reached here when I got a road block on the way to find a solution for using my OneTouch-X230L Alcatel Modem in my Ubuntu / Crunchbang systems. Still I haven't tested this in my machine, yet I feel this will work. Will comment once again after experimenting your suggestions. Thanks in advance

    ОтговорИзтриване
  2. Hey thanx for the step by step method, but I'm having a problem here.
    After modeprobe command I don't get the same output with dmesg. And then screen don't work for me, cuz I don't have ttyUSB at all and I don't know which tty to use. I'm with Kubuntu 13.04 just updated to kernel 3.7.8.(also tried on Mint 14 Nadia - same result)
    I would really appreciate some help here.
    Thanx in advance.

    ОтговорИзтриване
  3. Hi, great tuto but i have an error code when the ppp deamon is starting.
    I'm using an x220l 3g dongle on a raspberry pi.

    Here is the terminal output :
    sudo wvdial
    --> WvDial: Internet dialer version 1.61
    --> Initializing modem.
    --> Sending: ATZ
    ATZ
    OK
    --> Sending: ATQ0 V1 E1 +FCLASS=0
    ATQ0 V1 E1 +FCLASS=0
    OK
    --> Sending: AT+CPIN=xxxx
    AT+CPIN=xxxx
    OK
    --> Sending: AT+CGDCONT=1,"IP","mmsbouygtel.com"
    AT+CGDCONT=1,"IP","mmsbouygtel.com"
    OK
    --> Modem initialized.
    --> Sending: ATDT*99#
    --> Waiting for carrier.
    ATDT*99#
    CONNECT 115200
    --> Carrier detected. Starting PPP immediately.
    --> Starting pppd at Tue Jun 17 18:53:40 2014
    --> Pid of pppd: 3841
    --> Using interface ppp0
    --> pppd: ðqø¶[18]úÎ
    --> pppd: ðqø¶[18]úÎ
    --> pppd: ðqø¶[18]úÎ
    --> pppd: ðqø¶[18]úÎ
    --> Disconnecting at Tue Jun 17 18:53:44 2014
    --> The PPP daemon has died: A modem hung up the phone (exit code = 16)
    --> man pppd explains pppd error codes in more detail.
    --> Try again and look into /var/log/messages and the wvdial and pppd man pages for more information.
    --> Auto Reconnect will be attempted in 5 seconds
    --> Cannot open /dev/ttyUSB4: No such file or directory
    --> Cannot open /dev/ttyUSB4: No such file or directory
    --> Cannot open /dev/ttyUSB4: No such file or directory
    --> Disconnecting at Tue Jun 17 18:53:44 2014

    Any help would be appreciate !
    Thanks for reading

    ОтговорИзтриване
  4. Thanks for the instructions.

    In Ubuntu 16.04 just install wvdial, config it, and run it.

    I tested an one touch X602A (1bbb:022c), using the following configuration (for telcel - Mexico)

    [Dialer Defaults]
    Init1 = ATZ
    Init2 = AT+CGDCONT=1,"IP","internet.itelcel.com"
    Modem = /dev/ttyUSB1
    Check Def Route = on
    Phone = *99#
    Username = "blank"
    Password = "blank"
    Modem Type = Analogy Modem
    Stupid Mode = 1
    Baud = 460800
    New PPPD = yes
    ISDN = 0
    AutoDNS = 1

    ОтговорИзтриване