Remove All Ads from XDA

[Q] Android physical keyboard protocol

1 posts
Thanks Meter: 0
By king4aday, Junior Member on 5th January 2014, 05:03 PM
Post Reply Email Thread
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
5th January 2014, 05:34 PM |#2  
Renate NST's Avatar
Inactive Recognized Developer / Recognized Contributor
Thanks Meter: 1,014
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
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.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes