Changeset 7ac73a4 in mainline for uspace/drv/usbhid/kbddev.c
- Timestamp:
- 2011-03-05T11:49:53Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 00db345a
- Parents:
- dde8ca4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/kbddev.c
rdde8ca4 r7ac73a4 38 38 #include <str_error.h> 39 39 #include <fibril.h> 40 #include <stdio.h> 40 41 41 42 #include <io/keycode.h> … … 62 63 static const size_t BOOTP_BUFFER_SIZE = 8; 63 64 static const size_t BOOTP_BUFFER_OUT_SIZE = 1; 65 static const uint8_t IDLE_RATE = 125; 64 66 65 67 /** Keyboard polling endpoint description for boot protocol class. */ … … 228 230 229 231 if (mod_mask != 0) { 230 usb_log_debug2("\n\nChanging mods and lock keys\n");231 usb_log_debug2("\nmods before: 0x%x\n", kbd_dev->mods);232 usb_log_debug2("\nLock keys before:0x%x\n\n",233 kbd_dev->lock_keys);234 235 232 if (type == KEY_PRESS) { 236 usb_log_debug2("\nKey pressed.\n");237 233 /* 238 234 * Only change lock state on transition from released … … 247 243 usbhid_kbd_set_led(kbd_dev); 248 244 } else { 249 usb_log_debug2("\nKey released.\n");250 245 kbd_dev->lock_keys = kbd_dev->lock_keys & ~mod_mask; 251 246 } 252 247 } 253 248 254 usb_log_debug2("\n\nmods after: 0x%x\n", kbd_dev->mods);255 usb_log_debug2("\nLock keys after: 0x%x\n\n", kbd_dev->lock_keys);256 257 249 if (key == KC_CAPS_LOCK || key == KC_NUM_LOCK || key == KC_SCROLL_LOCK) { 258 250 // do not send anything to the console, this is our business … … 281 273 ev.key = key; 282 274 ev.mods = kbd_dev->mods; 283 284 if (ev.mods & KM_NUM_LOCK) {285 usb_log_debug("\n\nNum Lock turned on.\n\n");286 }287 275 288 276 ev.c = layout[active_layout]->parse_ev(&ev); … … 389 377 } 390 378 } 379 // // report all currently pressed keys 380 // for (i = 0; i < kbd_dev->keycode_count; ++i) { 381 // if (key_codes[i] != 0) { 382 // key = usbhid_parse_scancode(key_codes[i]); 383 // usb_log_debug2("\nKey pressed: %d (keycode: %d)\n", key, 384 // key_codes[i]); 385 // usbhid_kbd_push_ev(kbd_dev, KEY_PRESS, key); 386 // } 387 // } 391 388 392 389 memcpy(kbd_dev->keycodes, key_codes, kbd_dev->keycode_count); 393 390 394 usb_log_debug2("\nNew stored keycodes: ");391 char *kc = (char *)malloc(kbd_dev->keycode_count * 4 + 1); 395 392 for (i = 0; i < kbd_dev->keycode_count; ++i) { 396 usb_log_debug2("%d ", kbd_dev->keycodes[i]); 397 } 393 snprintf(kc + (i * 4), 5, "%4d", key_codes[i]); 394 } 395 usb_log_debug("New stored keycodes: %s\n", kc); 398 396 } 399 397 … … 410 408 return; 411 409 } 412 413 usb_log_debug2("Got keys from parser: ");414 unsigned i;415 for (i = 0; i < count; ++i) {416 usb_log_debug2("%d ", key_codes[i]);417 }418 usb_log_debug2("\n");419 410 420 411 usbhid_kbd_t *kbd_dev = (usbhid_kbd_t *)arg; 421 412 assert(kbd_dev != NULL); 413 414 unsigned i; 415 char *kc = (char *)malloc(kbd_dev->keycode_count * 4 + 1); 416 for (i = 0; i < kbd_dev->keycode_count; ++i) { 417 snprintf(kc + (i * 4), 5, "%4d", key_codes[i]); 418 } 419 usb_log_debug("Got keys from parser: %s\n", kc); 422 420 423 421 if (count != kbd_dev->keycode_count) { … … 446 444 //usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, callbacks, 447 445 // NULL); 448 /* usb_log_debug2("Calling usb_hid_boot_keyboard_input_report() with size"446 /*//usb_log_debug2("Calling usb_hid_boot_keyboard_input_report() with size" 449 447 " %zu\n", actual_size);*/ 450 448 //dump_buffer("bufffer: ", buffer, actual_size); … … 559 557 * Set boot protocol. 560 558 * Set LEDs according to initial setup. 559 * Set Idle rate 561 560 */ 562 561 assert(kbd_dev->hid_dev != NULL); … … 565 564 566 565 usbhid_kbd_set_led(kbd_dev); 566 567 usbhid_req_set_idle(kbd_dev->hid_dev, IDLE_RATE); 567 568 568 569 kbd_dev->initialized = 1;
Note:
See TracChangeset
for help on using the changeset viewer.