[Q] Android physical keyboard protocol - General Questions and Answers

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

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.

Related

Moto Xoom/Logitech Tablet/MS 6000 BT Keyboards and Apple BT Mouse: OK on Infuse 4G

Hi all,
In case anyone was wondering, the following Bluetooth keyboards work with the Infuse, running Gingerbread 2.3.3.
General Note: all devices below paired up seamlessly. They were immediately detected, and simply required me to key in a 6 digit passkey (4 digits for the Apple Magic Mouse).
1) Microsoft Bluetooth Mobile Keyboard: in all honesty, this keyboard worked the BEST out of all three that I tried today. As an FYI, F1 triggered Menu, Home triggered Home, and Esc triggered back. Reason why I didn't dig it all to much was the rather 'flimsy' build quality, although I do use the 7000 Entertainment set at home.
2) Logitech Tablet Keyboard for Android (3.0+?): Ignoring the 3.0 spin, and focusing on the fact that it's an HID-compliant BT device, I picked this up to give it a whirl. Niceties include the case that it comes with, which doubles into a stand for your device. Major setback that made me return it: the Menu button didn't work for me! Otherwise, a fantastic setup.
3) The keeper: Motorola Xoom BT Keyboard. Very similar in functionality to the Logitech offering. Started off pretty bummed because the built-in Menu keys on this kb didn't work either. Where the Moto saves itself, though, is that they keep they have a 5th row, atop the rest of the keyboard similar to a standard desktop keyboard (the Logitech trimmed these off and only had 4 rows), and within that 5th row, was an F1 key (which, after trial and error on the MS kb, triggers Menu). All in all, a nice package. Good to know I can rip away at longer emails with this thing, if I ever need to.
4) Apple Magic Mouse: nothing special here - paired easily, works like a mouse.
Quirks: 1
1) When pairing the Moto to a non-Moto device, you need to hold down the keys V, A and R when initiating the pair (don't worry, it's in the manual).
2) When the screen times out while paired to the KB (not the mouse), a cursor mysteriously appears, and is persistent until I disable BT connectivity on the device.
3) If you use a pattern to unlock your device, you might want to switch to a PIN or password, if you'd really like to be able to unlock your device from the keyboard...
4) "End" on the keyboard locks the screen. From my round of testing, all keys can unlocks (pretty neat) as long as you don't have a pattern set (meaning, you unlock with a PIN or password.)
5) The kb stays paired; the mighty mouse, i need to tap on to connect from within Settings each time.
That's about it. Feel free to ask me any questions if you had any, or correct me if you've me off base with any.
Can you give us some amazon links per keyboard so we can check specifications on the keyboard and maybe purchase one. I'm gonna need one that works with both the infuse and the motorola atrix.
Thanks
Sent from my SAMSUNG-SGH-I997R
Any idea if these will work with the stock at&t rom?
Apples Magic Mouse
Are we saying the magic mouse works on the xoom just like a normal mouse would?

Function keys and scroll direction

So, I'm loving the hell out of my Surface RT (64GB with black Touch cover) except for two things.
1: I use the actual function keys (F1-F12) a lot more than I need a shortcut key for the play/pause button or the Share charm. Due to the placement of the Fn button on the right side of the keyboard, it's difficult to use the keys the way I'm used to. For example, Alt+F4 is now Alt+Fn+Play/Pause, and requires two hands. If anybody can find a way to toggle the default state of the Fn key, I would be super-grateful! Ideally, I'd be able to actually remap he keys like you can on advanced USB keyboards; for example, I need the Home and End keys too, but rarely use F8-F10 so I'd like to remap those.
2: The default direction of the multitouch scroll drives me up a wall (but only if I try to drive down it). It's a pointing device, not a touchscreen, dammit! I expect it to function like a scroll wheel on a mouse, or the side-scroll on older PC touchpads, or the TrackPoint scroll on the Thinkpad, or... you get my point. Yes, I get that Apple did it first; they were dumb then, are still dumb now, and MS was very dumb to copy them. On the other hand, at least Apple lets you change it! If the direction of this scroll can be reversed (preferably without screwing up the scroll wheel of an actual mouse, if I were to connect one), that would be amazing.
I was really hoping that the included drivers would include controls for these things, the way Microsoft's normal mice and keyboards come with highly configurable drivers, or most Laptops come with fairly advanced Synaptics touchpad driver controls. If any of you have contacts at MS on or near the Surface team, tell them that we really want some drivers like those, please!
have you been able to resolve the Fn key issue?
GoodDayToDie said:
So, I'm loving the hell out of my Surface RT (64GB with black Touch cover) except for two things.
1: I use the actual function keys (F1-F12) a lot more than I need a shortcut key for the play/pause button or the Share charm. Due to the placement of the Fn button on the right side of the keyboard, it's difficult to use the keys the way I'm used to. For example, Alt+F4 is now Alt+Fn+Play/Pause, and requires two hands. If anybody can find a way to toggle the default state of the Fn key, I would be super-grateful! Ideally, I'd be able to actually remap he keys like you can on advanced USB keyboards; for example, I need the Home and End keys too, but rarely use F8-F10 so I'd like to remap those.
2: The default direction of the multitouch scroll drives me up a wall (but only if I try to drive down it). It's a pointing device, not a touchscreen, dammit! I expect it to function like a scroll wheel on a mouse, or the side-scroll on older PC touchpads, or the TrackPoint scroll on the Thinkpad, or... you get my point. Yes, I get that Apple did it first; they were dumb then, are still dumb now, and MS was very dumb to copy them. On the other hand, at least Apple lets you change it! If the direction of this scroll can be reversed (preferably without screwing up the scroll wheel of an actual mouse, if I were to connect one), that would be amazing.
I was really hoping that the included drivers would include controls for these things, the way Microsoft's normal mice and keyboards come with highly configurable drivers, or most Laptops come with fairly advanced Synaptics touchpad driver controls. If any of you have contacts at MS on or near the Surface team, tell them that we really want some drivers like those, please!
Click to expand...
Click to collapse
The Fn Key issue is a little bit annoying, anybody have a solution for it?

[Q] Hiding the mouse pointer.

