Opened 13 years ago

Closed 13 years ago

#7963 closed enhancement (fixed)

get_keyboard_id in InterfaceDefs unimplmented

Reported by: jscipione Owned by: siarzhuk
Priority: normal Milestone: R1
Component: Servers/input_server Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

The function get_keyboard_id() declared in InterfaceDefs.h always returns 0. It should return an id provided by the keyboard hardware. According to the BeBook for a 101 key keyboard (and perhaps others) it should return 0x83ab.

Attachments (2)

get_keyboard_id_1.diff (5.0 KB ) - added by jscipione 13 years ago.
This patch represents my attempt to grab the keyboard id from the PS/2 driver. It is incomplete but can be a starting point to anyone interested in implementing this feature.
getkbid.cpp (277 bytes ) - added by jscipione 13 years ago.
Small test program to check your keyboard id. Compile with gcc -lbe -o getkbid getkbid.cpp and run from the command line.

Download all attachments as: .zip

Change History (12)

by jscipione, 13 years ago

Attachment: get_keyboard_id_1.diff added

This patch represents my attempt to grab the keyboard id from the PS/2 driver. It is incomplete but can be a starting point to anyone interested in implementing this feature.

comment:1 by jscipione, 13 years ago

patch: 01

by jscipione, 13 years ago

Attachment: getkbid.cpp added

Small test program to check your keyboard id. Compile with gcc -lbe -o getkbid getkbid.cpp and run from the command line.

comment:2 by siarzhuk, 13 years ago

Owner: changed from korli to siarzhuk
Status: newassigned

comment:3 by mmu_man, 13 years ago

Any app using it ? It shouldn't be used anyway, it only accounts for 1 keyboard while we want to introduce multi-device support someday...

Is there any logic in those IDs appart the value ?

comment:4 by mmu_man, 13 years ago

Partially fixed by hrev42866 & hrev42867.

comment:5 by mmu_man, 13 years ago

Hmm inserting stuff in the enum in InputServerDevice.h will break binary compatibility...

comment:6 by mmu_man, 13 years ago

Btw, keyboard_id isn't really a "setting" per see, it is a hardware report, there is no reason one should be able to set it.

comment:7 by mmu_man, 13 years ago

Did you actually try your patch ? It wouldn't even work because the fSettings field of the KeyboardDevice isn't copied back to input_server's own version, it's only used locally in the add-on.

comment:8 by jscipione, 13 years ago

Replying to mmu_man:

Btw, keyboard_id isn't really a "setting" per see, it is a hardware report, there is no reason one should be able to set it.

I only implemented it as a setting because I was grasping as straws. Setting the keyboard id should be done at Input Server init perhaps, then get_keyboard_id() should simply return the value.

For multi-device support we could overload get_keyboard_id() to take an index so get_keyboard_id(0) would get the first keyboard's ID, get_keyboard_id(1) would get the second keyboard, etc. We would need to keep the parameterless key_keyboard_id() function for backwards compatibility and have it call get_keyboard_id(0).

I was also thinking that it might be nice to extend get_keyboard_id() to get the USB ID of USB keyboards as well if you have one of those attached. But perhaps that is not very helpful without the USB Vendor ID as well.

in reply to:  7 comment:9 by jscipione, 13 years ago

Replying to mmu_man:

Did you actually try your patch ? It wouldn't even work because the fSettings field of the KeyboardDevice isn't copied back to input_server's own version, it's only used locally in the add-on.

I did try the patch, it didn't ever work. I was in way over my head so I attached the incomplete patch only as a help to someone much smarter to take it and run with it. I see that strategy has seemed to work. :)

comment:10 by mmu_man, 13 years ago

Resolution: fixed
Status: assignedclosed

Implemented differently in hrev43037. Thanks!

Note: See TracTickets for help on using tickets.