[Q] Android physical keyboard protocol

Search This thread

king4aday

New member
Jan 5, 2014
1
0
Hey all,

I repurposed an old Android 2.3 phone (rooted HTC Wildfire S [marvelc]) as the navigation device for my motorcycle.
My motorcycle has a 4-way handlebar control for the factory navigation (which I don't feel like paying $900 for...)

I'm in the process of debugging the interface of that control on my motorcycle, and eventually I want to interface it to the marvelc via USB.

I was thinking on buying a cheap tablet keyboard and use the wires of that to access the functions that I need (I would need to "scroll" between UI elements, also to "click" on them, and use the "back" button somehow. I don't know if all of these are possible with a physical keyboard or not, but some very old Android devices had controls like this.)

I'm just trying to ask the community, if this option is even feasible?

Also, since I'll need a microcontroller for capturing the input of the 4-way control from the motorcycle, I was thinking on implementing the Android keyboard USB interface on that same microcontroller, but I couldn't find any documentation or protocol description on that. If you could point me in the right direction, I'd greatly appreciate it
 

Renate

Recognized Contributor / Inactive Recognized Dev
Step one: Figure out which keys your nav app responds to.
Does it use arrow keys? volume keys? DPAD?
Use adb and the shell. For example, this sends ESCAPE
Code:
input keyevent 111

You can probably use a gutted keypad and wire up the switches.
It would probably make sense to have it wired for 4 arrow keys and enter.
That way you can test it easily on a desktop system.
If you need keys that are different, edit /system/usr/keylayout/qwerty.kl

Use my UsbMode.apk (in signature) to identify keyevents.
It's designed for something else for the Nook but it will display key events on any Android.

The only problem with gutted keypads is that they use matrix scanning.
If you need/want contacts to ground you'd be better off with a uP.
I like a Teensy 2.0 because it's small and has hardware USB.

This all presumes that your device support USB host mode.
 
Last edited: