Saturday, October 16, 2010

Using AnyData ADU-510A under Linux (Ubuntu 10.04)

Using AnyData ADU-510A CDMA modem under Linux is a bit of a challenge because the device will appear like a virtual CD-ROM instead of a modem. You will need to "switch" the device (meaning turning it from being a CD-ROM to a modem), and then connect through PPP to your provider's network.

Here are detailed steps on how to accomplish this on Ubuntu 10.04, using the modem associated with Romtelecom Clicknet Mobile service. It should work the same for other providers.

1. Download Saki's3g - a script that automatically switches your device from a CD-ROM state to a modem. You can get the latest version from http://www.sakis3g.org/ (great work, Saki!)
Even if the site says it doesn't support CDMA networks, it can still be used to switch our modem using the embedded usb_modeswitch.

Download the full version for your architecture and gunzip it somewhere in your home directory (~/bin for example). Also, give execute permissions to the script:
adrianp@stingray:~/bin$ gunzip sakis3g.gz
adrianp@stingray:~/bin$ chmod a+x sakis3g
adrianp@stingray:~/bin$ ls -l sakis3g
-r-x--x--x 1 adrianp adrianp 214619 2010-09-30 18:23 sakis3g

2. Plug in your modem
If you do a lsusb, you should see the following:
adrianp@stingray:~$ lsusb | grep Qual
Bus 006 Device 002: ID 05c6:1000 Qualcomm, Inc.

