diff --git headers/os/add-ons/input_server/InputServerDevice.h headers/os/add-ons/input_server/InputServerDevice.h
index 3c33588..9add069 100644
|
|
enum {
|
23 | 23 | // B_KEYBOARD_DEVICE notifications |
24 | 24 | B_KEY_MAP_CHANGED = 1, |
25 | 25 | B_KEY_LOCKS_CHANGED, |
| 26 | B_GET_KEYBOARD_ID, |
26 | 27 | B_KEY_REPEAT_DELAY_CHANGED, |
27 | 28 | B_KEY_REPEAT_RATE_CHANGED, |
28 | 29 | |
diff --git headers/private/input/kb_mouse_settings.h headers/private/input/kb_mouse_settings.h
index e76db24..bb782c3 100644
|
|
|
12 | 12 | typedef struct { |
13 | 13 | bigtime_t key_repeat_delay; |
14 | 14 | int32 key_repeat_rate; |
| 15 | uint16 keyboard_id; |
15 | 16 | } kb_settings; |
16 | 17 | |
17 | 18 | #define kb_default_key_repeat_delay 500000 |
diff --git src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp
index ef963d2..d8fd6cd 100644
|
|
KeyboardDevice::_UpdateSettings(uint32 opcode)
|
512 | 512 | { |
513 | 513 | KD_CALLED(); |
514 | 514 | |
| 515 | if (opcode == 0 || opcode == B_GET_KEYBOARD_ID) { |
| 516 | if (ioctl(fFD, KB_GET_KEYBOARD_ID, &fSettings.keyboard_id) != B_OK) |
| 517 | LOG_ERR("error when KB_GET_KEYBOARD_ID, fd:%d\n", fFD); |
| 518 | } |
| 519 | |
515 | 520 | if (opcode == 0 || opcode == B_KEY_REPEAT_RATE_CHANGED) { |
516 | 521 | if (get_key_repeat_rate(&fSettings.key_repeat_rate) != B_OK) { |
517 | 522 | LOG_ERR("error when get_key_repeat_rate\n"); |
diff --git src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.cpp
index bfd492b..953794e 100644
|
|
static bool sIsExtended = false;
|
61 | 61 | |
62 | 62 | static int32 sKeyboardRepeatRate; |
63 | 63 | static bigtime_t sKeyboardRepeatDelay; |
| 64 | static uint16 sKeyboardId; |
64 | 65 | |
65 | 66 | |
66 | 67 | static status_t |
… |
… |
keyboard_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
|
492 | 493 | } |
493 | 494 | |
494 | 495 | case KB_GET_KEYBOARD_ID: |
| 496 | { |
| 497 | TRACE("ps2: ioctl KB_GET_KEYBOARD_ID\n"); |
| 498 | uint8 keyboard_id[2]; |
| 499 | // 0xf2 (Read keyboard ID) - Keyboard responds with "ack" (0xFA). |
| 500 | if (ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], |
| 501 | PS2_CMD_GET_DEVICE_ID, NULL, 0, keyboard_id, 2) != B_OK); |
| 502 | return B_ERROR; |
| 503 | sKeyboardId = (uint16)((keyboard_id[1] << 8) & keyboard_id[0]); |
| 504 | return user_memcpy(buffer, &sKeyboardId, sizeof(sKeyboardId)); |
| 505 | } |
| 506 | |
495 | 507 | case KB_SET_CONTROL_ALT_DEL_TIMEOUT: |
496 | 508 | case KB_CANCEL_CONTROL_ALT_DEL: |
497 | 509 | case KB_DELAY_CONTROL_ALT_DEL: |
diff --git src/kits/interface/InterfaceDefs.cpp src/kits/interface/InterfaceDefs.cpp
index ed61c2f..730ac73 100644
|
|
get_keyboard_id(uint16 *id)
|
691 | 691 | |
692 | 692 | _control_input_server_(&command, &reply); |
693 | 693 | |
694 | | status_t err = reply.FindInt16("id", (int16 *)&kid); |
| 694 | status_t err = reply.FindUInt16("id", &kid); |
695 | 695 | if (err != B_OK) |
696 | 696 | return err; |
697 | 697 | *id = kid; |
diff --git src/servers/input/InputServer.cpp src/servers/input/InputServer.cpp
index 8b44ef8..ec65b64 100644
|
|
InputServer::HandleGetSetMouseMap(BMessage* message, BMessage* reply)
|
872 | 872 | status_t |
873 | 873 | InputServer::HandleGetKeyboardID(BMessage* message, BMessage* reply) |
874 | 874 | { |
875 | | return reply->AddInt16("id", fKeyboardID); |
| 875 | BMessage msg(IS_CONTROL_DEVICES); |
| 876 | msg.AddInt32("type", B_KEYBOARD_DEVICE); |
| 877 | msg.AddInt32("code", B_GET_KEYBOARD_ID); |
| 878 | if (fAddOnManager->PostMessage(&msg) == B_OK) |
| 879 | return reply->AddUInt16("id", fKeyboardSettings.KeyboardId()); |
| 880 | else |
| 881 | return B_ERROR; |
876 | 882 | } |
877 | 883 | |
878 | 884 | |
diff --git src/servers/input/KeyboardSettings.cpp src/servers/input/KeyboardSettings.cpp
index 96aff49..f65216d 100644
|
|
KeyboardSettings::KeyboardSettings()
|
26 | 26 | goto err; |
27 | 27 | if (file.Read(&fSettings, sizeof(kb_settings)) != sizeof(kb_settings)) |
28 | 28 | goto err; |
29 | | |
| 29 | |
30 | 30 | return; |
31 | 31 | err: |
32 | 32 | fSettings.key_repeat_delay = kb_default_key_repeat_delay; |
… |
… |
KeyboardSettings::SetKeyboardRepeatDelay(bigtime_t delay)
|
56 | 56 | |
57 | 57 | |
58 | 58 | void |
| 59 | KeyboardSettings::SetKeyboardId(uint16 id) |
| 60 | { |
| 61 | fSettings.keyboard_id = id; |
| 62 | } |
| 63 | |
| 64 | |
| 65 | void |
59 | 66 | KeyboardSettings::Save() |
60 | 67 | { |
61 | 68 | BPath path; |
diff --git src/servers/input/KeyboardSettings.h src/servers/input/KeyboardSettings.h
index e67548c..84b5d34 100644
|
|
public :
|
22 | 22 | |
23 | 23 | void SetKeyboardRepeatRate(int32 rate); |
24 | 24 | void SetKeyboardRepeatDelay(bigtime_t delay); |
25 | | |
| 25 | void SetKeyboardId(uint16 id); |
| 26 | |
26 | 27 | int32 KeyboardRepeatRate() const { return fSettings.key_repeat_rate; } |
27 | 28 | bigtime_t KeyboardRepeatDelay() const { return fSettings.key_repeat_delay; } |
| 29 | uint16 KeyboardId() const { return fSettings.keyboard_id; } |
28 | 30 | |
29 | 31 | void Save(); |
30 | 32 | |