I have one of those Android HDMI TV sticks (A variant of CX-01, to be exact.) running 4.0.4, successfully rooted and hacked up to my liking. There is one thing I would like it to do, which, in my case, is the reason to own it in the first place: I need a very portable presentation device, which I could plug into anything with a HDMI socket and play a presentation. (As a side note, it boots whenever it gets power supplied, so you can use it as a very hidden cheap web server - it's smaller than a Raspberry Pi.)
There is a problem with this usage, however. The device comes with a 2.4 GHz wireless accelerometer-based mouse with a few buttons, which is it's only input device, connected over USB OTG. (Replacing it with something else would be very much not cost-effective) That mouse is only usable because when it is connected, ICS displays a mouse pointer on screen, otherwise, navigation would be way too cumbersome. I have replaced the stock mouse pointer with a smaller one by replacing the png image in framework-res.apk, and it's good enough. Using Hide Bar, I was able to hide the status bar (the wireless mouse has back and home buttons) so I get the full screen for my presentation.
During the presentation itself, I need an input device to move between individual slides and otherwise trigger execution, buttons on the wireless mouse work, or can be reassigned in various ways. However, I need the mouse pointer to invisible during that, as the motion sensitive wireless mouse would make it move constantly while I'm talking with the mouse in my hand.
There is apparently no way to temporarily disable the accelerometer in the mouse itself, while it has a power button that disables it entirely, it turns off everything, including the buttons, and pressing the buttons enables the mouse again.
This means I need a software means to temporarily hide or disable the mouse pointer. (I can obviously permanently hide it by replacing the pointer with a transparent PNG. That would make it very hard to control the device, because the only button it has to trigger a control actually simulates a left click, so it's out.) Extensive googling failed to provide an answer -- most of the time people who get a mouse pointer they don't want seem to eventually give up and pick a HID device which does not produce it instead. As far as I can see, there can only be two ways to do it:
Somehow get the OS to think it has no mouse HID device, or that it's not moving.
Somehow force the mouse pointer to stick to a corner of the screen and keep it there while it's not needed.
Unfortunately I could find no clear sources on either method. I'm not above some hacking and programming to get it done, but I would appreciate an advice on what to look for.

App to grab/rebind/forward keyboard & mouse inputs?

Im curently using a half size bluetooth keyboard paired to my phone (nexus 4) which is running RemoteDroid. That is used to forward keystrokes to my PC. Why? because I have a broken collarbone and cant use my fullsize wired keyboard properly So im using my phone as an intermediate device (BluetoothK/B->Phone->WiFi->PC) to be able to use the bluetooth keyboard. Putting the phone in close proximity to the K/B means It has a much better range and signal quality via WiFi. The phone itself also has a better bluetoooth receiver than any laptop or desktop USB bluetooth receivers ive tried, giving much more reliable keystrokes at higher typing speed than gong straight to PC
The problem is some of the keys dont work correctly and I believe its because Android is interpreting them differently. i.e. 'Tab/Delete/Insert/Home/End/num +/ num -.. etc' dont get forwarded to the PC,And some keystrokes are simply incorrect` i.e. the right shift key acts more like CTRL for some things. Shift+2 becomes " instead of @ (need to press alt 2 instead) and so on
In addition I have a touchpad on the little keyboard and that only works in a limitted fashion
Is there an app out there that can 'grab' the Android inputs of a device and remap them? so i.e. mouse click could be emulated as pressing the Enter key if I so wished
Additionally` is there a progam that can forward these 'raw inputs' to a PC via USB/WiFi/Bluetooth? remotedroid does indeed forward some inputs of key presses as best it can (arrow keys for instance) but it seems to do it 'after' the android OS (i.e. alt+tab makes the android program switch applications, rather than forwarding the 'alt' and 'tab' keys to the PC)
It does not however forward mouse inputs (havnt tried gamepad) so its not possible to use a mouse or trackpad as intended. I have to emulate a screen press (hold left click on trackpad and move the cursor across the remotedroid screen)
Hope the above makes sense, and yes im aware I could simply bluetooth directly to the PC but wheres the fun in that?

Disabling Android system commands on bluetooth/usb Keyboard and Mouse buttons?

Hello XDA community!
I've done brief google-fu trying to work around issue I have found myself struggling with with nothing to show for it so I come to ask experts because surely, this being such a fundamental problem someone must've already tackled it, right?
So my problem is, I try to use my Android device (in this case POCO X3 NFC, but considering getting Android tablet specifically for this purpose if there is a workaround to issue I'm about to describe since my iPad is nothing more than expensive paper weight it seems) as a client device to access remote desktop and use BT mouse and keyboard to go along with it. Everything is sorta kinda working... except it doesn't as soon as you get to interact with it. ESC and few other keys prioritise Android shortcuts over application, same with right mouse button. I don't think I need to explain why right mouse button closing remote desktop app (Parsec and Moonlight) and booting me back to app launcher instead of opening the context menu on remote desktop is a MAJOR problem. I've found TeamViewer to work alrightish, it catches mouse clicks and button inputs and prevent app from closing itself... if it only wasn't a steaming pile of dog**** to work on - obviously desire here is to keep using VASTLY superior remote desktop experience that either Parsec or Moonlight provides with the benefit of using BT mouse and keyboard.
Is there ANY way that Android system button shortcuts could be completely disabled? I don't want my F-keys to adjust volume... Nor do I want my ESC key or mouse right click boot me back into app launcher...
Also, as a bonus if there's a way to significantly decrease mouse cursor sensitivity it would be greatly appreciated because holy **** moving mouse 1 inch on a desk on lowest setting Android allows for would scroll through several dozen screens worth of content...
I've found this to be a problem on iOS as well but unlike iOS being left at Apple's mercy I kinda expect Android to be more maliable by end-user.
Any takers?

Categories

Resources