Changes in uspace/drv/hid/usbhid/kbd/kbddev.c [a1732929:53b9f2c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/hid/usbhid/kbd/kbddev.c
ra1732929 r53b9f2c 185 185 if (kbd_dev->client_sess == NULL) { 186 186 kbd_dev->client_sess = sess; 187 usb_log_debug("%s: OK ", __FUNCTION__);187 usb_log_debug("%s: OK\n", __FUNCTION__); 188 188 async_answer_0(icallid, EOK); 189 189 } else { 190 usb_log_error("%s: console session already set ",190 usb_log_error("%s: console session already set\n", 191 191 __FUNCTION__); 192 192 async_answer_0(icallid, ELIMIT); … … 195 195 } 196 196 default: 197 usb_log_error("%s: Unknown method: %d. ",197 usb_log_error("%s: Unknown method: %d.\n", 198 198 __FUNCTION__, (int) method); 199 199 async_answer_0(icallid, EINVAL); … … 226 226 /* Reset the LED data. */ 227 227 memset(kbd_dev->led_data, 0, kbd_dev->led_output_size * sizeof(int32_t)); 228 usb_log_debug("Creating output report: ");228 usb_log_debug("Creating output report:\n"); 229 229 230 230 usb_hid_report_field_t *field = usb_hid_report_get_sibling( … … 266 266 } 267 267 268 usb_log_debug("Output report buffer: %s ",268 usb_log_debug("Output report buffer: %s\n", 269 269 usb_debug_str_buffer(kbd_dev->output_buffer, kbd_dev->output_size, 270 270 0)); … … 276 276 kbd_dev->output_buffer, kbd_dev->output_size); 277 277 if (rc != EOK) { 278 usb_log_warning("Failed to set kbd indicators. ");278 usb_log_warning("Failed to set kbd indicators.\n"); 279 279 } 280 280 } … … 289 289 void usb_kbd_push_ev(usb_kbd_t *kbd_dev, int type, unsigned key) 290 290 { 291 usb_log_debug2("Sending kbdev event %d/%d to the console ", type, key);291 usb_log_debug2("Sending kbdev event %d/%d to the console\n", type, key); 292 292 if (kbd_dev->client_sess == NULL) { 293 293 usb_log_warning( … … 301 301 async_exchange_end(exch); 302 302 } else { 303 usb_log_warning("Failed to send key to console. ");303 usb_log_warning("Failed to send key to console.\n"); 304 304 } 305 305 } … … 328 328 * An event is created only when key is pressed or released. Besides handling 329 329 * the events (usb_kbd_push_ev()), the auto-repeat fibril is notified about 330 * key presses and releases (see usb_kbd_repeat_start() and 330 * key presses and releases (see usb_kbd_repeat_start() and 331 331 * usb_kbd_repeat_stop()). 332 332 * 333 333 * @param kbd_dev Keyboard device structure. 334 * @param key_codes Parsed keyboard report - codes of currently pressed keys 334 * @param key_codes Parsed keyboard report - codes of currently pressed keys 335 335 * according to HID Usage Tables. 336 336 * @param count Number of key codes in report (size of the report). … … 353 353 kbd_dev->key_count); 354 354 if (i != (size_t) -1) { 355 usb_log_error("Detected phantom state. ");355 usb_log_error("Detected phantom state.\n"); 356 356 return; 357 357 } … … 403 403 ddf_dump_buffer(key_buffer, 512, 404 404 kbd_dev->keys_old, 4, kbd_dev->key_count, 0); 405 usb_log_debug2("Stored keys %s. ", key_buffer);405 usb_log_debug2("Stored keys %s.\n", key_buffer); 406 406 } 407 407 … … 431 431 usb_hid_report_path_t *path = usb_hid_report_path(); 432 432 if (path == NULL) { 433 usb_log_error("Failed to create hid/kbd report path. ");433 usb_log_error("Failed to create hid/kbd report path.\n"); 434 434 return; 435 435 } … … 438 438 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0); 439 439 if (ret != EOK) { 440 usb_log_error("Failed to append to hid/kbd report path. ");440 usb_log_error("Failed to append to hid/kbd report path.\n"); 441 441 return; 442 442 } … … 452 452 453 453 while (field != NULL) { 454 usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u) ",454 usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u)\n", 455 455 field, field->value, field->usage); 456 456 … … 464 464 kbd_dev->keys[i] = 0; 465 465 } 466 usb_log_debug2("Saved %u. key usage %d ", i, kbd_dev->keys[i]);466 usb_log_debug2("Saved %u. key usage %d\n", i, kbd_dev->keys[i]); 467 467 468 468 ++i; … … 502 502 usb_hid_report_path_t *path = usb_hid_report_path(); 503 503 if (path == NULL) { 504 usb_log_error("Failed to create kbd report path. ");504 usb_log_error("Failed to create kbd report path.\n"); 505 505 usb_kbd_destroy(kbd_dev); 506 506 return ENOMEM; … … 510 510 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0); 511 511 if (ret != EOK) { 512 usb_log_error("Failed to append item to kbd report path. ");512 usb_log_error("Failed to append item to kbd report path.\n"); 513 513 usb_hid_report_path_free(path); 514 514 usb_kbd_destroy(kbd_dev); … … 523 523 usb_hid_report_path_free(path); 524 524 525 usb_log_debug("Size of the input report: %zu ", kbd_dev->key_count);525 usb_log_debug("Size of the input report: %zu\n", kbd_dev->key_count); 526 526 527 527 kbd_dev->keys = calloc(kbd_dev->key_count, sizeof(int32_t)); 528 528 if (kbd_dev->keys == NULL) { 529 usb_log_error("Failed to allocate key buffer. ");529 usb_log_error("Failed to allocate key buffer.\n"); 530 530 usb_kbd_destroy(kbd_dev); 531 531 return ENOMEM; … … 534 534 kbd_dev->keys_old = calloc(kbd_dev->key_count, sizeof(int32_t)); 535 535 if (kbd_dev->keys_old == NULL) { 536 usb_log_error("Failed to allocate old_key buffer. ");536 usb_log_error("Failed to allocate old_key buffer.\n"); 537 537 usb_kbd_destroy(kbd_dev); 538 538 return ENOMEM; … … 544 544 &kbd_dev->output_size, 0); 545 545 if (kbd_dev->output_buffer == NULL) { 546 usb_log_error("Error creating output report buffer. ");546 usb_log_error("Error creating output report buffer.\n"); 547 547 usb_kbd_destroy(kbd_dev); 548 548 return ENOMEM; 549 549 } 550 550 551 usb_log_debug("Output buffer size: %zu ", kbd_dev->output_size);551 usb_log_debug("Output buffer size: %zu\n", kbd_dev->output_size); 552 552 553 553 kbd_dev->led_path = usb_hid_report_path(); 554 554 if (kbd_dev->led_path == NULL) { 555 usb_log_error("Failed to create kbd led report path. ");555 usb_log_error("Failed to create kbd led report path.\n"); 556 556 usb_kbd_destroy(kbd_dev); 557 557 return ENOMEM; … … 561 561 kbd_dev->led_path, USB_HIDUT_PAGE_LED, 0); 562 562 if (ret != EOK) { 563 usb_log_error("Failed to append to kbd/led report path. ");563 usb_log_error("Failed to append to kbd/led report path.\n"); 564 564 usb_kbd_destroy(kbd_dev); 565 565 return ret; … … 569 569 &hid_dev->report, 0, USB_HID_REPORT_TYPE_OUTPUT); 570 570 571 usb_log_debug("Output report size (in items): %zu ",571 usb_log_debug("Output report size (in items): %zu\n", 572 572 kbd_dev->led_output_size); 573 573 574 574 kbd_dev->led_data = calloc(kbd_dev->led_output_size, sizeof(int32_t)); 575 575 if (kbd_dev->led_data == NULL) { 576 usb_log_error("Error creating buffer for LED output report. ");576 usb_log_error("Error creating buffer for LED output report.\n"); 577 577 usb_kbd_destroy(kbd_dev); 578 578 return ENOMEM; … … 588 588 589 589 kbd_dev->initialized = USB_KBD_STATUS_INITIALIZED; 590 usb_log_debug("HID/KBD device structure initialized. ");590 usb_log_debug("HID/KBD device structure initialized.\n"); 591 591 592 592 return EOK; … … 618 618 int usb_kbd_init(usb_hid_dev_t *hid_dev, void **data) 619 619 { 620 usb_log_debug("Initializing HID/KBD structure... ");620 usb_log_debug("Initializing HID/KBD structure...\n"); 621 621 622 622 if (hid_dev == NULL) { … … 627 627 628 628 /* Create the exposed function. */ 629 usb_log_debug("Creating DDF function %s... ", HID_KBD_FUN_NAME);629 usb_log_debug("Creating DDF function %s...\n", HID_KBD_FUN_NAME); 630 630 ddf_fun_t *fun = usb_device_ddf_fun_create(hid_dev->usb_dev, 631 631 fun_exposed, HID_KBD_FUN_NAME); 632 632 if (fun == NULL) { 633 usb_log_error("Could not create DDF function node. ");633 usb_log_error("Could not create DDF function node.\n"); 634 634 return ENOMEM; 635 635 } … … 637 637 usb_kbd_t *kbd_dev = ddf_fun_data_alloc(fun, sizeof(usb_kbd_t)); 638 638 if (kbd_dev == NULL) { 639 usb_log_error("Failed to allocate KBD device structure. ");639 usb_log_error("Failed to allocate KBD device structure.\n"); 640 640 ddf_fun_destroy(fun); 641 641 return ENOMEM; … … 644 644 int ret = kbd_dev_init(kbd_dev, hid_dev); 645 645 if (ret != EOK) { 646 usb_log_error("Failed to initialize KBD device structure. ");646 usb_log_error("Failed to initialize KBD device structure.\n"); 647 647 ddf_fun_destroy(fun); 648 648 return ret; … … 655 655 ret = ddf_fun_bind(fun); 656 656 if (ret != EOK) { 657 usb_log_error("Could not bind DDF function: %s. ",657 usb_log_error("Could not bind DDF function: %s.\n", 658 658 str_error(ret)); 659 659 usb_kbd_destroy(kbd_dev); … … 662 662 } 663 663 664 usb_log_debug("%s function created. Handle: %" PRIun " ",664 usb_log_debug("%s function created. Handle: %" PRIun "\n", 665 665 HID_KBD_FUN_NAME, ddf_fun_get_handle(fun)); 666 666 667 usb_log_debug("Adding DDF function to category %s... ",667 usb_log_debug("Adding DDF function to category %s...\n", 668 668 HID_KBD_CATEGORY_NAME); 669 669 ret = ddf_fun_add_to_category(fun, HID_KBD_CATEGORY_NAME); … … 709 709 usb_kbd_process_data(hid_dev, kbd_dev); 710 710 711 /* Continue polling until the device is about to be removed. */712 711 return true; 713 712 } … … 753 752 if (kbd_dev->fun) { 754 753 if (ddf_fun_unbind(kbd_dev->fun) != EOK) { 755 usb_log_warning("Failed to unbind %s. ",754 usb_log_warning("Failed to unbind %s.\n", 756 755 ddf_fun_get_name(kbd_dev->fun)); 757 756 } else { 758 usb_log_debug2("%s unbound. ",757 usb_log_debug2("%s unbound.\n", 759 758 ddf_fun_get_name(kbd_dev->fun)); 760 759 ddf_fun_destroy(kbd_dev->fun); … … 784 783 785 784 if (rc != EOK) { 786 usb_log_error("Failed to parse boot report descriptor: %s ",785 usb_log_error("Failed to parse boot report descriptor: %s\n", 787 786 str_error(rc)); 788 787 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.