SFR Huawei 3G+ USB key with Debian

After Orange GPRS with Nokia 6630 and SFR GPRS with Nokia E65, I use now mainly Huawei 3G+ USB key with SFR (french mobile phone provider).

lsusb info about this Huawei 3G+ USB key:

Bus 003 Device 003: ID 12d1:1003 Huawei Technologies Co., Ltd. E220 HSDPA Modem / E270 HSDPA/HSUPA Modem

And dmesg info:

[208765.818448] option 3-1:1.0: GSM modem (1-port) converter detected
[208765.818448] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB3
[208765.830451] usb-storage: probe of 3-1:1.1 failed with error -5
[208765.830451] option 3-1:1.1: GSM modem (1-port) converter detected
[208765.830451] usb 3-1: GSM modem (1-port) converter now attached to ttyUSB4
[208765.830502] scsi12 : SCSI emulation for USB Mass Storage devices
[208765.834458] usb 3-1: New USB device found, idVendor=12d1, idProduct=1003
[208765.834458] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[208765.834458] usb 3-1: Product: HUAWEI Mobile
[208765.834458] usb 3-1: Manufacturer: HUAWEI Technologies
[208765.834458] usb-storage: device found at 3
[208765.834458] usb-storage: waiting for device to settle before scanning
[208770.863868] usb-storage: device scan complete
[208770.866850] scsi 12:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[208770.887881] sr0: scsi-1 drive
[208770.887881] sr 12:0:0:0: Attached scsi CD-ROM sr0
[208770.887881] sr 12:0:0:0: Attached scsi generic sg1 type 5

For connecting, I tried an infamous GUI distributed by Vodafone in Debian package. Too buggy, too complex. The best solution is using a PPP chatscript.

Then, plug USB key, sleep 20 and unlock it:

echo 'at+cpin="1234"' > /dev/ttyUSB3

Note: 1234 is PIN code (or not) and /dev/ttyUSB3 is modem device.

Create these 2 files:

/etc/ppp/peers/gprs:

noauth
debug
nodetach
connect "/usr/sbin/chat -v -f /etc/ppp/peers/huawei-e220.chat"
/dev/ttyUSB3
230400
crtscts
defaultroute
noipdefault
user ignored
remotename whatever
ipparam whatever
usepeerdns

/etc/ppp/peers/huawei-e220.chat:

# Chat file for Huawei E220 HSDPA USB modem
ABORT BUSY ABORT 'NO CARRIER' ABORT 'NO ANSWER' ABORT DELAYED
'' AT
OK ATZ
OK 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
OK 'AT+CGDCONT=1,"IP","websfr"'
OK ATDT*99***1#
CONNECT ""

Finally you can:

pppd call gprs

Tags: , , ,

7 Responses to “SFR Huawei 3G+ USB key with Debian”

  1. Josip Rodin says:

    You probably don’t need the manual PIN entry, you can put it in the chat script. The cards usually don’t like it being entered more than once per session, but that can also be resolved from the chat script. And then this is not an old style modem, it usually doesn’t care for the old init string, but usually it does provide the option to see the link status with a few extra AT commands. Something like this:


    OK AT+CPIN?
    READY-AT+CPIN=1234-OK \d\c
    “” AT+COPS?
    OK AT+CSQ

  2. Benjamin Seidenberg says:

    If the device DOES complain about multiple PIN entries if you do it Josip’s way, you can always put the PIN entry in the udev script.

  3. Mike says:

    Any particular reason why you are using a chatscript rather than wvdial? Seems like a lot of work!

  4. Gregory Colpart says:

    Josip> Thanks. After some tests, I verify that my modem doesn’t care about multiple PIN code per session. Then I can put this first line on my chatscript:

    "" 'AT+CPIN="1234"'

    But after my tests, I discover a new problem. chatscript fails when key doesn’t detect the right mode (EDGE, 3G or 3G+). Now I’m searching how to detect the right mode before connection.

  5. Mike> A lot of bad^Wgood reasons :
    – not installing wvdial
    – I want to play with chatscript and AT commands
    – it works

  6. Gregory Colpart says:

    Yeah, I find magic AT comands for my modem on Huawei forum:
    GPRSONLY: AT^SYSCFG=13,1,3FFFFFFF,2,4
    3GONLY: AT^SYSCFG=14,2,3FFFFFFF,2,4
    GPRSPREF : AT^SYSCFG=2,1,3FFFFFFF,2,4
    3GPREF: AT^SYSCFG=2,2,3FFFFFFF,2,4

    Then my final chatscript looks like :

    "" 'AT+CPIN="1234"'
    "" AT^SYSCFG=2,2,3FFFFFFF,2,4
    "" \d\d\d\d\d\c
    ABORT BUSY ABORT 'NO CARRIER' ABORT 'NO ANSWER' ABORT DELAYED
    '' AT
    OK ATZ
    OK 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
    OK 'AT+CGDCONT=1,"IP","websfr"'
    OK ATDT*99***1#
    CONNECT "
  7. pirx says:

    Hey, anybody knows how can I retive a very fundamental info like Cell Id and LAC from Huawei E1820?

    I tried to use +cgreg, +cereg and +creg, no cid/lac in response;(