android-keyboard-gadget icon indicating copy to clipboard operation
android-keyboard-gadget copied to clipboard

Configuring hid-gadget-test for different keyboard layouts

Open zeratoss opened this issue 10 years ago • 10 comments

Hey man great job! I would love to use this with my Qwertz computer. I saw https://github.com/pelya/android-keyboard-gadget/issues/29 and know that you have to recompile hid-gadget-test but how would you do that for different keyboard layouts?

zeratoss avatar Sep 10 '15 11:09 zeratoss

Will you be using hid-gadget-test utility or the GUI app? You can reconfigure all keys inside GUI app.

On Thu, Sep 10, 2015 at 2:29 PM, zeratoss [email protected] wrote:

Hey man great job! I would love to use this with my Qwertz computer. I saw #29 https://github.com/pelya/android-keyboard-gadget/issues/29 and know that you have to recompile hid-gadget-test but how would you do that for different keyboard layouts?

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

pelya avatar Sep 11 '15 12:09 pelya

The hid gadget utility with the duvky script bash interpreter from http://zx.rs/6/DroidDucky---Can-an-Android-quack-like-a-duck/

zeratoss avatar Sep 17 '15 01:09 zeratoss

Thanks for the link, I've added it to readme.

On Thu, Sep 17, 2015 at 4:04 AM, zeratoss [email protected] wrote:

The hid gadget utility with the duvky script bash interpreter from http://zx.rs/6/DroidDucky---Can-an-Android-quack-like-a-duck/

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

pelya avatar Sep 18 '15 10:09 pelya

Well you just put QWERTY keyboard near your QWERTZ, and note all keys that are swapped from QWERTY layout. Then you swap the appropriate keys inside hid-gadget-test sources, and recompile it.

On Fri, Sep 18, 2015 at 1:00 PM, Sergii Pylypenko [email protected] wrote:

Thanks for the link, I've added it to readme.

On Thu, Sep 17, 2015 at 4:04 AM, zeratoss [email protected] wrote:

The hid gadget utility with the duvky script bash interpreter from http://zx.rs/6/DroidDucky---Can-an-Android-quack-like-a-duck/

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

pelya avatar Sep 18 '15 10:09 pelya

The problem is that some keys like "" have no direct equivalent. On Qwertz it is "Alt Gr" + the key right of 0, but on Qwerty that combination does nothing, so i can't switch them.

zeratoss avatar Sep 23 '15 20:09 zeratoss

Check https://github.com/tejado/Authorizer/blob/master/app/src/main/java/net/tjado/authorizer/UsbHidKbd_de_DE.java for a german scancode mapping.

tejado avatar May 24 '16 07:05 tejado

@tejado thank you that looks really useful. Can i just add missing keys like {.opt = "ß" .val =0x2d}, ?

Is it different for values longer than four like kbdVal.put("€", new byte[] {0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00} );?

zeratoss avatar Jun 01 '16 16:06 zeratoss

With the ß you can. Maybe for € there is no adjustment necessary as it should be just "echo right-alt e | ./hid-gadget-test /dev/hidg0 keyboard" or? (not tested)

tejado avatar Jun 01 '16 21:06 tejado

@zeratoss @tejado

I have the same problem as zeratoss has. I tried to add the \ (german keyboard) but i didn't get it working. Did you manage it? Can i change: {.opt = "backslash", .val = 0x31},? But which value? @tejado I've found this line in your repository for german layout: {0x02, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00} But i think, this is a too long.

Any ideas?

winscripting avatar Nov 18 '16 12:11 winscripting

@VirtualThin it isn't too long, it is the complete 8 byte scancode like explained here: https://github.com/pelya/android-keyboard-gadget#how-it-works So my table is a complete mapping table as the mapping like in https://github.com/pelya/android-keyboard-gadget/blob/a41e6e2511cd5d76bc7aa2c9aa6ea45e98f0b78c/hid-gadget-test/jni/hid-gadget-test.c is done dynamic but is difficult to change to support other keyboard layouts.

The line for the backslash on a german layout is this: kbdVal.put("", new byte[] {0x40, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00} );

You can change your backslash value to "0x2d" but the problem is, that the modifier key (Right-Alt key in this case, which is 0x40) is missing, to type this on a german keyboard. As you can see in my line, the first byte is representing this modifier key. I'm not so sure how to map this correctly in the dynamic mapping code of pelya. Due to this I created these complete 8 byte scancode mapping tables.

tejado avatar Nov 18 '16 14:11 tejado