Changeset a1732929 in mainline for uspace/drv/hid
- Timestamp:
- 2018-01-15T17:04:34Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9ff99e8
- Parents:
- c1a966e
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-15 17:04:32)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-15 17:04:34)
- Location:
- uspace/drv/hid/usbhid
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/hid/usbhid/blink1/blink1.c
rc1a966e ra1732929 64 64 usb_blink1_t *blink1_dev = (usb_blink1_t *) ddf_fun_data_get(fun); 65 65 if (blink1_dev == NULL) { 66 usb_log_debug("Missing parameters. \n");66 usb_log_debug("Missing parameters."); 67 67 return EINVAL; 68 68 } … … 105 105 fun_exposed, HID_BLINK1_FUN_NAME); 106 106 if (fun == NULL) { 107 usb_log_error("Could not create DDF function node `%s'. \n",107 usb_log_error("Could not create DDF function node `%s'.", 108 108 HID_BLINK1_FUN_NAME); 109 109 return ENOMEM; … … 123 123 int rc = ddf_fun_bind(fun); 124 124 if (rc != EOK) { 125 usb_log_error("Could not bind DDF function `%s': %s. \n",125 usb_log_error("Could not bind DDF function `%s': %s.", 126 126 ddf_fun_get_name(fun), str_error(rc)); 127 127 ddf_fun_destroy(fun); … … 131 131 rc = ddf_fun_add_to_category(fun, HID_BLINK1_CATEGORY); 132 132 if (rc != EOK) { 133 usb_log_error("Could not add DDF function to category %s: %s. \n",133 usb_log_error("Could not add DDF function to category %s: %s.", 134 134 HID_BLINK1_CATEGORY, str_error(rc)); 135 135 -
uspace/drv/hid/usbhid/generic/hiddev.c
rc1a966e ra1732929 96 96 const usb_hid_dev_t *hid_dev = fun_hid_dev(fun); 97 97 98 usb_log_debug2("hid_dev: %p, Max input report size (%zu). \n",98 usb_log_debug2("hid_dev: %p, Max input report size (%zu).", 99 99 hid_dev, hid_dev->max_input_report_size); 100 100 … … 105 105 size_t size, size_t *act_size, int *event_nr, unsigned int flags) 106 106 { 107 usb_log_debug2("Generic HID: Get event. \n");107 usb_log_debug2("Generic HID: Get event."); 108 108 109 109 if (buffer == NULL || act_size == NULL || event_nr == NULL) { … … 115 115 116 116 if (hid_dev->input_report_size > size) { 117 usb_log_debug("input_report_size > size (%zu, %zu) \n",117 usb_log_debug("input_report_size > size (%zu, %zu)", 118 118 hid_dev->input_report_size, size); 119 119 return EINVAL; // TODO: other error code … … 126 126 *event_nr = usb_hid_report_number(hid_dev); 127 127 128 usb_log_debug2("OK \n");128 usb_log_debug2("OK"); 129 129 130 130 return EOK; … … 133 133 static size_t usb_generic_get_report_descriptor_length(ddf_fun_t *fun) 134 134 { 135 usb_log_debug("Generic HID: Get report descriptor length. \n");136 137 const usb_hid_dev_t *hid_dev = fun_hid_dev(fun); 138 139 usb_log_debug2("hid_dev->report_desc_size = %zu \n",135 usb_log_debug("Generic HID: Get report descriptor length."); 136 137 const usb_hid_dev_t *hid_dev = fun_hid_dev(fun); 138 139 usb_log_debug2("hid_dev->report_desc_size = %zu", 140 140 hid_dev->report_desc_size); 141 141 … … 146 146 size_t size, size_t *actual_size) 147 147 { 148 usb_log_debug2("Generic HID: Get report descriptor. \n");148 usb_log_debug2("Generic HID: Get report descriptor."); 149 149 150 150 const usb_hid_dev_t *hid_dev = fun_hid_dev(fun); … … 162 162 static int usb_generic_hid_client_connected(ddf_fun_t *fun) 163 163 { 164 usb_log_debug("Generic HID: Client connected. \n");164 usb_log_debug("Generic HID: Client connected."); 165 165 return EOK; 166 166 } … … 173 173 174 174 if (ddf_fun_unbind(fun) != EOK) { 175 usb_log_error("Failed to unbind generic hid fun. \n");175 usb_log_error("Failed to unbind generic hid fun."); 176 176 return; 177 177 } 178 usb_log_debug2("%s unbound. \n", ddf_fun_get_name(fun));178 usb_log_debug2("%s unbound.", ddf_fun_get_name(fun)); 179 179 ddf_fun_destroy(fun); 180 180 } … … 189 189 190 190 /* Create the exposed function. */ 191 usb_log_debug("Creating DDF function %s... \n", HID_GENERIC_FUN_NAME);191 usb_log_debug("Creating DDF function %s...", HID_GENERIC_FUN_NAME); 192 192 ddf_fun_t *fun = usb_device_ddf_fun_create(hid_dev->usb_dev, 193 193 fun_exposed, HID_GENERIC_FUN_NAME); 194 194 if (fun == NULL) { 195 usb_log_error("Could not create DDF function node. \n");195 usb_log_error("Could not create DDF function node."); 196 196 return ENOMEM; 197 197 } … … 204 204 int rc = ddf_fun_bind(fun); 205 205 if (rc != EOK) { 206 usb_log_error("Could not bind DDF function: %s. \n",206 usb_log_error("Could not bind DDF function: %s.", 207 207 str_error(rc)); 208 208 ddf_fun_destroy(fun); … … 210 210 } 211 211 212 usb_log_debug("HID function created. Handle: %" PRIun " \n",212 usb_log_debug("HID function created. Handle: %" PRIun "", 213 213 ddf_fun_get_handle(fun)); 214 214 *data = fun; -
uspace/drv/hid/usbhid/kbd/kbddev.c
rc1a966e ra1732929 185 185 if (kbd_dev->client_sess == NULL) { 186 186 kbd_dev->client_sess = sess; 187 usb_log_debug("%s: OK \n", __FUNCTION__);187 usb_log_debug("%s: OK", __FUNCTION__); 188 188 async_answer_0(icallid, EOK); 189 189 } else { 190 usb_log_error("%s: console session already set \n",190 usb_log_error("%s: console session already set", 191 191 __FUNCTION__); 192 192 async_answer_0(icallid, ELIMIT); … … 195 195 } 196 196 default: 197 usb_log_error("%s: Unknown method: %d. \n",197 usb_log_error("%s: Unknown method: %d.", 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: \n");228 usb_log_debug("Creating output report:"); 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 \n",268 usb_log_debug("Output report buffer: %s", 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. \n");278 usb_log_warning("Failed to set kbd indicators."); 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 \n", type, key);291 usb_log_debug2("Sending kbdev event %d/%d to the console", 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. \n");303 usb_log_warning("Failed to send key to console."); 304 304 } 305 305 } … … 353 353 kbd_dev->key_count); 354 354 if (i != (size_t) -1) { 355 usb_log_error("Detected phantom state. \n");355 usb_log_error("Detected phantom state."); 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. \n", key_buffer);405 usb_log_debug2("Stored keys %s.", 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. \n");433 usb_log_error("Failed to create hid/kbd report path."); 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. \n");440 usb_log_error("Failed to append to hid/kbd report path."); 441 441 return; 442 442 } … … 452 452 453 453 while (field != NULL) { 454 usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u) \n",454 usb_log_debug2("FIELD (%p) - VALUE(%d) USAGE(%u)", 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 \n", i, kbd_dev->keys[i]);466 usb_log_debug2("Saved %u. key usage %d", 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. \n");504 usb_log_error("Failed to create kbd report path."); 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. \n");512 usb_log_error("Failed to append item to kbd report path."); 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 \n", kbd_dev->key_count);525 usb_log_debug("Size of the input report: %zu", 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. \n");529 usb_log_error("Failed to allocate key buffer."); 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. \n");536 usb_log_error("Failed to allocate old_key buffer."); 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. \n");546 usb_log_error("Error creating output report buffer."); 547 547 usb_kbd_destroy(kbd_dev); 548 548 return ENOMEM; 549 549 } 550 550 551 usb_log_debug("Output buffer size: %zu \n", kbd_dev->output_size);551 usb_log_debug("Output buffer size: %zu", 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. \n");555 usb_log_error("Failed to create kbd led report path."); 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. \n");563 usb_log_error("Failed to append to kbd/led report path."); 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 \n",571 usb_log_debug("Output report size (in items): %zu", 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. \n");576 usb_log_error("Error creating buffer for LED output report."); 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. \n");590 usb_log_debug("HID/KBD device structure initialized."); 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... \n");620 usb_log_debug("Initializing HID/KBD structure..."); 621 621 622 622 if (hid_dev == NULL) { … … 627 627 628 628 /* Create the exposed function. */ 629 usb_log_debug("Creating DDF function %s... \n", HID_KBD_FUN_NAME);629 usb_log_debug("Creating DDF function %s...", 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. \n");633 usb_log_error("Could not create DDF function node."); 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. \n");639 usb_log_error("Failed to allocate KBD device structure."); 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. \n");646 usb_log_error("Failed to initialize KBD device structure."); 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. \n",657 usb_log_error("Could not bind DDF function: %s.", 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 " \n",664 usb_log_debug("%s function created. Handle: %" PRIun "", 665 665 HID_KBD_FUN_NAME, ddf_fun_get_handle(fun)); 666 666 667 usb_log_debug("Adding DDF function to category %s... \n",667 usb_log_debug("Adding DDF function to category %s...", 668 668 HID_KBD_CATEGORY_NAME); 669 669 ret = ddf_fun_add_to_category(fun, HID_KBD_CATEGORY_NAME); … … 753 753 if (kbd_dev->fun) { 754 754 if (ddf_fun_unbind(kbd_dev->fun) != EOK) { 755 usb_log_warning("Failed to unbind %s. \n",755 usb_log_warning("Failed to unbind %s.", 756 756 ddf_fun_get_name(kbd_dev->fun)); 757 757 } else { 758 usb_log_debug2("%s unbound. \n",758 usb_log_debug2("%s unbound.", 759 759 ddf_fun_get_name(kbd_dev->fun)); 760 760 ddf_fun_destroy(kbd_dev->fun); … … 784 784 785 785 if (rc != EOK) { 786 usb_log_error("Failed to parse boot report descriptor: %s \n",786 usb_log_error("Failed to parse boot report descriptor: %s", 787 787 str_error(rc)); 788 788 return rc; -
uspace/drv/hid/usbhid/kbd/kbdrepeat.c
rc1a966e ra1732929 69 69 unsigned int delay = 0; 70 70 71 usb_log_debug("Starting autorepeat loop. \n");71 usb_log_debug("Starting autorepeat loop."); 72 72 73 73 while (true) { 74 74 /* Check if the kbd structure is usable. */ 75 75 if (!usb_kbd_is_initialized(kbd)) { 76 usb_log_warning("kbd not ready, exiting autorepeat. \n");76 usb_log_warning("kbd not ready, exiting autorepeat."); 77 77 return; 78 78 } … … 82 82 if (kbd->repeat.key_new > 0) { 83 83 if (kbd->repeat.key_new == kbd->repeat.key_repeated) { 84 usb_log_debug2("Repeating key: %u. \n",84 usb_log_debug2("Repeating key: %u.", 85 85 kbd->repeat.key_repeated); 86 86 usb_kbd_push_ev(kbd, KEY_PRESS, … … 88 88 delay = kbd->repeat.delay_between; 89 89 } else { 90 usb_log_debug2("New key to repeat: %u. \n",90 usb_log_debug2("New key to repeat: %u.", 91 91 kbd->repeat.key_new); 92 92 kbd->repeat.key_repeated = kbd->repeat.key_new; … … 95 95 } else { 96 96 if (kbd->repeat.key_repeated > 0) { 97 usb_log_debug2("Stopping to repeat key: %u. \n",97 usb_log_debug2("Stopping to repeat key: %u.", 98 98 kbd->repeat.key_repeated); 99 99 kbd->repeat.key_repeated = 0; … … 119 119 int usb_kbd_repeat_fibril(void *arg) 120 120 { 121 usb_log_debug("Autorepeat fibril spawned. \n");121 usb_log_debug("Autorepeat fibril spawned."); 122 122 123 123 if (arg == NULL) { 124 usb_log_error("No device! \n");124 usb_log_error("No device!"); 125 125 return EINVAL; 126 126 } -
uspace/drv/hid/usbhid/main.c
rc1a966e ra1732929 58 58 static int usb_hid_device_add(usb_device_t *dev) 59 59 { 60 usb_log_debug("%s \n", __FUNCTION__);60 usb_log_debug("%s", __FUNCTION__); 61 61 62 62 if (dev == NULL) { 63 usb_log_error("Wrong parameter given for add_device(). \n");63 usb_log_error("Wrong parameter given for add_device()."); 64 64 return EINVAL; 65 65 } … … 73 73 usb_device_data_alloc(dev, sizeof(usb_hid_dev_t)); 74 74 if (hid_dev == NULL) { 75 usb_log_error("Failed to create USB/HID device structure. \n");75 usb_log_error("Failed to create USB/HID device structure."); 76 76 return ENOMEM; 77 77 } … … 79 79 int rc = usb_hid_init(hid_dev, dev); 80 80 if (rc != EOK) { 81 usb_log_error("Failed to initialize USB/HID device. \n");81 usb_log_error("Failed to initialize USB/HID device."); 82 82 usb_hid_deinit(hid_dev); 83 83 return rc; 84 84 } 85 85 86 usb_log_debug("USB/HID device structure initialized. \n");86 usb_log_debug("USB/HID device structure initialized."); 87 87 88 88 /* Start automated polling function. … … 92 92 93 93 if (rc != EOK) { 94 usb_log_error("Failed to start polling fibril for `%s'. \n",94 usb_log_error("Failed to start polling fibril for `%s'.", 95 95 usb_device_get_name(dev)); 96 96 usb_hid_deinit(hid_dev); … … 99 99 hid_dev->running = true; 100 100 101 usb_log_info("HID device `%s' ready. \n", usb_device_get_name(dev));101 usb_log_info("HID device `%s' ready.", usb_device_get_name(dev)); 102 102 103 103 return EOK; … … 115 115 /* Clean up. */ 116 116 usb_hid_deinit(hid_dev); 117 usb_log_info("%s destruction complete. \n", usb_device_get_name(dev));117 usb_log_info("%s destruction complete.", usb_device_get_name(dev)); 118 118 119 119 return EOK; … … 132 132 assert(hid_dev); 133 133 134 usb_log_info("Device %s removed. \n", usb_device_get_name(dev));134 usb_log_info("Device %s removed.", usb_device_get_name(dev)); 135 135 return join_and_clean(dev); 136 136 } … … 148 148 assert(hid_dev); 149 149 150 usb_log_info("Device %s gone. \n", usb_device_get_name(dev));150 usb_log_info("Device %s gone.", usb_device_get_name(dev)); 151 151 return join_and_clean(dev); 152 152 } -
uspace/drv/hid/usbhid/mouse/mousedev.c
rc1a966e ra1732929 118 118 119 119 if (mouse_dev == NULL) { 120 usb_log_debug("%s: Missing parameters. \n", __FUNCTION__);120 usb_log_debug("%s: Missing parameters.", __FUNCTION__); 121 121 async_answer_0(icallid, EINVAL); 122 122 return; 123 123 } 124 124 125 usb_log_debug("%s: fun->name: %s \n", __FUNCTION__, ddf_fun_get_name(fun));126 usb_log_debug("%s: mouse_sess: %p \n",125 usb_log_debug("%s: fun->name: %s", __FUNCTION__, ddf_fun_get_name(fun)); 126 usb_log_debug("%s: mouse_sess: %p", 127 127 __FUNCTION__, mouse_dev->mouse_sess); 128 128 … … 132 132 if (mouse_dev->mouse_sess == NULL) { 133 133 mouse_dev->mouse_sess = sess; 134 usb_log_debug("Console session to %s set ok (%p). \n",134 usb_log_debug("Console session to %s set ok (%p).", 135 135 ddf_fun_get_name(fun), sess); 136 136 async_answer_0(icallid, EOK); 137 137 } else { 138 usb_log_error("Console session to %s already set. \n",138 usb_log_error("Console session to %s already set.", 139 139 ddf_fun_get_name(fun)); 140 140 async_answer_0(icallid, ELIMIT); … … 142 142 } 143 143 } else { 144 usb_log_debug("%s: Invalid function. \n", __FUNCTION__);144 usb_log_debug("%s: Invalid function.", __FUNCTION__); 145 145 async_answer_0(icallid, EINVAL); 146 146 } … … 171 171 172 172 if (mouse_dev->mouse_sess == NULL) { 173 usb_log_warning(NAME " No console session. \n");173 usb_log_warning(NAME " No console session."); 174 174 return; 175 175 } … … 225 225 usb_hid_report_path_t *path = usb_hid_report_path(); 226 226 if (path == NULL) { 227 usb_log_warning("Failed to create USB HID report path. \n");227 usb_log_warning("Failed to create USB HID report path."); 228 228 return; 229 229 } … … 232 232 if (ret != EOK) { 233 233 usb_hid_report_path_free(path); 234 usb_log_warning("Failed to add buttons to report path. \n");234 usb_log_warning("Failed to add buttons to report path."); 235 235 return; 236 236 } … … 242 242 243 243 while (field != NULL) { 244 usb_log_debug2(NAME " VALUE(%X) USAGE(%X) \n", field->value,244 usb_log_debug2(NAME " VALUE(%X) USAGE(%X)", field->value, 245 245 field->usage); 246 246 assert(field->usage > field->usage_minimum); … … 331 331 332 332 if (mouse_dev->buttons == NULL) { 333 usb_log_error(NAME ": out of memory, giving up on device! \n");333 usb_log_error(NAME ": out of memory, giving up on device!"); 334 334 free(mouse_dev); 335 335 return ENOMEM; … … 344 344 int usb_mouse_init(usb_hid_dev_t *hid_dev, void **data) 345 345 { 346 usb_log_debug("Initializing HID/Mouse structure... \n");346 usb_log_debug("Initializing HID/Mouse structure..."); 347 347 348 348 if (hid_dev == NULL) { … … 353 353 354 354 /* Create the exposed function. */ 355 usb_log_debug("Creating DDF function %s... \n", HID_MOUSE_FUN_NAME);355 usb_log_debug("Creating DDF function %s...", HID_MOUSE_FUN_NAME); 356 356 ddf_fun_t *fun = usb_device_ddf_fun_create(hid_dev->usb_dev, 357 357 fun_exposed, HID_MOUSE_FUN_NAME); 358 358 if (fun == NULL) { 359 usb_log_error("Could not create DDF function node `%s'. \n",359 usb_log_error("Could not create DDF function node `%s'.", 360 360 HID_MOUSE_FUN_NAME); 361 361 return ENOMEM; … … 364 364 usb_mouse_t *mouse_dev = ddf_fun_data_alloc(fun, sizeof(usb_mouse_t)); 365 365 if (mouse_dev == NULL) { 366 usb_log_error("Failed to alloc HID mouse device structure. \n");366 usb_log_error("Failed to alloc HID mouse device structure."); 367 367 ddf_fun_destroy(fun); 368 368 return ENOMEM; … … 371 371 int ret = mouse_dev_init(mouse_dev, hid_dev); 372 372 if (ret != EOK) { 373 usb_log_error("Failed to init HID mouse device structure. \n");373 usb_log_error("Failed to init HID mouse device structure."); 374 374 return ret; 375 375 } … … 379 379 ret = ddf_fun_bind(fun); 380 380 if (ret != EOK) { 381 usb_log_error("Could not bind DDF function `%s': %s. \n",381 usb_log_error("Could not bind DDF function `%s': %s.", 382 382 ddf_fun_get_name(fun), str_error(ret)); 383 383 ddf_fun_destroy(fun); … … 385 385 } 386 386 387 usb_log_debug("Adding DDF function `%s' to category %s... \n",387 usb_log_debug("Adding DDF function `%s' to category %s...", 388 388 ddf_fun_get_name(fun), HID_MOUSE_CATEGORY); 389 389 ret = ddf_fun_add_to_category(fun, HID_MOUSE_CATEGORY); … … 444 444 445 445 if (rc != EOK) { 446 usb_log_error("Failed to parse boot report descriptor: %s \n",446 usb_log_error("Failed to parse boot report descriptor: %s", 447 447 str_error(rc)); 448 448 return rc; -
uspace/drv/hid/usbhid/multimedia/multimedia.c
rc1a966e ra1732929 86 86 ipc_callid_t icallid, ipc_call_t *icall) 87 87 { 88 usb_log_debug(NAME " default_connection_handler() \n");88 usb_log_debug(NAME " default_connection_handler()"); 89 89 90 90 usb_multimedia_t *multim_dev = ddf_fun_data_get(fun); … … 95 95 if (multim_dev->console_sess == NULL) { 96 96 multim_dev->console_sess = sess; 97 usb_log_debug(NAME " Saved session to console: %p \n",97 usb_log_debug(NAME " Saved session to console: %p", 98 98 sess); 99 99 async_answer_0(icallid, EOK); … … 137 137 }; 138 138 139 usb_log_debug2(NAME " Sending key %d to the console \n", ev.key);139 usb_log_debug2(NAME " Sending key %d to the console", ev.key); 140 140 if (multim_dev->console_sess == NULL) { 141 141 usb_log_warning( … … 149 149 async_exchange_end(exch); 150 150 } else { 151 usb_log_warning("Failed to send multimedia key. \n");151 usb_log_warning("Failed to send multimedia key."); 152 152 } 153 153 } … … 159 159 } 160 160 161 usb_log_debug(NAME " Initializing HID/multimedia structure... \n");161 usb_log_debug(NAME " Initializing HID/multimedia structure..."); 162 162 163 163 /* Create the exposed function. */ … … 165 165 hid_dev->usb_dev, fun_exposed, NAME); 166 166 if (fun == NULL) { 167 usb_log_error("Could not create DDF function node. \n");167 usb_log_error("Could not create DDF function node."); 168 168 return ENOMEM; 169 169 } … … 184 184 int rc = ddf_fun_bind(fun); 185 185 if (rc != EOK) { 186 usb_log_error("Could not bind DDF function: %s. \n",186 usb_log_error("Could not bind DDF function: %s.", 187 187 str_error(rc)); 188 188 ddf_fun_destroy(fun); … … 190 190 } 191 191 192 usb_log_debug(NAME " function created (handle: %" PRIun "). \n",192 usb_log_debug(NAME " function created (handle: %" PRIun ").", 193 193 ddf_fun_get_handle(fun)); 194 194 … … 199 199 str_error(rc)); 200 200 if (ddf_fun_unbind(fun) != EOK) { 201 usb_log_error("Failed to unbind %s, won't destroy. \n",201 usb_log_error("Failed to unbind %s, won't destroy.", 202 202 ddf_fun_get_name(fun)); 203 203 } else { … … 210 210 *data = fun; 211 211 212 usb_log_debug(NAME " HID/multimedia structure initialized. \n");212 usb_log_debug(NAME " HID/multimedia structure initialized."); 213 213 return EOK; 214 214 } … … 224 224 async_hangup(multim_dev->console_sess); 225 225 if (ddf_fun_unbind(fun) != EOK) { 226 usb_log_error("Failed to unbind %s, won't destroy. \n",226 usb_log_error("Failed to unbind %s, won't destroy.", 227 227 ddf_fun_get_name(fun)); 228 228 } else { 229 usb_log_debug2("%s unbound. \n", ddf_fun_get_name(fun));229 usb_log_debug2("%s unbound.", ddf_fun_get_name(fun)); 230 230 /* This frees multim_dev too as it was stored in 231 231 * fun->data */ … … 266 266 while (field != NULL) { 267 267 if (field->value != 0) { 268 usb_log_debug(NAME " KEY VALUE(%X) USAGE(%X) \n",268 usb_log_debug(NAME " KEY VALUE(%X) USAGE(%X)", 269 269 field->value, field->usage); 270 270 const unsigned key = … … 272 272 const char *key_str = 273 273 usbhid_multimedia_usage_to_str(field->usage); 274 usb_log_info("Pressed key: %s \n", key_str);274 usb_log_info("Pressed key: %s", key_str); 275 275 usb_multimedia_push_ev(multim_dev, KEY_PRESS, key); 276 276 } -
uspace/drv/hid/usbhid/usbhid.c
rc1a966e ra1732929 134 134 usb_hid_report_path_t *usage_path = usb_hid_report_path(); 135 135 if (usage_path == NULL) { 136 usb_log_debug("Failed to create usage path. \n");136 usb_log_debug("Failed to create usage path."); 137 137 return false; 138 138 } … … 143 143 mapping->usage_path[i].usage_page, 144 144 mapping->usage_path[i].usage) != EOK) { 145 usb_log_debug("Failed to append to usage path. \n");145 usb_log_debug("Failed to append to usage path."); 146 146 usb_hid_report_path_free(usage_path); 147 147 return false; … … 149 149 } 150 150 151 usb_log_debug("Compare flags: %d \n", mapping->compare);151 usb_log_debug("Compare flags: %d", mapping->compare); 152 152 153 153 bool matches = false; … … 155 155 156 156 do { 157 usb_log_debug("Trying report id %u \n", report_id);157 usb_log_debug("Trying report id %u", report_id); 158 158 if (report_id != 0) { 159 159 usb_hid_report_path_set_report_id(usage_path, … … 166 166 USB_HID_REPORT_TYPE_INPUT); 167 167 168 usb_log_debug("Field: %p \n", field);168 usb_log_debug("Field: %p", field); 169 169 170 170 if (field != NULL) { … … 243 243 mapping->product_id); 244 244 if (usb_hid_ids_match(hid_dev, mapping)) { 245 usb_log_debug("IDs matched. \n");245 usb_log_debug("IDs matched."); 246 246 matched = true; 247 247 } … … 250 250 /* Check usage match. */ 251 251 if (mapping->usage_path != NULL) { 252 usb_log_debug("Comparing device against usage path. \n");252 usb_log_debug("Comparing device against usage path."); 253 253 if (usb_hid_path_matches(hid_dev, mapping)) { 254 254 /* Does not matter if IDs were matched. */ … … 258 258 259 259 if (matched) { 260 usb_log_debug("Subdriver matched. \n");260 usb_log_debug("Subdriver matched."); 261 261 subdrivers[count++] = &mapping->subdriver; 262 262 } … … 285 285 usb_device_get_mapped_ep_desc(dev, endpoints[i].desc); 286 286 if (epm && epm->present) { 287 usb_log_debug("Found: %s. \n", endpoints[i].description);287 usb_log_debug("Found: %s.", endpoints[i].description); 288 288 hid_dev->poll_pipe_mapping = epm; 289 289 return EOK; … … 301 301 302 302 do { 303 usb_log_debug("Getting size of the report. \n");303 usb_log_debug("Getting size of the report."); 304 304 const size_t size = 305 305 usb_hid_report_byte_size(&hid_dev->report, report_id, 306 306 USB_HID_REPORT_TYPE_INPUT); 307 usb_log_debug("Report ID: %u, size: %zu \n", report_id, size);307 usb_log_debug("Report ID: %u, size: %zu", report_id, size); 308 308 max_size = (size > max_size) ? size : max_size; 309 usb_log_debug("Getting next report ID \n");309 usb_log_debug("Getting next report ID"); 310 310 report_id = usb_hid_get_next_report_id(&hid_dev->report, 311 311 report_id, USB_HID_REPORT_TYPE_INPUT); 312 312 } while (report_id != 0); 313 313 314 usb_log_debug("Max size of input report: %zu \n", max_size);314 usb_log_debug("Max size of input report: %zu", max_size); 315 315 316 316 assert(hid_dev->input_report == NULL); … … 329 329 { 330 330 if (dev == NULL || arg == NULL || buffer == NULL) { 331 usb_log_error("Missing arguments to polling callback. \n");331 usb_log_error("Missing arguments to polling callback."); 332 332 return false; 333 333 } … … 336 336 assert(hid_dev->input_report != NULL); 337 337 338 usb_log_debug("New data [%zu/%zu]: %s \n", buffer_size,338 usb_log_debug("New data [%zu/%zu]: %s", buffer_size, 339 339 hid_dev->max_input_report_size, 340 340 usb_debug_str_buffer(buffer, buffer_size, 0)); … … 419 419 assert(dev); 420 420 421 usb_log_debug("Initializing HID structure... \n");421 usb_log_debug("Initializing HID structure..."); 422 422 423 423 usb_hid_report_init(&hid_dev->report); … … 441 441 usb_hid_find_subdrivers(hid_dev); 442 442 } else { 443 usb_log_error("Failed to parse report descriptor: fallback. \n");443 usb_log_error("Failed to parse report descriptor: fallback."); 444 444 hid_dev->subdrivers = NULL; 445 445 hid_dev->subdriver_count = 0; 446 446 } 447 447 448 usb_log_debug("Subdriver count(before trying boot protocol): %d \n",448 usb_log_debug("Subdriver count(before trying boot protocol): %d", 449 449 hid_dev->subdriver_count); 450 450 … … 457 457 switch (hid_dev->poll_pipe_mapping->interface->interface_protocol) { 458 458 case USB_HID_PROTOCOL_KEYBOARD: 459 usb_log_info("Falling back to kbd boot protocol. \n");459 usb_log_info("Falling back to kbd boot protocol."); 460 460 rc = usb_kbd_set_boot_protocol(hid_dev); 461 461 if (rc == EOK) { … … 464 464 break; 465 465 case USB_HID_PROTOCOL_MOUSE: 466 usb_log_info("Falling back to mouse boot protocol. \n");466 usb_log_info("Falling back to mouse boot protocol."); 467 467 rc = usb_mouse_set_boot_protocol(hid_dev); 468 468 if (rc == EOK) { … … 471 471 break; 472 472 default: 473 usb_log_info("Falling back to generic HID driver. \n");473 usb_log_info("Falling back to generic HID driver."); 474 474 usb_hid_set_generic_hid_subdriver(hid_dev); 475 475 } 476 476 } 477 477 478 usb_log_debug("Subdriver count(after trying boot protocol): %d \n",478 usb_log_debug("Subdriver count(after trying boot protocol): %d", 479 479 hid_dev->subdriver_count); 480 480 … … 491 491 for (unsigned i = 0; i < hid_dev->subdriver_count; ++i) { 492 492 if (hid_dev->subdrivers[i].init != NULL) { 493 usb_log_debug("Initializing subdriver %d. \n",i);493 usb_log_debug("Initializing subdriver %d.",i); 494 494 const int pret = hid_dev->subdrivers[i].init(hid_dev, 495 495 &hid_dev->subdrivers[i].data); … … 514 514 rc = usb_hid_init_report(hid_dev); 515 515 if (rc != EOK) { 516 usb_log_error("Failed to initialize input report buffer: %s \n", str_error(rc));516 usb_log_error("Failed to initialize input report buffer: %s", str_error(rc)); 517 517 // FIXME: What happens now? 518 518 } … … 520 520 usb_polling_t *polling = &hid_dev->polling; 521 521 if ((rc = usb_polling_init(polling))) { 522 usb_log_error("Failed to initialize polling: %s \n", str_error(rc));522 usb_log_error("Failed to initialize polling: %s", str_error(rc)); 523 523 // FIXME: What happens now? 524 524 } … … 555 555 usb_polling_fini(&hid_dev->polling); 556 556 557 usb_log_debug("Subdrivers: %p, subdriver count: %d \n",557 usb_log_debug("Subdrivers: %p, subdriver count: %d", 558 558 hid_dev->subdrivers, hid_dev->subdriver_count); 559 559
Note:
See TracChangeset
for help on using the changeset viewer.