Pages: 1 [2]   Go Down
Author Topic: Keyboard Reprogram not working  (Read 1989 times)
0 Members and 1 Guest are viewing this topic.
Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does everything work now? What's the output for different character inputs?
Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So can you provide the output you get for different input characters?
Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The translation table is not in USBAPI.h but in HID.cpp and there the character line feed (10) is translated into 0x28.

The definitions you found are especially for this code and are translated in the press method:

Code:
if (k >= 136) { // it's a non-printing key (not a modifier)
k = k - 136;
} else if (k >= 128) { // it's a modifier key
_keyReport.modifiers |= (1<<(k-128));
k = 0;
} else { // it's a printing key
k = pgm_read_byte(_asciimap + k);

0xB0 - 136 = 0x28

so this makes sense.

Edit: corrected LF code.

Yes that makes sens
Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So can you provide the output you get for different input characters?

So I get managed it to work, with help of this i've getting it to work
Code:
From http://geekhack.org/showwiki.php?title=Scan+Codes

Scan Code set for USB Keyboard

Set4 AKA USB HID
Many manufacturers move the key that is in either the 5C or 53 position to the 5D position,
while having it retain its old scan code, (AT keyboard layout) Set4 was designed for the 101-key keyboard.


 ---     ---------------   ---------------   ---------------   -----------
| 29|   | 3A| 3B| 3C| 3D| | 3E| 3F| 40| 41| | 42| 43| 44| 45| | 46| 47| 48|
 ---     ---------------   ---------------   ---------------   -----------

 -----------------------------------------------------------   -----------   ---------------
| 35| 1E| 1F| 30| 21| 22| 23| 24| 25| 26| 27| 2D| 2E|(5C) 2A| | 49| 4A| 61| | 53| 54| 55| 56|
|-----------------------------------------------------------| |-----------| |---------------|
|   2B| 14| 1A| 08| 15| 17| 1C| 18| 0C| 12| 13| 2F| 30| (31)| | 4C| 4D| 4E| | 5F| 60| 61|   |
|-----------------------------------------------------------|  -----------  |-----------| 57|
|    39| 04| 16| 07| 09| 0A| 0B| 0D| 0E| 0F| 33| 34|(53)  28|               | 5C| 5D| 5E|   |
|-----------------------------------------------------------|      ---      |---------------|
| E1 (64)| 1D| 1B| 06| 19| 05| 11| 10| 36| 37| 38|(87)    E5|     | 52|     | 59| 5A| 5B|   |
|-----------------------------------------------------------|  -----------  |-----------| 58|
|   E0|   |   E2|  (8B)|    2C|  (8A)|  (88)|   E6|   |   E4| | 50| 51| 4F| |     62| 63|   |
 -----     ---------------------------------------     -----   -----------   ---------------

This shows the Keyboardlayout for an USB Keyboard and with it I set the ASCII-Code to the Scan-Code where the Key is.

but there is the problem now there are some Keys like € it has the ASCII-Code 80 its already used by SHIFT in the HID.ccp and the Modifiere Keys are placed in range of some special Letters on the ISO-8859-1.

At this point I have no idea how to merge it with the Letters and I looking for an option to make an connection for the ALT GR Key some ASCII-Codes on my Layout are on the 3rd Layer like { or ] or @ so I thinking how to merge it usefully...

Modified Code will follow after I cleaned the mess in the HID.ccp I arranged.

EDIT:
Files added!

* HID.cpp (17.47 KB - downloaded 12 times.)
* keylayout.h (11.16 KB - downloaded 11 times.)
« Last Edit: June 11, 2012, 06:19:31 am by Markus_L811 » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you wana go beyond the ASCII character set (0-127) you have to change the way the translation works. You might remove the possibility to send modifiers (and getting the values 128 to 255 free to use for ISO-8859-15) or you have to change the input array to be of type unsigned int (so you have enough values to express almost anything). The other possibility is to use UTF-8 and set some unused special characters as the modifiers.

The original code definitely only supports the ASCII character set, so no special characters and no Umlauts.

BTW: € has NO ASCII value and even no value in the usual ISO-8859-1 (Latin-1) character set. To enable the new currency sign ISO introduced a new standard ISO-8859-15 (around the year 2000) containing that character but even there the code is 244 (A4) and not 128 (80).
Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you wana go beyond the ASCII character set (0-127) you have to change the way the translation works. You might remove the possibility to send modifiers (and getting the values 128 to 255 free to use for ISO-8859-15) or you have to change the input array to be of type unsigned int (so you have enough values to express almost anything). The other possibility is to use UTF-8 and set some unused special characters as the modifiers.
Yes I thinking about an way with the modifiers in action, so there is no change for the rest of it.
Some about an move of the "Arduino Modifiers" behind 0xFF and SHIFT to 0x100 and ALT Gr somewhere above of it, but that would change it for the rest of all (users).

Quote
The original code definitely only supports the ASCII character set, so no special characters and no Umlauts.

BTW: € has NO ASCII value and even no value in the usual ISO-8859-1 (Latin-1) character set. To enable the new currency sign ISO introduced a new standard ISO-8859-15 (around the year 2000) containing that character but even there the code is 244 (A4) and not 128 (80).
I read the ISO.
Hmm, somewhere did I read that € was put on 0x80...

But I don't feel comfortable with it.
« Last Edit: June 11, 2012, 10:15:13 am by Markus_L811 » Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 96
Posts: 4702
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but that would change it for the rest of all (users)

What does that mean? Do you have other users?

If you wanna go beyond 0xFF you cannot use a character string as the input anymore but have to change to an uint16_t array for example. Then you have enough possibilities to encode all common characters (valid at least for Europe). Or take the other option and go with UTF-8 encoding and redefine some characters not of interest for you do have the meaning of the modifiers.
Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
but that would change it for the rest of all (users)

What does that mean? Do you have other users?

If you wanna go beyond 0xFF you cannot use a character string as the input anymore but have to change to an uint16_t array for example. Then you have enough possibilities to encode all common characters (valid at least for Europe). Or take the other option and go with UTF-8 encoding and redefine some characters not of interest for you do have the meaning of the modifiers.

No not realy, but maybe I'm not the only one with an non-us english keyboard. UTF-8 hmm, I had to read how to do this.
Logged

Pages: 1 [2]   Go Up
Jump to: