2

I’ve tried to map my RPI Zero HID-Gadget in a sh file, here is my sh file. I tried to exchange a normal german keyboard by swapping kbcodes from us-keyboard to german-keyboard layout, but if it is the right attempt, i can't swap the <>|key because in german keyboard layout we have one key for <>| this, this key is between shift and y, and this key not existing on a us keyboard.

How can i add this key into the c file?

Or is there a better way to make it working on a german keyboard, I would like to know it

Or can i get any resources that help me?

Thanks in advance.

My duckpi_german_layout.sh file looks so:

elif [ "$1" == "<" ]
then
    kbcode=''
elif [ "$1" == "|" ]
then
    kbcode=''

elif [ "$1" == "," ]     #Comma
then                     #Works
    kbcode='comma'       #

and I don't know what i should write into kbcode='' by <, > and |. If i write 'kbcode='right-alt <' to output that | I get unknown option: <

OS = Stretch (9)
Kernel = 4.19.50+

I don't will connect any keyboard to my rpi. I will connect my rpi to a computer and there it should write this what I write in a txt file my project

lucki1000
  • 23
  • 3

1 Answers1

2

from hak5darren de.properties file

KEY_NON_US_100 = 100 // 0x64

ASCII_3E = KEY_NON_US_100, MODIFIERKEY_SHIFT
// 62 >

ASCII_7C = KEY_NON_US_100, MODIFIERKEY_RIGHT_ALT 
// 124 |

ASCII_3C = KEY_NON_US_100
// 60 <

from ossiozac source file NON_US_100 KEY 0x64 is missing

{.opt = "kp-period",    .val = 0x63},
{.opt = "kp-stop",      .val = 0x63},
--- and 0x64 not existing/missing ---
{.opt = "application",  .val = 0x65},
{.opt = "power",        .val = 0x66},

Add in your C file :

{.opt = "non-us-100",       .val = 0x64},

Add in your bash file:

elif [ "$1" == "<" ]
    then
        kbcode='non-us-100'
elif [ "$1" == ">" ]
    then
        kbcode='left-shift non-us-100'
elif [ "$1" == "|" ]
    then
        kbcode='right-alt non-us-100'

This key seems to be confirmed by this document on page 56

NOT TESTED/NOT VERIFIED (Edit: seems to work, but I don't know for these next commands)

Normaly you can also test a key with 'echo' :

# '<'
echo -ne "\0\0\x64\0\0\0\0\0" > /dev/hidg0
echo -ne "\0\0\0\0\0\0\0\0" > /dev/hidg0 
# '|'
echo -ne "\x40\0\x64\0\0\0\0\0" > /dev/hidg0 
echo -ne "\0\0\0\0\0\0\0\0" > /dev/hidg0
# '>'
echo -ne "\x2\0\x64\0\0\0\0\0" > /dev/hidg0 
echo -ne "\0\0\0\0\0\0\0\0" > /dev/hidg0
Ephemeral
  • 2,167
  • 1
  • 8
  • 19