How to setup GPRS under Linux, with a Sony Ericsson for example?


This howto describes how to setup a GPRS connection under Linux. I did it with a Sony Ericsson phone, as well as with a Motorola C350 (see end of page to see what changes with a Motorola).

Modules needed:
You need the usb serial core driver: usb_serial.
With the SonyEricsson cradle (usb id 0403:fc82), you also need the ftdi_sio module;
With The DCU-10 and DCU-11 (usb id 0731:0528) cables, you need the pl2303 module.
Check the phone's connection is working:
When plugging it in, a char device should be created, like /dev/ttyUSB0, /dev/usb/ttyUSB0 or /dev/tts/USB0 (this depends on your distribution, devfs, udev, etc). Check your logs to find out which device is created (/var/log/syslog or /var/log/messages).
Start pppd to connect to the internet:
Then you can use the following pppd command to start the link (all on the same line):
/usr/sbin/pppd connect '/usr/sbin/chat -v ABORT "NO CARRIER" "" "AT&F" OK "AT+CGDCONT=1,\"IP\",\"websfr\",\"\",0,0" OK "ATDT*99#" CONNECT' disconnect '/usr/sbin/chat -v ABORT "BUSY" "" "\K" "" "+++ATH"' /dev/tts/USB0 defaultroute noauth asyncmap 0 mtu 1500 mru 1500 noipdefault idle 600

Don't forget to adapt "websfr" to your provider and /dev/tts/USB0 to your character device.

You can also use your distribution's setup to put all this configuration in a bunch of files in /etc/ppp/ if you prefer. I don't like that way.
Changing settings according to the phone's configuration:
If this doesn't work, you need to know what profile is to be used. For this, open two consoles; in one of them, type
cat /dev/ttyUSB0 #(or whatever your device is)
and let it wait. On the other one, type
echo "AT+CGDCONT?" > /dev/ttyUSB0
See what it outputs in the first console, and modify accordingly the pppd command (the AT+CGDCONT= part).
Hanging up:
To stop the link, just type
killall pppd.
Other phones:
This also worked with a Motorola C350, with the little differences below: the motorola cable is not an USB/serial cable, rather the interface is just USB. Hence you only need the cdc-acm module; the char device this module creates is /dev/ttyACM0, /dev/usb/acm/0, or equivalent. Same for the Sony Ericsson v600i with the USB cable (plugged on the side) instead of the DCU* cable (plugged at the bottom).

Colin Leroy - this article is under the Free documentation licence.