Using the DigiSpark DigiKeyboard.h library with UK keyboards

Using the DigiSpark DigiKeyboard.h library with UK keyboards

So I recently delved in to the world of DigiSpark Attiny85 boards with a view to making a low-cost (disposible) Rubby Ducky for cyber security and pen testing work.

Unfortunately, while these little boards are “ok”, the DigiKeyboard.h library is built to map US keyboard scan codes to ASCII characters.  For UK keyboards this is OK for the most part but some special characters are an absolute bastard to work out.

NOTE: I’d say the DigiSpark boards are great but they have clear hit-and-miss issues with USB 3.0 controllers that I suspect is going to render them useful over the next few years as these USB 3.0 becomes the standard.

Useful links

Hut1_12v2 USB HID Usage Tables

On page 53 is a table which contains the scan codes Usage ID (DEC) column for each of the keys on a US keyboard.

Download the Hut1_12v2 PDF here

 

How to type tricky characters on a DigiSpark in the UK

Using the @ symbol as an example:

Locate the @ symbol on your own keybboard

Find the corresponding key on a US keyboard (this image may help)

In our example, the @ symbol is actually a quotation mark ” on the US keyboard

Using the Hut1_12v2.pdf (useful links and documents above) find the character in the table and grab the Usage ID, in this example it’s number 52

Send the usage ID using thesendKeyStroke command, adding MOD_SHIFT_LEFT if its required for that character on the US keyboard, for example:

 DigiKeyboard.sendKeyStroke(52,MOD_SHIFT_LEFT);

When I get more time I’ll pull together

The pipe symbol  |  was particularly difficult to sort but can be typed using:

DigiKeyboard.sendKeyStroke(100,MOD_SHIFT_LEFT);

The @ symbol can be typed using:

 DigiKeyboard.sendKeyStroke(52,MOD_SHIFT_LEFT);

 

 

 

Bob McKay

About Bob McKay

Bob is a Founder of Seguro Ltd, a full time father and husband, part-time tinkerer-with-wires, coder, Muay Thai practitioner, builder and cook. Big fan of equality, tolerance and co-existence.

Disclosure Policy

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.