pelya / android-keyboard-gadget

Convert your Android device into USB keyboard/mouse, control your PC from your Android device remotely, including BIOS/bootloader.
Apache License 2.0
1.25k stars 314 forks source link

hid-gadget-test qwerty azerty #29

Open letroll opened 9 years ago

letroll commented 9 years ago

Hello, I have a bug with hid-gadget-test utility, when I run : echo a | /data/local/tmp/hid-gadget-test /dev/hidg0 keyboard, it's print "q" and vice versa

I think to a qwerty azerty conversion... Can you help me with that?

pelya commented 9 years ago

It's definitely because of AZERTY layout.

You can use some commandline conversion of characters, like

echo a | /data/local/tmp/busybox tr qwaz azqw | /data/local/tmp/hid-gadget-test /dev/hidg0 keyboard

You will also need to copy busybox to /data/local/tmp On Jun 24, 2015 3:58 PM, "Julien Quiévreux" notifications@github.com wrote:

Hello, I have a bug with hid-gadget-test utility, when I run : echo a | /data/local/tmp/hid-gadget-test /dev/hidg0 keyboard, it's print "q" and vice versa

I think to a qwerty azerty conversion... Can you help me with that?

— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/29.

letroll commented 9 years ago

Is it possible that I compile HID-gadget-test only with the azerty layout? If Yes can you help to do that, (the compilation part, not the layout change)

pelya commented 9 years ago

Yes, here they are: https://github.com/pelya/android-keyboard-gadget/tree/master/hid-gadget-test/jni Run ndk-build from hid-gadget-test directory to recompile it. On Jun 25, 2015 12:35 PM, "Julien Quiévreux" notifications@github.com wrote:

Is it possible that I compile HID-gadget-test with the azerty layout? sources are available?

— Reply to this email directly or view it on GitHub https://github.com/pelya/android-keyboard-gadget/issues/29#issuecomment-115185763 .

letroll commented 9 years ago

Thanks a lot I can create my own hid-gadget now, but another 2 another questions now, in the following code:

{.opt = "a",            .val = 0x04},
{.opt = "b",            .val = 0x05},
{.opt = "c",            .val = 0x06},
{.opt = "d",            .val = 0x07},
{.opt = "e",            .val = 0x08},

how do you choose the val ? Arbitary way? I can other key like '@'?

pelya commented 9 years ago

.val is scancode returned by keyboard hardware. There is a list of USB keyboard scancodes here: http://hg.libsdl.org/SDL/file/tip/include/SDL_scancode.h When you have non-QWERTY layout, you just have different key labels, but the key themselves usually return same scancodes - upper-left key has scancode 20, where would be 'Q' key on QWERTY keyboard, the next key has scancode 26 etc.