As most of you already know, I own an android mobile. Recently I wanted to add an RSS feed URL to my android podcast client, but was annoyed by the fact that I had to copy this long URL by hand. I would rather copy&paste it.
As I have rooted my phone, it had to be possible one way or another. Looking around, I found no usable solutions.
The most general solution would be to simulate keyboard input. Digging around a bit in Linux internals I found a way to inject key-presses via
/dev/input/events* so I wrote a little program: btype.c. For those not wanting to compile it themselves, you can download the binary here.
It will accept text on the command-line, or read interactively from stdin.
Writing it was actually more difficult than I expected - I didn't want to hardcode the keyboard scancodes, so I had to read&parse the keymap and keylayout files which is always onerous in C. Also I learned funny
ioctl%s to find the correct device in %/dev/input and to switch a tty to single-character input. Last but not least I had to find out how to get an android property value in C. – Hopefully all this made the program more portable to other android devices.
I hope someone finds a good use for it, let me know if you like it,