brad's life [entries|archive|friends|userinfo]
Brad Fitzpatrick

[ website | bradfitz.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Android, Debian, Linux, remote keyboard to G1, ... [Dec. 14th, 2008|11:02 pm]
Brad Fitzpatrick
[Tags|, , ]

I'm loving Android more and more. I keep finding (and filing) bugs, but they're all fixable, and this is only going to keep getting better.

Today I installed Debian on my G1. I followed those instructions up until the unionfs part, where I opted to use bind mounts instead, letting me have a /android/data and /android/system inside my Debian chroot.

Anyway, I now have openssh, perl, python, sqlite3, emacs, git, svn, gcc, screen, nmap, tcpdump, iftop, etc... all running on my phone in a little 2GB filesystem. (I have a 16GB SD card). Then using ConnectBot, I just keep an ssh connection from the phone to localhost all the time, so Debian is accessible when I'm out and about.

But when I'm at home and want to ssh in, I have a bash alias which forwards a port over USB:

alias droid='$ANDSDK/tools/adb forward tcp:1622 tcp:22 && ssh -p 1622 root@localhost'

... so then my openssh server only needs to listen on localhost.

Now that I can just ssh into my phone to work on stuff, I was getting annoyed having to reply to SMSes by using the little phone keyboard when I was sitting in front of a real keyboard.

So I wrote this:
http://github.com/bradfitz/android-misc/tree/master/type.pl [mirror]

That's an app which captures my keystrokes in my ssh session (I have it running in a screen window), and then injects them into the Linux input layer, so Android thinks I'm typing them on the keyboard.

Even cooler: I wrote that all ssh'd into my phone, over ssh in Emacs in screen, including git-push'ing it to github.com.

Fun stuff.

(Don't worry --- I'm not just working on useless stuff. dan_erat and I were hacking on an Android app today which everybody can use....)

From: pathawks.com
2008-12-15 08:05 am (UTC)


I don't know, man. Using a real keyboard on a mobile devices sounds like a winner to me!
(Reply) (Thread)
[User Picture]From: vxjasonxv
2008-12-15 02:11 pm (UTC)
Phone<->Computer integration is one of my most sought after features for phones. When my phone is at my desk, let me use it via my computer. It'll prevent a lot of cluster.... mini-keyboard designs.

My phone is sitting literally inches away from my hands, but why can't I just call up it's applications (bluetooth signaling?) and start typing away on my fully fledged laptop keyboard that I'm so used too?

Of course, my phone isn't the G1, so I'm at the whim of the Apple Overlords, unlike you.

And it just happened now, I just picked up and replied to an SMS taking way too long to type it out.

I can go so much further than this, but I'll stick to the topic and say that phones need to do what you did, natively.
(Reply) (Thread)
[User Picture]From: grumbeld
2008-12-15 10:54 pm (UTC)
I wish I understood what you said.
(Reply) (Thread)
[User Picture]From: mart
2008-12-16 01:02 am (UTC)

Next step: VNC server!

(Reply) (Thread)
[User Picture]From: mart
2008-12-16 01:07 am (UTC)
Alternative next step: Jabber-to-SMS-via-phone gateway.
(Reply) (Parent) (Thread)
[User Picture]From: awwaiid
2008-12-17 02:20 pm (UTC)


I'm still sad that the openmoko doesn't get more press. If it got the attention that android has (from a company like Google) then it would surely be doing a bit better by now. Even still... Yes, x11vnc runs fantastically, as does xvncviewer.

And you can drop Android on it without having to jailbreak anything :)
(Reply) (Parent) (Thread)
[User Picture]From: supersat
2009-01-21 01:30 am (UTC)
Do you have problems enabling/disabling wifi with Debian unioned in to the root filesystem? Is so, any solutions? I haven't had a chance to poke at it too much, so I was wondering if you have had a chance to run into and fix this problem.
(Reply) (Thread)
From: malilazila
2009-06-01 07:31 am (UTC)

It is my new toy

I'm about to have fun with Android phone too. It's on the way to me. I'll post what I do with it when the time comes.
(Reply) (Thread)
From: (Anonymous)
2009-07-28 09:54 pm (UTC)

/dev/input/event2 vs. event3

Thanks a lot, this is awesome!

On my device (ADP 1 running CyanogenMod v3.6.8.1, which is based on Android 1.5r3), the /dev/input directory didn't exist inside of the Debian directory hierarchy (which I put at /system/sd), and also the right device turned out to be event3 (13,67) instead of event2 (13, 66), so outside the Debian chroot I did

mkdir /system/sd/mnt
mkdir /system/sd/mnt/dev
busybox mount --bind /dev /system/sd/mnt/dev

in addition to the other binds, and I changed the relevant line in that script from

my $keyboard = "/dev/input/event2";


my $keyboard = "/mnt/dev/input/event3";

and changed

system("mknod", $filename, "c", 13, 66) and die "mknod failed.";
system("mknod", $filename, "c", 13, 67) and die "mknod failed.";

I'm not suggesting that you change the script, I just wanted to note this here so that others could find it. Thanks again!
(Reply) (Thread)
From: (Anonymous)
2009-09-08 02:18 pm (UTC)

Bluetooth keyboard?

I want to use a bluetooth keyboard for data entry into my Android.

If I install Debian on it will I be able to use a bluetooth keyboard?
(Reply) (Thread)
From: (Anonymous)
2010-01-13 07:38 pm (UTC)

Inject keys

I wrote my own solution, which uses uinput. It also works on android phones without hardware keyboards, and also supports special keys.

(Reply) (Thread)