Changeset 4837092 in mainline
- 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
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/hid.h
r8c3c756 r4837092 79 79 uint8_t *keycodes; 80 80 size_t keycode_count; 81 uint8_t modifiers; 81 82 } usb_hid_dev_kbd_t; 82 83 -
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) { -
uspace/lib/usb/include/usb/classes/hidparser.h
r8c3c756 r4837092 70 70 } usb_hid_report_in_callbacks_t; 71 71 72 #define USB_HID_BOOT_KEYBOARD_NUM_LOCK 0x01 73 #define USB_HID_BOOT_KEYBOARD_CAPS_LOCK 0x02 74 #define USB_HID_BOOT_KEYBOARD_SCROLL_LOCK 0x04 75 #define USB_HID_BOOT_KEYBOARD_COMPOSE 0x08 76 #define USB_HID_BOOT_KEYBOARD_KANA 0x10 72 73 typedef enum { 74 USB_HID_MOD_BOOT_NUM_LOCK = 0x01, 75 USB_HID_MOD_BOOT_CAPS_LOCK = 0x02, 76 USB_HID_MOD_BOOT_SCROLL_LOCK = 0x04, 77 USB_HID_MOD_BOOT_COMPOSE = 0x08, 78 USB_HID_MOD_BOOT_KANA = 0x10, 79 USB_HID_MOD_BOOT_COUNT = 5 80 } usb_hid_modifiers_boot_t; 81 82 static const usb_hid_modifiers_boot_t usb_hid_modifiers_boot_consts[5] = { 83 USB_HID_MOD_BOOT_NUM_LOCK, 84 USB_HID_MOD_BOOT_CAPS_LOCK, 85 USB_HID_MOD_BOOT_SCROLL_LOCK, 86 USB_HID_MOD_BOOT_COMPOSE, 87 USB_HID_MOD_BOOT_KANA 88 }; 89 90 //#define USB_HID_BOOT_KEYBOARD_NUM_LOCK 0x01 91 //#define USB_HID_BOOT_KEYBOARD_CAPS_LOCK 0x02 92 //#define USB_HID_BOOT_KEYBOARD_SCROLL_LOCK 0x04 93 //#define USB_HID_BOOT_KEYBOARD_COMPOSE 0x08 94 //#define USB_HID_BOOT_KEYBOARD_KANA 0x10 77 95 78 96 /*
Note:
See TracChangeset
for help on using the changeset viewer.