This means that the device is registered as a generic device, or maybe as a CD-ROM (it doesn't register as a CD-ROM for me, though).

3. Switch your device with sakis3g
3a. Start sakis3g as a regular user
adrianp@stingray:~/bin$ ./sakis3g 


3b. From the GUI menu select "Connect with 3G"
The process will switch your modem and try to connect to a GSM network. It will fail, but these errors are not critical in our process.








When the program finishes, click cancel to close the program.
If you do a lsusb now, you should see the following:
adrianp@stingray:~$ lsusb | grep Any
Bus 006 Device 003: ID 16d5:6502 AnyDATA Corporation

The device is on the same bus, but it has changed its signature. Also if you do a dmesg, you will get information about new serial ports that are recognized by the system:
[ 3873.613206] sr 7:0:0:0: [sr1] Media Changed
[ 3873.613215] sr 7:0:0:0: [sr1] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
[ 3873.613225] sr 7:0:0:0: [sr1] Sense Key : Unit Attention [current]
[ 3873.613235] sr 7:0:0:0: [sr1] Add. Sense: No additional sense information
[ 3873.613247] sr 7:0:0:0: [sr1] CDB: Read(10): 28 00 00 00 59 f0 00 00 08 00
[ 3873.613272] end_request: I/O error, dev sr1, sector 23024
[ 3873.613283] Buffer I/O error on device sr1, logical block 11512
[ 3873.613291] Buffer I/O error on device sr1, logical block 11513
[ 3873.613298] Buffer I/O error on device sr1, logical block 11514
[ 3873.613304] Buffer I/O error on device sr1, logical block 11515
[ 3873.613673] isofs_fill_super: bread failed, dev=sr1, iso_blknum=16, block=32
[ 3873.651211] sr1: CDROM (ioctl) error, command: Get configuration 46 00 00 00 00 00 00 00 20 00
[ 3873.651240] sr: Sense Key : Hardware Error [current]
[ 3873.651250] sr: Add. Sense: No additional sense information
[ 3873.669146] option: option_instat_callback: error -108
[ 3873.669401] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 3873.669451] option 6-2:1.0: device disconnected
[ 3873.670499] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 3873.670533] option 6-2:1.1: device disconnected
[ 3873.671481] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 3873.671514] option 6-2:1.2: device disconnected
[ 3873.784545] usb 6-2: reset full speed USB device using uhci_hcd and address 3
[ 3873.930278] option 6-2:1.2: GSM modem (1-port) converter detected
[ 3873.930487] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB0
[ 3873.930549] option 6-2:1.1: GSM modem (1-port) converter detected
[ 3873.930680] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB1
[ 3873.930736] option 6-2:1.0: GSM modem (1-port) converter detected
[ 3873.930873] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB2
[ 3873.946147] option: option_instat_callback: error -108
[ 3873.946409] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 3873.946457] option 6-2:1.0: device disconnected
[ 3873.946619] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 3873.946660] option 6-2:1.1: device disconnected
[ 3873.946808] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 3873.946848] option 6-2:1.2: device disconnected
[ 3874.064071] usb 6-2: reset full speed USB device using uhci_hcd and address 3
[ 3874.210264] option 6-2:1.2: GSM modem (1-port) converter detected
[ 3874.210469] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB0
[ 3874.210529] option 6-2:1.1: GSM modem (1-port) converter detected
[ 3874.210661] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB1
[ 3874.210717] option 6-2:1.0: GSM modem (1-port) converter detected
[ 3874.210851] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB2
[ 3874.222146] option: option_instat_callback: error -108
[ 3874.222408] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 3874.222457] option 6-2:1.0: device disconnected
[ 3874.222622] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 3874.222665] option 6-2:1.1: device disconnected
[ 3874.222817] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 3874.222857] option 6-2:1.2: device disconnected
[ 3874.340072] usb 6-2: reset full speed USB device using uhci_hcd and address 3
[ 3874.486264] option 6-2:1.2: GSM modem (1-port) converter detected
[ 3874.486473] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB0
[ 3874.486533] option 6-2:1.1: GSM modem (1-port) converter detected
[ 3874.486665] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB1
[ 3874.486720] option 6-2:1.0: GSM modem (1-port) converter detected
[ 3874.486853] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB2
[ 3874.498145] option: option_instat_callback: error -108
[ 3874.498406] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 3874.498455] option 6-2:1.0: device disconnected
[ 3874.498621] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 3874.498661] option 6-2:1.1: device disconnected
[ 3874.498812] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 3874.498852] option 6-2:1.2: device disconnected
[ 3874.616074] usb 6-2: reset full speed USB device using uhci_hcd and address 3
[ 3874.763247] option 6-2:1.2: GSM modem (1-port) converter detected
[ 3874.763456] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB0
[ 3874.763517] option 6-2:1.1: GSM modem (1-port) converter detected
[ 3874.763653] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB1
[ 3874.763712] option 6-2:1.0: GSM modem (1-port) converter detected
[ 3874.763853] usb 6-2: GSM modem (1-port) converter now attached to ttyUSB2
[ 3874.797988] sr1: CDROM (ioctl) error, command: Xpwrite, Read disk info 51 00 00 00 00 00 00 00 02 00
[ 3874.798019] sr: Sense Key : Hardware Error [current]
[ 3874.798028] sr: Add. Sense: No additional sense information
[ 3874.855226] sr1: CDROM (ioctl) error, command: Get configuration 46 00 00 00 00 00 00 00 20 00
[ 3874.855255] sr: Sense Key : Hardware Error [current]
[ 3874.855265] sr: Add. Sense: No additional sense information
[ 3875.024201] sr1: CDROM (ioctl) error, command: Get configuration 46 00 00 00 00 00 00 00 20 00
[ 3875.024231] sr: Sense Key : Hardware Error [current]
[ 3875.024241] sr: Add. Sense: No additional sense information
[ 3875.198205] sr1: CDROM (ioctl) error, command: Get configuration 46 00 00 00 00 00 00 00 20 00
[ 3875.198236] sr: Sense Key : Hardware Error [current]
[ 3875.198246] sr: Add. Sense: No additional sense information
[ 3875.357209] sr1: CDROM (ioctl) error, command: Get configuration 46 00 00 00 00 00 00 00 20 00
[ 3875.357241] sr: Sense Key : Hardware Error [current]
[ 3875.357251] sr: Add. Sense: No additional sense information
[ 3875.552201] sr1: CDROM (ioctl) error, command: Get configuration 46 00 00 00 00 00 00 00 20 00
[ 3875.552232] sr: Sense Key : Hardware Error [current]
[ 3875.552242] sr: Add. Sense: No additional sense information

The output also shows that the system recognized the virtual CD-ROM (but it may still be unaccesible - it's not needed anyway). In the end, you will get three new files in /dev:
adrianp@stingray:~$ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 2010-10-16 09:37 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 2010-10-16 09:37 /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 2 2010-10-16 09:37 /dev/ttyUSB2

4. Using gnome-ppp to connect to the Internet
Make sure you have gnome-ppp installed (sudo apt-get install gnome-ppp), or you can use a ppp program of your choice. This step has to be performed as root, since performing it as a regular user has generated PPP authentication problems that I didn't bother to debug.

4a. Configure gnome-ppp (it's done only once, since it can remember the settings):

  • Enter your username/password/number that were provided by your ISP.

  • Click Setup and click "Detect". It should register /dev/ttyUSB2 as a valid modem interface

  • Click "Init Strings" and set the following as Init 2:
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

  • Tweak other parameters if you fell you need to, but there should be no need.
  • Click close and return to the main window of gnome-ppp

4b. Turn on the PPP connection by clicking Connect
Make sure that you have other network interfaces turned off (e.g. Wlan, ethernet) because the PPP dialer might conflict with NetworkManager when setting DNS or default routes.

The modem should connect right away. If you get an error 'NO CARRIER', then check that the modem works fine under Windows - I got the error and had to replace the modem because it was faulty.


root@stingray:/home/adrianp/bin# gnome-ppp
WVCONF: /root/.wvdial.conf
GNOME PPP: Connecting...
GNOME PPP: STDERR: --> WvDial: Internet dialer version 1.60
GNOME PPP: STDERR: --> Cannot get information for serial port.
GNOME PPP: STDERR: --> Initializing modem.
GNOME PPP: STDERR: --> Sending: ATZ
GNOME PPP: STDERR: OK
GNOME PPP: STDERR: --> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
GNOME PPP: STDERR: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
GNOME PPP: STDERR: OK
GNOME PPP: STDERR: --> Modem initialized.
GNOME PPP: STDERR: --> Sending: ATM1L3DT#777
GNOME PPP: STDERR: --> Waiting for carrier.
GNOME PPP: STDERR: ATM1L3DT#777
GNOME PPP: STDERR: CONNECT
GNOME PPP: STDERR: --> Carrier detected.  Waiting for prompt.
GNOME PPP: STDERR: ~[7f]}#@!}!}!} }9}"}&} } } } }#}%B#}%}%}&} },}6m}'}"}(}"Li~
GNOME PPP: STDERR: --> PPP negotiation detected.
GNOME PPP: STDERR: --> Starting pppd at Sat Oct 16 09:53:37 2010
GNOME PPP: STDERR: --> Pid of pppd: 16764
GNOME PPP: STDERR: --> Using interface ppp0
GNOME PPP: STDERR: --> local  IP address 92.86.95.69
GNOME PPP: STDERR: --> remote IP address 192.168.50.12
GNOME PPP: STDERR: --> primary   DNS address 193.231.100.120
GNOME PPP: STDERR: --> secondary DNS address 193.231.100.124


If you get errors during the switching procedure or during connecting through PPP, they might be caused by the device - reseat the device in a different USB port and make sure both leds (red/green) are lit before proceeding.

5. Use the Internet/profit - you should get the same performance as you would while running Windows.



Known issues:

  • You will need to do steps 2-5 (skip 4a) each time you plug in your modem
  • If your laptop goes to sleep mode, you might need to unplug and replug the modem before it works again
  • If you disconnect and try to connect immediately, you will get errors saying that the device is busy. Just wait for ~10 seconds before reconnecting

Good luck and happy surfing!