Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scancode-ascii-table.h: Support for QWERTZ and AZERTY keyboards. #46

Closed
likeaguest opened this issue Dec 23, 2016 · 12 comments
Closed

scancode-ascii-table.h: Support for QWERTZ and AZERTY keyboards. #46

likeaguest opened this issue Dec 23, 2016 · 12 comments

Comments

@likeaguest
Copy link

@likeaguest likeaguest commented Dec 23, 2016

By now, scancode-ascii-table.h is just supporting the us qwerty keyboard layout. When inserting a DigiSpark using the DigiKeyboard lib into a computer with qwertz, "y" changes to "z" for example.

There should also be an option for qwerty and azerty keyboards. I would love to do it myself, but I don't really get the idea of how it is working.

@panki27
Copy link

@panki27 panki27 commented Jan 6, 2017

I'm having the same issue.
I believe the way to accomplish this is by editing the scancode-ascii-table.h file, so it contains the correct scancodes for a QWERTZ/whatever layout.

For Y/Z, it's as easy as changing every Y in the string you want to enter to a Z and vice versa, however, if you're trying to include characters such as the backslash, it gets very frustrating.

I've tried digging around and finding a correlation between the scancodes in the file and the actual hardware scan codes, but I just don't get it 👎

@Fardenco
Copy link

@Fardenco Fardenco commented Feb 18, 2017

I had the same issue, I modified a few files to comply with azerty layout.

That's true I also had a hard time finding correlation between scancodes, and I didn't find any.
I've found most of the scancodes for azerty layout on the pictures in this thread
https://digistump.com/board/index.php?topic=2289.0
but "<>" and all altgr keys were missing.

My solution for finding "<>" was simply to write a for loop sending keystrokes for all scancodes from 1 to 255, and looking what each of these were doing until I see "<" on the screen. ">" is simply the same key with shift modifier.

For altgr key combination, I found out that keycodes for keyboard characters fit on the 6 less significant bits of a char. The 1st msb is already used to apply or not shift modifier, I simply used the 2nd msb to apply or not altgr modifier.

But there was a problem, "<" keycode is 100, and this is the only one that does not fit in 6 bits and so it use the bit I just used for altgr modifier. My solution for this is quite dirty but it works : I simply put a condition precisely for "<" and ">" characters case.

Finaly this works, for testing I used the following line :

DigiKeyboard.println("abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890 !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~");

and all characters works fine.

Find the files for azerty layout attached. (added .txt to comply with file post requirements)

DigiKeyboard.h.txt
scancode-ascii-table.h.txt

I suppose you could use the same process for any keyboard layout.

@mame82
Copy link

@mame82 mame82 commented Feb 20, 2017

@Fardenco You're right on the codes of the ASCII relevant keys, which are all encoded with values less than 0x65. Thus the second MSB could be used. I haven't done this for a simple reason. The USB descriptor used by DigiKeyboard.h is restricted to send values up to dec 101 (0x65). I changed the descriptor to allow sending values up to dec 231. This allows sending keycodes grater than 0x65 (most of them don't belong to PC AT keyboard, see USB HID keyboard usage table for reference). In the end this allowed me for example to send key 0x80, which on my Linux targets results in a Volume Up keypress and works out of the box with an USB descriptor fix. See here for details.

@Fardenco
Copy link

@Fardenco Fardenco commented Feb 20, 2017

Oh, that's why I did not managed get the media keys working !
That's great, I'll definitly try this.
But my use of the second msb is just done on the print function, so it should not interfer with your fix !

@DerSibi
Copy link

@DerSibi DerSibi commented Aug 6, 2017

Hi everyone,

I used Fardenco's excellent previous work and started on a mapping for a qwertz-Layout. It's still not perfect, but most keys work.

Known to not work yet: §|^´`äöüÄÖÜ

As of right now, this is perfectly fine for me so in case anyone still looking for a mapping, I wanted to share. Feel free to work out the remaining issues.

See the example string below to see what works und what doesn't:

abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890ß ü+öä#,.- !"X$%&/()=? Ü*ÖÄ';:_ {[]}\~ <>| @§ ^´`` /* parameter for println()*/
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890g g+gg5#,.- !"X$%&/()=? g*gg';:_ {[]}\~ <> @ ]f{ /* output */

DigiKeyboard.h.txt
scancode-ascii-table.h.txt

Have fun!

Sibi

@Manurban
Copy link

@Manurban Manurban commented Sep 7, 2017

Hello,

I am new to arduino. Could you help me to use thoses libraries? How to change the orginal one? I tried to replace the files on my hard drive but i could not find them. Do you know where they are?

Thank U.

@Fardenco
Copy link

@Fardenco Fardenco commented Sep 8, 2017

You'll find these files in the DigisparkKeyboard library folder.
It should be at "C:\Program Files (x86)\Arduino\libraries\DigisparkKeyboard"
or may be "C:\Users\XXX\Documents\Arduino\libraries\DigisparkKeyboard"

@BesoBerlin
Copy link

@BesoBerlin BesoBerlin commented Nov 28, 2017

hi and thank you first for your work!
so i tried to complete Layout for German Keyboards, but §|`äöüÄÖÜ wont work this way, as they are not ascii characters.
^ and ` are working, but i just cant get the |
strange is, identifier 44 in my case works for < and for space as well. when I add MSB it prints > as suspected, but when I add the 2ndMSB for AltGr it doesnt work...
Did one of you guys get it working?

@panki27
Copy link

@panki27 panki27 commented Apr 23, 2018

For anyone still having trouble with this: use duck2spark.
https://github.com/mame82/duck2spark

@Fardenco
Copy link

@Fardenco Fardenco commented Apr 24, 2018

This is great, thank you for sharing

@Cs-hack00
Copy link

@Cs-hack00 Cs-hack00 commented Mar 5, 2021

I am not being able to use the TAB key. I have tries KEY_TAB after giving define KEY_TAB
I have used 43,10.Moreover I have also used "/t". Can anyone help plz?

@ArminJo
Copy link

@ArminJo ArminJo commented Mar 9, 2021

Use https://github.com/ArminJo/DigistumpArduino, this has an extended keyboard example with international layout support.

@likeaguest Can you please close the issue? Thanks

@likeaguest likeaguest closed this Mar 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants