Changeset 8f840ed in mainline
- Timestamp:
- 2011-02-24T19:31:07Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f2ba5d9f
- Parents:
- e7b7ebd5
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/main.c
re7b7ebd5 r8f840ed 139 139 */ 140 140 141 /** Currently active modifiers .141 /** Currently active modifiers (locks is probably better word). 142 142 * 143 143 * TODO: put to device? … … 258 258 */ 259 259 260 static const keycode_t usb_hid_modifiers_boot_keycodes[5] = { 261 KC_NUM_LOCK, /* USB_HID_MOD_BOOT_NUM_LOCK */ 262 KC_CAPS_LOCK, /* USB_HID_MOD_BOOT_CAPS_LOCK */ 263 KC_SCROLL_LOCK, /* USB_HID_MOD_BOOT_SCROLL_LOCK */ 264 0, /* USB_HID_MOD_BOOT_COMPOSE */ 265 0 /* USB_HID_MOD_BOOT_KANA */ 260 static const keycode_t usb_hid_modifiers_keycodes[USB_HID_MOD_COUNT] = { 261 KC_LCTRL, /* USB_HID_MOD_LCTRL */ 262 KC_LSHIFT, /* USB_HID_MOD_LSHIFT */ 263 KC_LALT, /* USB_HID_MOD_LALT */ 264 0, /* USB_HID_MOD_LGUI */ 265 KC_RCTRL, /* USB_HID_MOD_RCTRL */ 266 KC_RSHIFT, /* USB_HID_MOD_RSHIFT */ 267 KC_RALT, /* USB_HID_MOD_RALT */ 268 0, /* USB_HID_MOD_RGUI */ 266 269 }; 267 270 … … 279 282 280 283 int i; 281 for (i = 0; i < USB_HID_MOD_ BOOT_COUNT; ++i) {282 if ((modifiers & usb_hid_modifiers_ boot_consts[i]) &&283 !(kbd_dev->modifiers & usb_hid_modifiers_ boot_consts[i])) {284 for (i = 0; i < USB_HID_MOD_COUNT; ++i) { 285 if ((modifiers & usb_hid_modifiers_consts[i]) && 286 !(kbd_dev->modifiers & usb_hid_modifiers_consts[i])) { 284 287 // modifier pressed 285 if (usb_hid_modifiers_ boot_keycodes[i] != 0) {288 if (usb_hid_modifiers_keycodes[i] != 0) { 286 289 kbd_push_ev(KEY_PRESS, 287 usb_hid_modifiers_ boot_keycodes[i]);290 usb_hid_modifiers_keycodes[i]); 288 291 } 289 } else if (!(modifiers & usb_hid_modifiers_ boot_consts[i]) &&290 (kbd_dev->modifiers & usb_hid_modifiers_ boot_consts[i])) {292 } else if (!(modifiers & usb_hid_modifiers_consts[i]) && 293 (kbd_dev->modifiers & usb_hid_modifiers_consts[i])) { 291 294 // modifier released 292 if (usb_hid_modifiers_ boot_keycodes[i] != 0) {295 if (usb_hid_modifiers_keycodes[i] != 0) { 293 296 kbd_push_ev(KEY_RELEASE, 294 usb_hid_modifiers_ boot_keycodes[i]);297 usb_hid_modifiers_keycodes[i]); 295 298 } 296 299 } // no change -
uspace/lib/usb/include/usb/classes/hidparser.h
re7b7ebd5 r8f840ed 72 72 73 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; 74 USB_HID_MOD_LCTRL = 0x01, 75 USB_HID_MOD_LSHIFT = 0x02, 76 USB_HID_MOD_LALT = 0x04, 77 USB_HID_MOD_LGUI = 0x08, 78 USB_HID_MOD_RCTRL = 0x10, 79 USB_HID_MOD_RSHIFT = 0x20, 80 USB_HID_MOD_RALT = 0x40, 81 USB_HID_MOD_RGUI = 0x80, 82 USB_HID_MOD_COUNT = 8 83 } usb_hid_modifiers_t; 81 84 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 85 static const usb_hid_modifiers_t 86 usb_hid_modifiers_consts[USB_HID_MOD_COUNT] = { 87 USB_HID_MOD_LCTRL, 88 USB_HID_MOD_LSHIFT, 89 USB_HID_MOD_LALT, 90 USB_HID_MOD_LGUI, 91 USB_HID_MOD_RCTRL, 92 USB_HID_MOD_RSHIFT, 93 USB_HID_MOD_RALT, 94 USB_HID_MOD_RGUI 88 95 }; 89 96
Note:
See TracChangeset
for help on using the changeset viewer.