I have a joystick with 6 axes an 2 buttons. If I connect that joystick to my device (nexus 7) through an otg cable it gets recognized as HID device.
The two buttons are both mapped by android to ENTER and the X + Y axes to direction keys.
So it is already possible to control some UI sections (ie app icon selection on launcher).
I added a key layout map in "/system/usr/keylayout/Vendor_046d_Product_c626.kl" to customize the two buttons.
I was also able to remap and invert all 6 axes.
As you can see I mapped the two buttons to the volume controls, which works fine.
Unfortunately I'm not able to figure out how to map axes to keystrokes.
As the X + Y axes are mapped to direction keys, there must be a setting somewhere for this.
I would like to use all 6 axes and map them to simple keystrokes.
Can sombody help?
The two buttons are both mapped by android to ENTER and the X + Y axes to direction keys.
So it is already possible to control some UI sections (ie app icon selection on launcher).
I added a key layout map in "/system/usr/keylayout/Vendor_046d_Product_c626.kl" to customize the two buttons.
I was also able to remap and invert all 6 axes.
Code:
# left / right
axis 0x00 RX
# forth / back
axis 0x01 RY
# up / down
axis 0x02 RZ
# roll forth / back
axis 0x03 Y
# roll left / right
axis 0x04 X
# turn left / right
axis 0x05 Z
# left button
key 256 VOLUME_DOWN
# right button
key 257 VOLUME_UP
Unfortunately I'm not able to figure out how to map axes to keystrokes.
As the X + Y axes are mapped to direction keys, there must be a setting somewhere for this.
I would like to use all 6 axes and map them to simple keystrokes.
Can sombody help?