Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Q] Android physical keyboard protocol

OP king4aday

5th January 2014, 05:03 PM   |  #1  
OP Junior Member
Thanks Meter: 0
 
1 posts
Join Date:Joined: Jan 2014
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
Recognized Contributor / Recognized Developer
Boston
Thanks Meter: 822
 
2,000 posts
Join Date:Joined: Feb 2012
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 by Renate NST; 5th January 2014 at 05:36 PM.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes