[Latest Update: SUCCESS! I have been able to run usb_modeswitch and get my modem recognised. Read it catalogued here, but read the current post first.]
There is a certain sense of accomplishment that software freedom enthusiasts like us gain by doing things by hand, and making them simpler. Of course, the lay Mac-Win slave would usually find the simpler way to be complicated, but that doesn’t stop us intrepid explorers from continuing on our quest of the golden fleece.
On this note, I too have been dreaming of freeing myself from the shackles and inconveniences of the 3G wifi router and using 3G / EVDO USB datamodems on the Adam directly. I was under the impression that as Android is a derivative of Linux and as Linux is able to run such modems very well, getting them to work on the Adam would be as simple as plugging them in and configuring a dialer. Such naïveté.
The USB datamodems running on 3G / EVDO networks are mode switching devices, which carry their drivers on board. When plugged into a Windows device, they are initially registered as SCSI cd-rom (ZeroCD, the name coined by a company called Option) drives, and the operating system installs the drivers stored onboard automatically. It then switches the device to a different, usually modem mode. On Windows. Naturally, none of this was possible on Linux for lack of vendor support.
However, an intrepid enthusiast named Josua Dietze decided to change this, and came up with a really nifty utility called usb_modeswitch, using intellect, Linux tools and some help from friends. What this utility does is similar to what Windows does with the datamodem. In regular Linux, the utility and its supporting data package make the whole process very hassle-free, and simple but powerful applications like Gnome’s Network Manager obviate the need for a separate dialer. On Linux.
On Android, quite sadly, some of the libraries that usb_modeswitch depends on were unavailable – for example, tcl and libusb. This made my earlier assumption that compiling the package for Android would be trivial to be very premature. Another problem that Android, and specifically Adam faced was the ARM architecture. The main package and the supporting usb-modeswitch-data package are available as source tarballs that are supposed to be installed with a
make install – another impossibility for a lay Android user. Once correctly installed, usb_modeswitch takes care of switching your modem from the ZeroCD mode, and parameters collected in a database through individual efforts make activating the modem simple.
Thankfully, Josua Dietze has now compiled a static binary of usb_modeswitch for ARM, along with alternative static binaries using a smaller tcl implementation, jimsh. There is some help about utilisation of these packages available on the site home page, and if you have a Linux computer, under man pages (which are sadly unavailable for Android).
All that you are supposed to do with the static binary is invoke it with specific command line parameters once you plug in your modem, and then dial it. Easier said then done.
For one, this is not possible directly for Android, due to the plethora of restrictions. To add to it, Android seems to miss many other bits and pieces, especially due to fragmentation, that would be standard for real Linux.
So how do you actually use usb_modeswitch on Android? First, read the instructions on the home page carefully, and then re-read them. Then move over to the forums, and search for Android-specific keywords. You will immediately be presented with a history of illustrious forebears. I recommend one thread of interest, which is about a successful implementation on Android.
I have followed the path implied in the thread and some others, and so far achieved limited success. I am still far away from getting to use the modem, due to reasons Adam-specific and Android-specific. One important matter for consideration is that you require root access to your Adam. Let us see what I have done so far:
- Root your Adam, if you have the guts to do it. Just go to http://notioninkhacks.com and download an appropriate ROM. I use the root + ad hoc + market ROM by Zerofeel et al
- Install the Android Terminal Emulator (or similar), and plug in a USB keyboard, preferably through an expansion hub
- Have a proper PC at hand, preferably Linux but Windows will do
- Download the static binary of usb_modeswitch for ARM
- Download the usb-modeswitch-data tarball – it has some important configuration files
- Download an additional device reference database
- Unzip and untar the usb_modeswitch binary and put it on a USB pendrive or MicroSD
- Plug in your modem to your PC, and identify its Vendor and Device IDs from the device manager. I have a Huawei EC1262 modem, which has the Vendor ID 0x12d1 and Device IDs 0x1446 (ZeroCD mode) / 0x140b (modem), displayed according to the unswitched or switched mode respectively. On a Linux computer, you could also read the
dmesgoutput to identify it
- Open the usb-modeswitch-data archive, navigate to the usb_modeswitch.d directory under it, and identify the configuration file matching your Vendor and Device ID, e.g. 12d1:1446
- Extract the correct config file to your USB pendrive. This is the operation for which a non-Android device is necessary. The config file’s naming convention is invalid, and Windows will automatically convert it to 12d1_1446. Android just crashes at this point or throws up other errors. Rename it to usb_modeswitch.conf so that you would know what it is later, and put it on the pendrive
- If you are unable to locate your device in usb-modeswitch-data, check the device reference file thoroughly and copy the most appropriate block of text to usb_modeswitch.conf
- Unzip and copy the device reference file to the pendrive too. It would be better if these files can be put in a separate folder that is easily accessible
- Do a safe removal of the pendrive from the PC
- Plug the pendrive into the USB hub attached to the Adam
- Open the terminal emulator, type
suat the prompt to become root. Accept confirmation. A physical keyboard is very handy. The prompt will change from $ to #
- Assume responsibility for your actions
- The files are to be copied to the Android file system, which is in a read-only mode by default, even for root. You could put these files anywhere, but I decided to be a brute and put it in /system/xbin, which is where lots of binaries lie. Follow the next two steps in order to do this
- The /system folder is the mount point for /dev/block/mtdblock3, mounted ro. Check with
mountat the command prompt. The / folder is a separate mount, and let us not mess with that for now
- Change the permission on the Adam’s /system directory to read-write (it is temporary and gets reset with a reboot):
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /systemand then recheck with mount again, then copy the files mentioned at #17 above to /system/xbin
- You may need to mount the USB filesystem, without which usb_modeswitch will return a “USB error: couldn’t opendir(): No such file or directory” error. Although I am not sure of the reasons behind this, I recommend issuing the command
mount -t usbfs usbfs /proc/bus/usb(as root)
- Now plug in your modem to the Adam, run
dmesgand check the output at the end. You should get something an output at the end showing the connection of your device and its recognition in the CD-ROM mode, e.g. idVendor=12d1, idProduct=1446, along with manufacturer’s name etc.
- On the Terminal, go to /system/xbin (i.e.
cd /system/xbin), and issue the command
- Read the ensuing output for your knowledge, and then issue the command
usb_modeswitch -I -W -c ./usb_modeswitch.conf
This is the point where things should start to work out properly, and progress as you might have read on the usb_modeswitch forum linked earlier. However, I have discovered as of now that the kernel on the Adam lacks the support for usb-serial devices, and probably does not have drivers for GSM / 3G modems.
I am trying to get the source code for the kernel from Notion Ink, along with means and know-how of compiling it and installing it on the Adam, so that I can pull the missing parts from the stock Android kernel on kernel.org and compile a better kernel.
[Edit: here’s the link to the specific branch of the kernel leading to usb-serial and option drivers, and HERE’s the link to the same drivers for the Tegra kernel! Now if only I knew how to compile them and insert them.]
Of course, Notion Ink would need to tell me about all the compile time parameters to be used, or I will create newer problems. Ermmm…I don’t know if I can just compile it with nVIDIA-recommended tools or if I need a development board 😦
[Update 1: After a copy of the supposed kernel code leaked by someone and was uploaded to Github by Rothnic, another developer actually compiled a kernel for me with usb-serial support and a separate driver for option. However, I was unable to flash the kernel to the Adam, but aim to retry]
[Update 2: Notion Ink has released the official source code for the kernel they’ve used in the Adam, and we are expecting an update on 7th May 2011. Once I get the update, I will post about whether they have finally included the necessary drivers]
If you are interested, keep watching this space. This post has been waiting in draft form for more than 10 days now, and I will update the how-to once I get more information or achieve more progress.