Changes in uspace/drv/usbhid/kbddev.c [6bb456c:24d943f] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/kbddev.c
r6bb456c r24d943f 38 38 #include <str_error.h> 39 39 #include <fibril.h> 40 #include <stdio.h>41 40 42 41 #include <io/keycode.h> … … 63 62 static const size_t BOOTP_BUFFER_SIZE = 8; 64 63 static const size_t BOOTP_BUFFER_OUT_SIZE = 1; 65 static const uint8_t IDLE_RATE = 0;66 64 67 65 /** Keyboard polling endpoint description for boot protocol class. */ … … 151 149 uint8_t buffer[BOOTP_BUFFER_OUT_SIZE]; 152 150 int rc= 0; 151 unsigned i; 153 152 154 153 memset(buffer, 0, BOOTP_BUFFER_OUT_SIZE); … … 178 177 } 179 178 180 usb_log_debug("Output report buffer: %s\n", 181 usb_debug_str_buffer(buffer, BOOTP_BUFFER_OUT_SIZE, 0)); 179 // TODO: REFACTOR!!! 180 181 usb_log_debug("Output report buffer: "); 182 for (i = 0; i < BOOTP_BUFFER_OUT_SIZE; ++i) { 183 usb_log_debug("0x%x ", buffer[i]); 184 } 185 usb_log_debug("\n"); 182 186 183 187 uint16_t value = 0; … … 224 228 225 229 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 226 235 if (type == KEY_PRESS) { 236 usb_log_debug2("\nKey pressed.\n"); 227 237 /* 228 238 * Only change lock state on transition from released … … 237 247 usbhid_kbd_set_led(kbd_dev); 238 248 } else { 249 usb_log_debug2("\nKey released.\n"); 239 250 kbd_dev->lock_keys = kbd_dev->lock_keys & ~mod_mask; 240 251 } 241 252 } 242 253 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 243 257 if (key == KC_CAPS_LOCK || key == KC_NUM_LOCK || key == KC_SCROLL_LOCK) { 244 258 // do not send anything to the console, this is our business … … 267 281 ev.key = key; 268 282 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 } 269 287 270 288 ev.c = layout[active_layout]->parse_ev(&ev); … … 371 389 } 372 390 } 373 // // report all currently pressed keys374 // for (i = 0; i < kbd_dev->keycode_count; ++i) {375 // if (key_codes[i] != 0) {376 // key = usbhid_parse_scancode(key_codes[i]);377 // usb_log_debug2("\nKey pressed: %d (keycode: %d)\n", key,378 // key_codes[i]);379 // usbhid_kbd_push_ev(kbd_dev, KEY_PRESS, key);380 // }381 // }382 391 383 392 memcpy(kbd_dev->keycodes, key_codes, kbd_dev->keycode_count); 384 385 usb_log_debug("New stored keycodes: %s\n", 386 usb_debug_str_buffer(kbd_dev->keycodes, kbd_dev->keycode_count, 0)); 393 394 usb_log_debug2("\nNew stored keycodes: "); 395 for (i = 0; i < kbd_dev->keycode_count; ++i) { 396 usb_log_debug2("%d ", kbd_dev->keycodes[i]); 397 } 387 398 } 388 399 … … 399 410 return; 400 411 } 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"); 401 419 402 420 usbhid_kbd_t *kbd_dev = (usbhid_kbd_t *)arg; 403 421 assert(kbd_dev != NULL); 404 405 usb_log_debug("Got keys from parser: %s\n",406 usb_debug_str_buffer(key_codes, kbd_dev->keycode_count, 0));407 422 408 423 if (count != kbd_dev->keycode_count) { … … 429 444 callbacks->keyboard = usbhid_kbd_process_keycodes; 430 445 431 usb_log_debug("Calling usb_hid_boot_keyboard_input_report() with " 432 "buffer %s\n", usb_debug_str_buffer(buffer, actual_size, 0)); 446 //usb_hid_parse_report(kbd_dev->parser, buffer, actual_size, callbacks, 447 // NULL); 448 /*usb_log_debug2("Calling usb_hid_boot_keyboard_input_report() with size" 449 " %zu\n", actual_size);*/ 450 //dump_buffer("bufffer: ", buffer, actual_size); 433 451 434 452 int rc = usb_hid_boot_keyboard_input_report(buffer, actual_size, … … 541 559 * Set boot protocol. 542 560 * Set LEDs according to initial setup. 543 * Set Idle rate544 561 */ 545 562 assert(kbd_dev->hid_dev != NULL); … … 548 565 549 566 usbhid_kbd_set_led(kbd_dev); 550 551 usbhid_req_set_idle(kbd_dev->hid_dev, IDLE_RATE);552 567 553 568 kbd_dev->initialized = 1; … … 619 634 usbhid_kbd_process_data(kbd_dev, buffer, actual_size); 620 635 621 // disabled for now, no reason to sleep 622 //async_usleep(kbd_dev->hid_dev->poll_interval); 636 async_usleep(kbd_dev->hid_dev->poll_interval); 623 637 } 624 638
Note:
See TracChangeset
for help on using the changeset viewer.