¡darandandunguen!

Using a Huawei E620 3G card in linux

Hace tiempo que venía utilizando una tarjeta Option 3G y me iba de maravilla, así que tenía ganas de que me llegara el nuevo juguete y la tan cacareada tecnología HSDPA. Sólo puedo decir una cosa: es una delicia. Tras este momento “la vida puede ser maravillosa”, vamos al lío, qué hay que hacer para que funcione:

  1. Hacer que funcione el puerto PCMCIA (básico)
  2. Conseguir que la tarjeta sea detectada como varios puertos serie-USB
  3. Instalar PPP
  4. Instalar y configurar wvdial

Sigue leyendo para ver los detalles…

I’ve been using an option GPRS card for a while (without any problems) so I was very eager to try the new HSDPA cards in my linux laptop. It works like a charm (I’m so happy :))
Well, now the facts, what you need to make the card work?

  1. A working PCMCIA port
  2. To have the card detected as 3 USB Serial ports
  3. PPP Drivers
  4. Wvdial installed and configured



Supongo que la mayoría de vosotros ya tendréis el puerto PCMCIA funcionando, si no, hay cientos de tutoriales ahí fuera.
Lo primero que debemos conseguir es que cuando insertemos la tarjeta, ésta sea detectada como un conjunto de puertos serie por el subsistema USB. ¡Pero de qué habla este tío! Si mi tarjeta es PCMCIA, ¿qué dice este de puerto serie y USB? Sí amiguitos, sí. Cuando insertéis vuestra tarjeta PCMCIA en la ranura PCMCIA, deberéis ver varios mensajes en el syslog como estos:

