I don't know about you, but if I am going to spend more than 2 minutes playing with that Android shell we just set up, I'll have to get that Tab working.
Let me explain : on my computer, the adb shell thing does not correctly handle the Tab and Arrows. That means I can't use completion and history edition/navigation on the shell. This is bad.
Note that this behavior seems to vary from one computer to another, depending on operating system an probably some other parameters which I don't know about. Anyways, let's try to hack our way around this annoying limitation.
I've found a cool way to solve our problem : why not use telnet ? We get proper terminal support, and a built-in login system (no more typing /bin/login).
First, check that you compiled telnetd support in Busybox (check if the symlink exists in /bin). If that's not the case, go back 2 steps, and rebuild Busybox.
Now that we have /bin/telnetd on our system, the only thing left to do is to have it start up when we boot Android, waiting on a port for connections. Well, you might remember that we added a rc service at the end of the init.rc (see part IV). So at startup, Android will execute the script /bin/rc. Let's create this script.
In your ramdisk directory :
$ cd bin $ cat > rc #!/bin/sh /bin/telnetd ^D $ chmod 755 rc $ cd .. $ echo bin/rc >> ramdisk_list
Now rebuild the ramdisk, and start the emulator. Telnet should be waiting for you on port 23.
We can't connect to Android directly. We first have to set up port redirection, because Android, being on an emulator, has no IP we can connect to. We're in luck, setting up a redirection is as easy as :
adb forward tcp:4444 tcp:23
And now all connections to your host on port 4444 will end up on Android's port 23.
telnet localhost 4444
And you are on Android, with Tab and Arrows. Now, that's usable !
One little glitch though. You might think that you can now telnet to your Android from across the net. Not so fast. The Android emulator only accepts connections from the local host (after proper port forwarding). That means that another computer cannot connect to your Android, and port forwarding won't help (the emulator listens on lo, not eth0).
This limitation seems to come from Qemu (the emulator behind emulator), and has been documented on many websites. On Linux, one solution is to build a bridge. Or you might want to write a little proxy program (again, on Linux, that can be as easy as running netcat).