Author Topic: International keyboard scan codes not being recognized  (Read 14757 times)

Edio

  • Member
  • ***
  • Posts: 12
    • Smak Tecnologia
International keyboard scan codes not being recognized
« on: February 19, 2018, 08:43:48 am »
I Have a brazilian (ABNT2) HID keyboard implementation, everything works fine but two scan codes are completely ignored.
The ignored scan codes are 0x85 and 0x87. which are not standart for US keyboard.
In my HID descriptor, bCountryCode is 0x00, I do not Know what more I can do.
The interesting part is that I have a brazilian Dell keyboard connected to the same computer sending exact the same report and the scan codes 0x85 and 0x87 are interpreted with no problem.
Someone could give me a light on the subject, please?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: International keyboard scan codes not being recognized
« Reply #1 on: February 19, 2018, 12:26:36 pm »
The fact that you have a working keyboard points to the device as the problem.

A protocol analyzer would show what is happening when you press those keys on both keyboards and could offer a clue.

http://janaxelson.com/development_tools.htm#analyzers

Edio

  • Member
  • ***
  • Posts: 12
    • Smak Tecnologia
Re: International keyboard scan codes not being recognized
« Reply #2 on: February 19, 2018, 02:46:07 pm »
   As a matter of fact I have a Total Phase Beagle hardware analyser and the SouceUSB software.
  Both keyboards send me the same report, for example: 00 00 85 00 00 00 00 00, but one keyboard generates a key press the other do not.
  More interesting, I can built a report like this 00 00 04 85 00 00 00 00 in my keyboard project and there is only a keystroke 'A'.
  For information 0x85 is a dot in the Keypad and 0x87 is a  /? in an diferente position.
« Last Edit: February 19, 2018, 04:06:04 pm by Edio »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: International keyboard scan codes not being recognized
« Reply #3 on: February 19, 2018, 10:38:32 pm »
Check Windows Device Manager to find out if both keyboards have the same assigned drivers.

Edio

  • Member
  • ***
  • Posts: 12
    • Smak Tecnologia
Re: International keyboard scan codes not being recognized
« Reply #4 on: February 20, 2018, 08:22:23 am »
  I am using Win7 for testing, but the behavior is the same in the Win XP.
  I just test in Linux and had the same result. All keys and LEDs work but these two keys.
  The driver are the same for both keyboards (kbdclass.sys and kbdhid.sys) version 6.1.7601.17514.
  The only diference is that my keyboard lacks power management (remote wakeup).
  I guess I need to mention that the HID keyboard is part of a composite device with a CDC VCP, wich is working normaly.
« Last Edit: February 20, 2018, 10:06:01 am by Edio »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: International keyboard scan codes not being recognized
« Reply #5 on: February 20, 2018, 10:09:26 am »
What is bCountryCode in the devices' HID descriptors?

See 6.2.1 in the USB HID spec.

Edio

  • Member
  • ***
  • Posts: 12
    • Smak Tecnologia
Re: International keyboard scan codes not being recognized
« Reply #6 on: February 20, 2018, 02:38:50 pm »
   In my HID descriptor, bCountryCode is 0x00

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: International keyboard scan codes not being recognized
« Reply #7 on: February 20, 2018, 03:09:39 pm »
Try 13 (decimal), or maybe 22. See HID spec.

Edio

  • Member
  • ***
  • Posts: 12
    • Smak Tecnologia
Re: International keyboard scan codes not being recognized
« Reply #8 on: February 20, 2018, 04:28:48 pm »
  thanks for the effort.

  I tried both(13 and 22), same result.
  for information: All brazilian keyboards I know set bCountryCode to 0x00, I guess there is no code for Brazil.
  22 (0x16) is for portuguese keyboards in Portugal, even though we speak (almost) the same language our keyboards are different.
« Last Edit: February 20, 2018, 04:32:07 pm by Edio »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: International keyboard scan codes not being recognized
« Reply #9 on: February 20, 2018, 08:25:28 pm »
After you change something in the descriptors, with the device attached, uninstall it in Device Manager, then remove and reattach. Otherwise Windows might "remember" and use the previous descriptors.

Also look for any other differences in the descriptors between your keyboard and the functioning one.
« Last Edit: February 20, 2018, 08:26:59 pm by Jan Axelson »

Edio

  • Member
  • ***
  • Posts: 12
    • Smak Tecnologia
Re: International keyboard scan codes not being recognized
« Reply #10 on: March 05, 2018, 10:01:23 am »
      I gave it a break. Now I found that were the UsageMax and Logical Max in the report descriptor, they were set to 0x65, I just rise that to 0x00ff.
      Thank you for the help.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: International keyboard scan codes not being recognized
« Reply #11 on: March 06, 2018, 09:22:26 pm »
Glad you got it working. Thanks for reporting what you found!