mame82 / duck2spark

Converter for raw RubberDucky payloads to Digispark Arduino IDE Sketch source.
472 stars 95 forks source link

Add support for multiple modifiers #11

Open alessandrodd opened 5 years ago

alessandrodd commented 5 years ago

Right now duck2spark doesn't seem to support multiple modifiers, and that's a real pity because in some layouts are really needed.

For example, in the Italian Keyboard, the curly bracket character "{" is made up of: KEY_LEFT_BRACE, MODIFIERKEY_RIGHT_ALT, MODIFIERKEY_SHIFT or, in hex codes: 0x2f, 0x40, 0x2

So, when the Rubber Ducky encoder encodes the "{" character, it produces the following output: 0x2f, 0x40, 0x2, 0x0

Now, in the Arduino code produced by duck2spark, the main loop goes on in step of two, where the first hex is the key and the second is the modifier. In this case, the digispark does this: First it sends the 0x2f + 0x40 character, i.e. KEY_LEFT_BRACE + MODIFIERKEY_RIGHT_ALT i.e. the square bracket "[" and then it sends 0x2 + 0x0 i.e. MODIFIERKEY_SHIFT, i.e. the shift key alone.

Clearly, the same applies to the closing curly bracket "}".