Jan 11 19:47:47 acsev-109 pccard: CardBus card inserted into slot 0
Jan 11 19:47:47 acsev-109 ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI)
Jan 11 19:47:47 acsev-109 ohci_hcd: block sizes: ed 64 td 64
Jan 11 19:47:47 acsev-109 PCI: Enabling device 0000:06:00.0 (0000 -> 0002)
Jan 11 19:47:47 acsev-109 ACPI: PCI Interrupt 0000:06:00.0[A] -> GSI 18 (level, low) -> IRQ 16
Jan 11 19:47:47 acsev-109 PCI: Setting latency timer of device 0000:06:00.0 to 64
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: OHCI Host Controller
Jan 11 19:47:47 acsev-109 drivers/usb/core/inode.c: creating file '006'
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: new USB bus registered, assigned bus number 6
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: created debug files
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: irq 16, io mem 0x52000000
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: resetting from state 'reset', control = 0x0
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: OHCI controller state
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: OHCI 1.0, NO legacy support registers
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: control 0x083 HCFS=operational CBSR=3
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: cmdstatus 0x00000 SOC=0
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: intrstatus 0x00000004 SF
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: intrenable 0x8000005a MIE RHSC UE RD WDH
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: hcca frame #001f
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: roothub.a 0f000201 POTPGT=15 NPS NDP=1(1)
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: roothub.b 00000000 PPCM=0000 DR=0000
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: roothub.status 00008000 DRWE
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.0: roothub.portstatus [0] 0x00000100 PPS
Jan 11 19:47:47 acsev-109 usb usb6: default language 0x0409
Jan 11 19:47:47 acsev-109 usb usb6: new device strings: Mfr=3, Product=2, SerialNumber=1
Jan 11 19:47:47 acsev-109 usb usb6: Product: OHCI Host Controller
Jan 11 19:47:47 acsev-109 usb usb6: Manufacturer: Linux 2.6.19-gentoo-r2 ohci_hcd
Jan 11 19:47:47 acsev-109 usb usb6: SerialNumber: 0000:06:00.0
Jan 11 19:47:47 acsev-109 usb usb6: uevent
Jan 11 19:47:47 acsev-109 usb usb6: usb_probe_device
Jan 11 19:47:47 acsev-109 usb usb6: configuration #1 chosen from 1 choice
Jan 11 19:47:47 acsev-109 usb usb6: adding 6-0:1.0 (config #1, interface 0)
Jan 11 19:47:47 acsev-109 usb 6-0:1.0: uevent
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: usb_probe_interface
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: usb_probe_interface - got id
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: USB hub found
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: 1 port detected
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: standalone hub
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: no power switching (usb 1.0)
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: global over-current protection
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: power on to power good time: 30ms
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: local power source is good
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: no over-current condition exists
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: trying to enable port power on non-switchable hub
Jan 11 19:47:47 acsev-109 hub 6-0:1.0: state 7 ports 1 chg 0000 evt 0000
Jan 11 19:47:47 acsev-109 drivers/usb/core/inode.c: creating file '001'
Jan 11 19:47:47 acsev-109 PCI: Enabling device 0000:06:00.1 (0000 -> 0002)
Jan 11 19:47:47 acsev-109 ACPI: PCI Interrupt 0000:06:00.1[B] -> GSI 18 (level, low) -> IRQ 16
Jan 11 19:47:47 acsev-109 PCI: Setting latency timer of device 0000:06:00.1 to 64
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: OHCI Host Controller
Jan 11 19:47:47 acsev-109 drivers/usb/core/inode.c: creating file '007'
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: new USB bus registered, assigned bus number 7
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: created debug files
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: irq 16, io mem 0x52001000
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: resetting from state 'reset', control = 0x0
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: OHCI controller state
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: OHCI 1.0, NO legacy support registers
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: control 0x083 HCFS=operational CBSR=3
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: cmdstatus 0x00000 SOC=0
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: intrstatus 0x00000004 SF
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: intrenable 0x8000005a MIE RHSC UE RD WDH
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: hcca frame #001f
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: roothub.a 0f000201 POTPGT=15 NPS NDP=1(1)
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: roothub.b 00000000 PPCM=0000 DR=0000
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: roothub.status 00008000 DRWE
Jan 11 19:47:47 acsev-109 ohci_hcd 0000:06:00.1: roothub.portstatus [0] 0x00000100 PPS
Jan 11 19:47:47 acsev-109 usb usb7: default language 0x0409
Jan 11 19:47:47 acsev-109 usb usb7: new device strings: Mfr=3, Product=2, SerialNumber=1
Jan 11 19:47:47 acsev-109 usb usb7: Product: OHCI Host Controller
Jan 11 19:47:47 acsev-109 usb usb7: Manufacturer: Linux 2.6.19-gentoo-r2 ohci_hcd
Jan 11 19:47:47 acsev-109 usb usb7: SerialNumber: 0000:06:00.1
Jan 11 19:47:47 acsev-109 usb usb7: uevent
Jan 11 19:47:47 acsev-109 usb usb7: usb_probe_device
Jan 11 19:47:47 acsev-109 usb usb7: configuration #1 chosen from 1 choice
Jan 11 19:47:47 acsev-109 usb usb7: adding 7-0:1.0 (config #1, interface 0)
Jan 11 19:47:47 acsev-109 usb 7-0:1.0: uevent
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: usb_probe_interface
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: usb_probe_interface - got id
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: USB hub found
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: 1 port detected
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: standalone hub
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: no power switching (usb 1.0)
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: global over-current protection
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: power on to power good time: 30ms
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: local power source is good
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: no over-current condition exists
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: trying to enable port power on non-switchable hub
Jan 11 19:47:47 acsev-109 hub 7-0:1.0: state 7 ports 1 chg 0000 evt 0000
Jan 11 19:47:47 acsev-109 drivers/usb/core/inode.c: creating file '001'
Jan 11 19:47:48 acsev-109 ohci_hcd 0000:06:00.0: auto-stop root hub
Jan 11 19:47:48 acsev-109 ohci_hcd 0000:06:00.1: auto-stop root hub
Jan 11 19:47:49 acsev-109 ohci_hcd 0000:06:00.0: auto-wakeup
Jan 11 19:47:49 acsev-109 hub 6-0:1.0: state 7 ports 1 chg 0000 evt 0002
Jan 11 19:47:49 acsev-109 ohci_hcd 0000:06:00.0: GetStatus roothub.portstatus [0] = 0x00010101 CSC PPS CCS
Jan 11 19:47:49 acsev-109 hub 6-0:1.0: port 1, status 0101, change 0001, 12 Mb/s
Jan 11 19:47:49 acsev-109 hub 6-0:1.0: debounce: port 1: total 100ms stable 100ms status 0x101
Jan 11 19:47:50 acsev-109 ohci_hcd 0000:06:00.0: GetStatus roothub.portstatus [0] = 0x00100103 PRSC PPS PES CCS
Jan 11 19:47:50 acsev-109 usb 6-1: new full speed USB device using ohci_hcd and address 2
Jan 11 19:47:50 acsev-109 ohci_hcd 0000:06:00.0: GetStatus roothub.portstatus [0] = 0x00100103 PRSC PPS PES CCS
Jan 11 19:47:50 acsev-109 usb 6-1: default language 0x0409
Jan 11 19:47:50 acsev-109 usb 6-1: new device strings: Mfr=1, Product=2, SerialNumber=4
Jan 11 16:47:50 acsev-109 usb 6-1: Product: HUAWEI Mobile
Jan 11 19:47:50 acsev-109 usb 6-1: Manufacturer: HUAWEI Technologies
Jan 11 19:47:50 acsev-109 usb 6-1: SerialNumber: HUAWEI DEVICE
Jan 11 19:47:50 acsev-109 usb 6-1: uevent
Jan 11 19:47:50 acsev-109 usb 6-1: usb_probe_device
Jan 11 19:47:50 acsev-109 usb 6-1: configuration #1 chosen from 1 choice
Jan 11 19:47:50 acsev-109 usb 6-1: adding 6-1:1.0 (config #1, interface 0)
Jan 11 19:47:50 acsev-109 usb 6-1:1.0: uevent
Jan 11 19:47:50 acsev-109 usb 6-1: adding 6-1:1.1 (config #1, interface 1)
Jan 11 19:47:50 acsev-109 usb 6-1:1.1: uevent
Jan 11 19:47:50 acsev-109 usb 6-1: adding 6-1:1.2 (config #1, interface 2)
Jan 11 19:47:50 acsev-109 usb 6-1:1.2: uevent
Jan 11 19:47:50 acsev-109 drivers/usb/core/inode.c: creating file '002'
Jan 11 19:47:50 acsev-109 hub 6-0:1.0: state 7 ports 1 chg 0000 evt 0002
Jan 11 19:47:50 acsev-109 usbcore: registered new interface driver usbserial
Jan 11 19:47:50 acsev-109 drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
Jan 11 19:47:50 acsev-109 usbserial_generic 6-1:1.0: usb_probe_interface
Jan 11 19:47:50 acsev-109 usbserial_generic 6-1:1.0: usb_probe_interface - got id
Jan 11 19:47:50 acsev-109 usbserial_generic 6-1:1.1: usb_probe_interface
Jan 11 19:47:50 acsev-109 usbserial_generic 6-1:1.1: usb_probe_interface - got id
Jan 11 19:47:50 acsev-109 usbserial_generic 6-1:1.2: usb_probe_interface
Jan 11 19:47:50 acsev-109 usbserial_generic 6-1:1.2: usb_probe_interface - got id
Jan 11 19:47:50 acsev-109 usbcore: registered new interface driver usbserial_generic
Jan 11 19:47:50 acsev-109 drivers/usb/serial/usb-serial.c: USB Serial Driver core
Jan 11 19:47:50 acsev-109 drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.0: usb_probe_interface
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.0: usb_probe_interface - got id
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.0: pl2303 converter detected
Jan 11 19:47:50 acsev-109 usb 6-1: pl2303 converter now attached to ttyUSB0
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.1: usb_probe_interface
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.1: usb_probe_interface - got id
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.1: pl2303 converter detected
Jan 11 19:47:50 acsev-109 usb 6-1: pl2303 converter now attached to ttyUSB1
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.2: usb_probe_interface
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.2: usb_probe_interface - got id
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.2: pl2303 converter detected
Jan 11 19:47:50 acsev-109 usb 6-1: pl2303 converter now attached to ttyUSB2
Jan 11 19:47:50 acsev-109 usbcore: registered new interface driver pl2303
Jan 11 19:47:50 acsev-109 drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver
Jan 11 19:47:50 acsev-109 drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port)
Jan 11 19:47:50 acsev-109 usbcore: registered new interface driver option
Jan 11 19:47:50 acsev-109 drivers/usb/serial/option.c: USB Driver for GSM modems: v0.7.1

Os he puesto en negrita la parte importante. Para ello debéis cargar el módulo usbserial.
modprobe usbserial
Si no lo tenéis disponible, es un buen momento para recompilar vuestro kernel.

Seguro que alguno os habéis dado cuenta que el propio subsistema USB detecta correctamente la tarjeta, si el vuestro no la reconoce update-usbids es vuestro amigo.

Una vez que tengamos detectada la tarjeta como puertos ttyUSB, todo es muy fácil.

Instalamos el módulo PPP.
modprobe ppp

Instalamos wvdial. Esto va a gusto del consumidor, desde el minuto que tardaréis en hacer apt-get install wvdial en Debian hasta el tiempo de hacer un café en mi Gentoo con emerge -uaD wvdial. En cualquier caso el proceso será bastante automático.

El segundo paso tendría algo más de miga si no fuese por que yo os lo voy a poner aquí, con lo que pierde gran parte de la dificultad ;)
Necesitamos editar el fichero /etc/wvdial.conf y hacer que tenga los siguientes contenidos:

[Dialer Defaults]

Phone = *99***1#
Username = username
Password = password
Stupid Mode = 1
Dial Command = ATDT

[Dialer pin]

Init1 = AT+CPIN=XXXX
# Debes cambiar las XXXX por tu PIN
[Dialer option]

Modem = /dev/ttyUSB0
Baud = 460800
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem

[Dialer internet]

Init5 = AT+CGDCONT=1,"IP","ac.vodafone.es";

Este fichero está basado en los de Tazz Tux en el foro de mybroadband.co.za.

Por último, sólo falta ejecutar el wvdial.
wvdial option internet.

Se me olvidaba lo más importante, en teoría en el fichero hay un apartado para poner el pin que se ejecutaría con wvdial pin option internet. Yo no he conseguido que eso funcione de ningún modo así que simplemente, he deshabilitado en la SIM que tenga que pedir el PIN al inicio.

Saludos a los que lleguen hasta aquí :P


I’ll assume you have the pcmcia subsystem up and working (else google is your friend).

Secondly, you need the usbserial module. If you don’t have it available, you’ll need a kernel recompilation, else just load it with modprobe usbserial. Once loaded, when you plug the card on the PCMCIA slot, you’ll see a bunch of messages in your syslog, look for these three:


[...]
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.0: pl2303 converter detected
Jan 11 19:47:50 acsev-109 usb 6-1: pl2303 converter now attached to ttyUSB0
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.1: usb_probe_interface
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.1: usb_probe_interface - got id
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.1: pl2303 converter detected
Jan 11 19:47:50 acsev-109 usb 6-1: pl2303 converter now attached to ttyUSB1
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.2: usb_probe_interface
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.2: usb_probe_interface - got id
Jan 11 19:47:50 acsev-109 pl2303 6-1:1.2: pl2303 converter detected
Jan 11 19:47:50 acsev-109 usb 6-1: pl2303 converter now attached to ttyUSB2
Jan 11 19:47:50 acsev-109 usbcore: registered new interface driver pl2303
Jan 11 19:47:50 acsev-109 drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver
Jan 11 19:47:50 acsev-109 drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port)
Jan 11 19:47:50 acsev-109 usbcore: registered new interface driver option
Jan 11 19:47:50 acsev-109 drivers/usb/serial/option.c: USB Driver for GSM modems: v0.7.1

If you can’t see those three messages, it just won’t work (again, google is your friend)

Install PPP: modprobe ppp.

Install and configure wvdial. Install it your preferred way (apt-get it, install from source, use emerge or rpm or whatever), then edit the file /etc/wvdial.conf. These are the settings needed for Vodafone users in Spain. People from other countries should try Tazz Tux’ files on mybroadband.co.za forums.


[Dialer Defaults]

Phone = *99***1#
Username = username
Password = password
Stupid Mode = 1
Dial Command = ATDT

[Dialer pin]

Init1 = AT+CPIN=XXXX
# You should change the XXXX for your PIN code
[Dialer option]

Modem = /dev/ttyUSB0
Baud = 460800
Init2 = ATZ
Init3 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ISDN = 0
Modem Type = Analog Modem

[Dialer internet]

Init5 = AT+CGDCONT=1,"IP","ac.vodafone.es";

Although there’s a PIN section in the code, I have never been able to use any of my cards with PIN code enabled so I’ll just disable it (I’ve put the SIM card in my phone and told it not to ask for PIN anymore). Then just exec wvdial: wvdial option internet. Enjoy!

Feedback is welcome ;)

Be Sociable, Share!

Categorised as: Tutoriales


5 Comments

  1. Eduard dice:

    First of all, thanks for the info. Nevertheless let me say i have not been able to connect my pcmcia card. I have done what you’ve said and i got the following output:

    wvdial option internet
    –> WvDial: Internet dialer version 1.56
    –> Cannot get information for serial port.
    –> Initializing modem.
    –> Sending: ATZ
    ATZ
    OK
    –> Sending: ATZ
    ATZ
    OK
    –> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    ERROR
    –> Bad init string.
    –> Cannot get information for serial port.
    –> Initializing modem.
    –> Sending: ATZ
    ATZ
    OK
    –> Sending: ATZ
    ATZ
    OK
    –> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    ERROR
    –> Bad init string.
    –> Cannot get information for serial port.
    –> Initializing modem.
    –> Sending: ATZ
    ATZ
    OK
    –> Sending: ATZ
    ATZ
    OK
    –> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
    ERROR
    –> Bad init string.
    eduard@edgy:~$

    Do you have any idea to help me?

  2. manu dice:

    Did you remember to tell the SIM card not to ask for the PIN code?

  3. Eduard dice:

    Actually i typed the order “wvdial option internet”, which asks for no pin. Anyhow i also tried the order “wvdial pin option internet” with negative results too, but this time the message concerns the modem, which it says is not detected.

  4. manu dice:

    Is not in the code where you shouln’t ask for the PIN code, is the SIM card the one that has to be instructed not to ask code. The easiest way to do this inserting the SIM in your own mobile phone and (ussually under securitty settings) you’ll find a menu entry to change if you want your phone (actually is a parameter for the SIM card) to ask your PIN number at init. Set it at no and accept. Place the SIM in the PCMCIA card and try again.

  5. Anónimo dice:

    super!!!! very very gut!!!!! Bravo!!
    Fantastico :)

    Tomek.K
    U mnie to dziala :) to dla Polaków ;)