Changeset 4837092 in mainline for uspace/drv/usbhid/main.c
- Timestamp:
- 2011-02-04T16:40:10Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 92574f4
- Parents:
- 8c3c756
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/main.c
r8c3c756 r4837092 248 248 */ 249 249 250 static const keycode_t usb_hid_modifiers_boot_keycodes[5] = { 251 KC_NUM_LOCK, /* USB_HID_MOD_BOOT_NUM_LOCK */ 252 KC_CAPS_LOCK, /* USB_HID_MOD_BOOT_CAPS_LOCK */ 253 KC_SCROLL_LOCK, /* USB_HID_MOD_BOOT_SCROLL_LOCK */ 254 0, /* USB_HID_MOD_BOOT_COMPOSE */ 255 0 /* USB_HID_MOD_BOOT_KANA */ 256 }; 257 250 258 static void usbkbd_check_modifier_changes(usb_hid_dev_kbd_t *kbd_dev, 251 259 uint8_t modifiers) 252 260 { 253 // ignore for now 254 // modifiers should be sent as normal keys to usbkbd_parse_scancode()!! 255 // so it would be better if I received it from report parser in that way 261 /* 262 * TODO: why the USB keyboard has NUM_, SCROLL_ and CAPS_LOCK 263 * both as modifiers and as keys with their own scancodes??? 264 * 265 * modifiers should be sent as normal keys to usbkbd_parse_scancode()!! 266 * so maybe it would be better if I received it from report parser in 267 * that way 268 */ 269 270 int i; 271 for (i = 0; i < USB_HID_MOD_BOOT_COUNT; ++i) { 272 if ((modifiers & usb_hid_modifiers_boot_consts[i]) && 273 !(kbd_dev->modifiers & usb_hid_modifiers_boot_consts[i])) { 274 // modifier pressed 275 if (usb_hid_modifiers_boot_keycodes[i] != 0) { 276 kbd_push_ev(KEY_PRESS, 277 usb_hid_modifiers_boot_keycodes[i]); 278 } 279 } else if (!(modifiers & usb_hid_modifiers_boot_consts[i]) && 280 (kbd_dev->modifiers & usb_hid_modifiers_boot_consts[i])) { 281 // modifier released 282 if (usb_hid_modifiers_boot_keycodes[i] != 0) { 283 kbd_push_ev(KEY_RELEASE, 284 usb_hid_modifiers_boot_keycodes[i]); 285 } 286 } // no change 287 } 256 288 } 257 289 … … 262 294 263 295 unsigned int key; 264 int i, j;296 unsigned int i, j; 265 297 266 298 // TODO: quite dummy right now, think of better implementation … … 486 518 kbd_dev->keycode_count = BOOTP_REPORT_SIZE; 487 519 kbd_dev->keycodes = (uint8_t *)calloc( 488 kbd_dev->keycode_count *sizeof(uint8_t));520 kbd_dev->keycode_count, sizeof(uint8_t)); 489 521 490 522 if (kbd_dev->keycodes == NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.