0

I'm working on a way to "translate" keyboard layout working on the keypress value (fixed value written in the USB HID standard). To do so I need to produce a raw (integer) keypress value, yet I don't know exactly how modifiers change such value.

I was trying to understand how the DigiKeyboard.h library works that out but I couldn't get it, here is the main code snippet which do so (I guess):

size_t write(uint8_t chr) {
    uint8_t data = pgm_read_byte_near(ascii_to_scan_code_table + (chr - 8));
    sendKeyStroke(data & 0b01111111, data >> 7 ? MOD_SHIFT_RIGHT : 0);
    return 1;
}

Any hint on how to do so? Thanks!

PS. If it could help, I'm working on this translator to let HID devices such as digispark (ATtiny 85) or rubber ducky to work with every software-defined layout without having to change anything on the system.

dec0de_d00dle
  • 425
  • 1
  • 4
  • 13

1 Answers1

0

You can't translate to every layout using that library!

Posted an answer here: https://stackoverflow.com/a/45122401/7938508

dec0de_d00dle
  • 425
  • 1
  • 4
  • 13