Hey !
Nowadays, buying a mini-a usb cable or at least find one is complicated. You spend a lot of time trying to get one. Personally, the only one I found was on amazon, and the price was, honestly not interesting at all (seriously, that’s 5 pins, 5 wires and a plug…) ! However, without such cable, you cannot use input devices, because they must be powered and controlled by the board. A normal mini-usb cable won’t work (the mini-a plug is for master devices, mini-b plug is for slave devices).
Moreover, for a lot of these boards, when you plug a mini-a cable because you want to use input devices, you cannot use adb… you can still use it over the network, but it means you have working network devices for your board (This is not necessary the case…). The bitrate is also different, so if you planned to upload a big file to your board or if you just planned to install a package, adb over usb is preferable.
I decided to develop a tool to control input devices remotely over the network or over the USB OTG port (with the same cable used to power the device and use adb). The component of the linux kernel for input devices handling is called evdev (for event device). Basically, the input subsystem receives events from hardware-specific drivers and translates them into a generic structure. Finally, this generic event goes up to userspace and can easily be adapted into another input events (like X11 events for example). The linux kernel also provides a “uinput” driver, which allows userspace applications to inject data into the linux input subsystem and control virtual input devices.
In order to control an input device remotely you need to:
This is exactly what I did. The project is called AIB (for Android Input Bridge), the code is distributed under the terms of the GPLv3 license and it’s available on github.
$ git clone git://github.com/rperier/android_input_bridge.git
You need to build “aibd” (the daemon running on the board) either within android or with the linaro toolchain from the native development kit.
Then build the client which will capture and send evdev events from your PC to your board :
$ gcc -Wall -Wextra -O2 aib.c common.c -DAPPNAME="aib" -o aib
Start the daemon
you need to upload the binary to your board, then start it:
$ aibd 4242
Finally just start the client either to use it over the network or locally over the USB OTG port.
Over the network
$ sudo aib board_ip_addr 4242 /dev/input/by-id/your_input_mouse
Over the USB OTG port
On the android side:
$ setprop service.adb.tcp.port ""
$ stop adbd
$ start adbd
On the PC side:
$ adb kill-server
$ adb start-server
$ adb forward tcp:4242 tcp:4242
$ sudo aib 127.0.0.1 4242 /dev/input/by-id/your_input_mouse
Once these steps are done, you should be able to control the cursor remotely using the mouse from your pc !
For now, aib has only support for mice. Support for keyboards is coming soon.
Technically speaking, these tools have nothing to do with android itself, I mean it can work perfectly between two linux machines.
I just developed it for linaro-android because I need it for my board in order to use android without any extra input devices (well, except a mini-b cable which can be bought at anyplace).
Have a nice day



