Changeset a1732929 in mainline for uspace/drv/hid/usbhid/usbhid.c
- Timestamp:
- 2018-01-15T17:04:34Z (7 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.