Changeset 8961c22 in mainline for uspace/drv
- Timestamp:
- 2011-04-09T08:35:58Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1e1b1a9
- Parents:
- 3e490eb (diff), 61727bf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/drv
- Files:
-
- 17 added
- 10 edited
-
ohci/root_hub.c (modified) (2 diffs)
-
uhci-hcd/batch.c (modified) (4 diffs)
-
uhci-hcd/batch.h (modified) (1 diff)
-
uhci-hcd/hc.c (modified) (2 diffs)
-
uhci-hcd/iface.c (modified) (7 diffs)
-
uhci-hcd/transfer_list.c (modified) (3 diffs)
-
uhci-rhd/root_hub.h (modified) (1 diff)
-
usbhid/Makefile (added)
-
usbhid/generic/hiddev.c (added)
-
usbhid/generic/hiddev.h (added)
-
usbhid/kbd.h (added)
-
usbhid/kbd/conv.c (added)
-
usbhid/kbd/conv.h (added)
-
usbhid/kbd/kbddev.c (added)
-
usbhid/kbd/kbddev.h (added)
-
usbhid/kbd/kbdrepeat.c (added)
-
usbhid/kbd/kbdrepeat.h (added)
-
usbhid/kbd/layout.h (added)
-
usbhid/kbd/main.c (added)
-
usbhid/layout.h (added)
-
usbhid/main.c (added)
-
usbhid/usbhid.c (added)
-
usbhid/usbhid.h (added)
-
usbhid/usbhid.ma (added)
-
usbkbd/kbddev.c (modified) (9 diffs)
-
usbkbd/main.c (modified) (6 diffs)
-
usbkbd/usbkbd.ma (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/root_hub.c
r3e490eb r8961c22 249 249 opResult = EINVAL; 250 250 } 251 usb_transfer_batch_finish (request, opResult);251 usb_transfer_batch_finish_error(request, opResult); 252 252 return EOK; 253 253 } … … 863 863 } 864 864 865 866 867 868 865 /** 869 866 * @} -
uspace/drv/uhci-hcd/batch.c
r3e490eb r8961c22 80 80 * transaction and callback. 81 81 */ 82 usb_transfer_batch_t * batch_get(ddf_fun_t *fun, usb_target_t target, 83 usb_transfer_type_t transfer_type, size_t max_packet_size, 84 usb_speed_t speed, char *buffer, size_t buffer_size, 85 char* setup_buffer, size_t setup_size, 82 usb_transfer_batch_t * batch_get(ddf_fun_t *fun, endpoint_t *ep, 83 char *buffer, size_t buffer_size, char* setup_buffer, size_t setup_size, 86 84 usbhc_iface_transfer_in_callback_t func_in, 87 usbhc_iface_transfer_out_callback_t func_out, void *arg , endpoint_t *ep88 ) 89 { 85 usbhc_iface_transfer_out_callback_t func_out, void *arg) 86 { 87 assert(ep); 90 88 assert(func_in == NULL || func_out == NULL); 91 89 assert(func_in != NULL || func_out != NULL); … … 103 101 CHECK_NULL_DISPOSE_RETURN(instance, 104 102 "Failed to allocate batch instance.\n"); 103 usb_target_t target = 104 { .address = ep->address, .endpoint = ep->endpoint }; 105 105 usb_transfer_batch_init(instance, target, 106 transfer_type, speed,max_packet_size,106 ep->transfer_type, ep->speed, ep->max_packet_size, 107 107 buffer, NULL, buffer_size, NULL, setup_size, func_in, 108 108 func_out, arg, fun, ep, NULL); … … 115 115 instance->private_data = data; 116 116 117 data->transfers = (buffer_size + max_packet_size - 1) / max_packet_size; 118 if (transfer_type == USB_TRANSFER_CONTROL) { 117 data->transfers = 118 (buffer_size + ep->max_packet_size - 1) / ep->max_packet_size; 119 if (ep->transfer_type == USB_TRANSFER_CONTROL) { 119 120 data->transfers += 2; 120 121 } … … 178 179 instance, i, data->tds[i].status); 179 180 td_print_status(&data->tds[i]); 180 if (instance->ep != NULL) 181 endpoint_toggle_set(instance->ep, 182 td_toggle(&data->tds[i])); 181 assert(instance->ep != NULL); 182 183 endpoint_toggle_set(instance->ep, 184 td_toggle(&data->tds[i])); 183 185 if (i > 0) 184 186 goto substract_ret; -
uspace/drv/uhci-hcd/batch.h
r3e490eb r8961c22 44 44 45 45 usb_transfer_batch_t * batch_get( 46 ddf_fun_t *fun, 47 usb_target_t target, 48 usb_transfer_type_t transfer_type, 49 size_t max_packet_size, 50 usb_speed_t speed, 51 char *buffer, 52 size_t size, 53 char *setup_buffer, 54 size_t setup_size, 46 ddf_fun_t *fun, endpoint_t *ep, char *buffer, size_t size, 47 char *setup_buffer, size_t setup_size, 55 48 usbhc_iface_transfer_in_callback_t func_in, 56 49 usbhc_iface_transfer_out_callback_t func_out, 57 void *arg, 58 endpoint_t *ep 59 ); 50 void *arg); 60 51 61 52 void batch_dispose(usb_transfer_batch_t *instance); -
uspace/drv/uhci-hcd/hc.c
r3e490eb r8961c22 332 332 instance->transfers[batch->speed][batch->transfer_type]; 333 333 assert(list); 334 if (batch->transfer_type == USB_TRANSFER_CONTROL) {335 usb_device_keeper_use_control(336 &instance->manager, batch->target);337 }338 334 transfer_list_add_batch(list, batch); 339 335 … … 373 369 usb_transfer_batch_t *batch = 374 370 list_get_instance(item, usb_transfer_batch_t, link); 375 switch (batch->transfer_type) 376 { 377 case USB_TRANSFER_CONTROL: 378 usb_device_keeper_release_control( 379 &instance->manager, batch->target); 380 break; 381 case USB_TRANSFER_INTERRUPT: 382 case USB_TRANSFER_ISOCHRONOUS: { 383 /* 384 int ret = bandwidth_free(&instance->bandwidth, 385 batch->target.address, 386 batch->target.endpoint, 387 batch->direction); 388 if (ret != EOK) 389 usb_log_warning("Failed(%d) to free " 390 "reserved bw: %s.\n", ret, 391 str_error(ret)); 392 */ 393 } 394 default: 395 break; 396 } 397 batch->next_step(batch); 371 usb_transfer_batch_finish(batch); 398 372 } 399 373 } -
uspace/drv/uhci-hcd/iface.c
r3e490eb r8961c22 40 40 #include "iface.h" 41 41 #include "hc.h" 42 43 static inline int setup_batch( 44 ddf_fun_t *fun, usb_target_t target, usb_direction_t direction, 45 void *data, size_t size, void * setup_data, size_t setup_size, 46 usbhc_iface_transfer_in_callback_t in, 47 usbhc_iface_transfer_out_callback_t out, void *arg, const char* name, 48 hc_t **hc, usb_transfer_batch_t **batch) 49 { 50 assert(hc); 51 assert(batch); 52 assert(fun); 53 *hc = fun_to_hc(fun); 54 assert(*hc); 55 56 size_t res_bw; 57 endpoint_t *ep = usb_endpoint_manager_get_ep(&(*hc)->ep_manager, 58 target.address, target.endpoint, direction, &res_bw); 59 if (ep == NULL) { 60 usb_log_error("Endpoint(%d:%d) not registered for %s.\n", 61 target.address, target.endpoint, name); 62 return ENOENT; 63 } 64 65 const size_t bw = bandwidth_count_usb11( 66 ep->speed, ep->transfer_type, size, ep->max_packet_size); 67 if (res_bw < bw) { 68 usb_log_error("Endpoint(%d:%d) %s needs %zu bw " 69 "but only %zu is reserved.\n", 70 name, target.address, target.endpoint, bw, res_bw); 71 return ENOSPC; 72 } 73 usb_log_debug("%s %d:%d %zu(%zu).\n", 74 name, target.address, target.endpoint, size, ep->max_packet_size); 75 76 assert(ep->speed == 77 usb_device_keeper_get_speed(&(*hc)->manager, target.address)); 78 // assert(ep->max_packet_size == max_packet_size); 79 // assert(ep->transfer_type == USB_TRANSFER_CONTROL); 80 81 *batch = 82 batch_get(fun, ep, data, size, setup_data, setup_size, 83 in, out, arg); 84 if (!batch) 85 return ENOMEM; 86 return EOK; 87 } 88 42 89 43 90 /** Reserve default address interface function … … 215 262 size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg) 216 263 { 217 assert(fun); 218 hc_t *hc = fun_to_hc(fun); 219 assert(hc); 220 221 usb_log_debug("Interrupt OUT %d:%d %zu(%zu).\n", 222 target.address, target.endpoint, size, max_packet_size); 223 224 size_t res_bw; 225 endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager, 226 target.address, target.endpoint, USB_DIRECTION_OUT, &res_bw); 227 if (ep == NULL) { 228 usb_log_error("Endpoint(%d:%d) not registered for INT OUT.\n", 229 target.address, target.endpoint); 230 return ENOENT; 231 } 232 const size_t bw = bandwidth_count_usb11(ep->speed, ep->transfer_type, 233 size, ep->max_packet_size); 234 if (res_bw < bw) 235 { 236 usb_log_error("Endpoint(%d:%d) INT IN needs %zu bw " 237 "but only %zu is reserved.\n", 238 target.address, target.endpoint, bw, res_bw); 239 return ENOENT; 240 } 241 assert(ep->speed == 242 usb_device_keeper_get_speed(&hc->manager, target.address)); 243 assert(ep->max_packet_size == max_packet_size); 244 assert(ep->transfer_type == USB_TRANSFER_INTERRUPT); 245 246 usb_transfer_batch_t *batch = 247 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, 248 ep->speed, data, size, NULL, 0, NULL, callback, arg, ep); 249 if (!batch) 250 return ENOMEM; 264 usb_transfer_batch_t *batch = NULL; 265 hc_t *hc = NULL; 266 int ret = setup_batch(fun, target, USB_DIRECTION_OUT, data, size, 267 NULL, 0, NULL, callback, arg, "Interrupt OUT", &hc, &batch); 268 if (ret != EOK) 269 return ret; 251 270 batch_interrupt_out(batch); 252 const intret = hc_schedule(hc, batch);271 ret = hc_schedule(hc, batch); 253 272 if (ret != EOK) { 254 273 batch_dispose(batch); … … 272 291 size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg) 273 292 { 274 assert(fun); 275 hc_t *hc = fun_to_hc(fun); 276 assert(hc); 277 278 usb_log_debug("Interrupt IN %d:%d %zu(%zu).\n", 279 target.address, target.endpoint, size, max_packet_size); 280 281 size_t res_bw; 282 endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager, 283 target.address, target.endpoint, USB_DIRECTION_IN, &res_bw); 284 if (ep == NULL) { 285 usb_log_error("Endpoint(%d:%d) not registered for INT IN.\n", 286 target.address, target.endpoint); 287 return ENOENT; 288 } 289 const size_t bw = bandwidth_count_usb11(ep->speed, ep->transfer_type, 290 size, ep->max_packet_size); 291 if (res_bw < bw) 292 { 293 usb_log_error("Endpoint(%d:%d) INT IN needs %zu bw " 294 "but only %zu bw is reserved.\n", 295 target.address, target.endpoint, bw, res_bw); 296 return ENOENT; 297 } 298 299 assert(ep->speed == 300 usb_device_keeper_get_speed(&hc->manager, target.address)); 301 assert(ep->max_packet_size == max_packet_size); 302 assert(ep->transfer_type == USB_TRANSFER_INTERRUPT); 303 304 usb_transfer_batch_t *batch = 305 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, 306 ep->speed, data, size, NULL, 0, callback, NULL, arg, ep); 307 if (!batch) 308 return ENOMEM; 293 usb_transfer_batch_t *batch = NULL; 294 hc_t *hc = NULL; 295 int ret = setup_batch(fun, target, USB_DIRECTION_IN, data, size, 296 NULL, 0, callback, NULL, arg, "Interrupt IN", &hc, &batch); 297 if (ret != EOK) 298 return ret; 309 299 batch_interrupt_in(batch); 310 const intret = hc_schedule(hc, batch);300 ret = hc_schedule(hc, batch); 311 301 if (ret != EOK) { 312 302 batch_dispose(batch); … … 330 320 size_t size, usbhc_iface_transfer_out_callback_t callback, void *arg) 331 321 { 332 assert(fun); 333 hc_t *hc = fun_to_hc(fun); 334 assert(hc); 335 336 usb_log_debug("Bulk OUT %d:%d %zu(%zu).\n", 337 target.address, target.endpoint, size, max_packet_size); 338 339 endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager, 340 target.address, target.endpoint, USB_DIRECTION_OUT, NULL); 341 if (ep == NULL) { 342 usb_log_error("Endpoint(%d:%d) not registered for BULK OUT.\n", 343 target.address, target.endpoint); 344 return ENOENT; 345 } 346 assert(ep->speed == 347 usb_device_keeper_get_speed(&hc->manager, target.address)); 348 assert(ep->max_packet_size == max_packet_size); 349 assert(ep->transfer_type == USB_TRANSFER_BULK); 350 351 usb_transfer_batch_t *batch = 352 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, 353 ep->speed, data, size, NULL, 0, NULL, callback, arg, ep); 354 if (!batch) 355 return ENOMEM; 322 usb_transfer_batch_t *batch = NULL; 323 hc_t *hc = NULL; 324 int ret = setup_batch(fun, target, USB_DIRECTION_OUT, data, size, 325 NULL, 0, NULL, callback, arg, "Bulk OUT", &hc, &batch); 326 if (ret != EOK) 327 return ret; 356 328 batch_bulk_out(batch); 357 const intret = hc_schedule(hc, batch);329 ret = hc_schedule(hc, batch); 358 330 if (ret != EOK) { 359 331 batch_dispose(batch); … … 377 349 size_t size, usbhc_iface_transfer_in_callback_t callback, void *arg) 378 350 { 379 assert(fun); 380 hc_t *hc = fun_to_hc(fun); 381 assert(hc); 382 usb_log_debug("Bulk IN %d:%d %zu(%zu).\n", 383 target.address, target.endpoint, size, max_packet_size); 384 385 endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager, 386 target.address, target.endpoint, USB_DIRECTION_IN, NULL); 387 if (ep == NULL) { 388 usb_log_error("Endpoint(%d:%d) not registered for BULK IN.\n", 389 target.address, target.endpoint); 390 return ENOENT; 391 } 392 assert(ep->speed == 393 usb_device_keeper_get_speed(&hc->manager, target.address)); 394 assert(ep->max_packet_size == max_packet_size); 395 assert(ep->transfer_type == USB_TRANSFER_BULK); 396 397 usb_transfer_batch_t *batch = 398 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, 399 ep->speed, data, size, NULL, 0, callback, NULL, arg, ep); 400 if (!batch) 401 return ENOMEM; 351 usb_transfer_batch_t *batch = NULL; 352 hc_t *hc = NULL; 353 int ret = setup_batch(fun, target, USB_DIRECTION_IN, data, size, 354 NULL, 0, callback, NULL, arg, "Bulk IN", &hc, &batch); 355 if (ret != EOK) 356 return ret; 402 357 batch_bulk_in(batch); 403 const intret = hc_schedule(hc, batch);358 ret = hc_schedule(hc, batch); 404 359 if (ret != EOK) { 405 360 batch_dispose(batch); … … 426 381 usbhc_iface_transfer_out_callback_t callback, void *arg) 427 382 { 428 assert(fun); 429 hc_t *hc = fun_to_hc(fun); 430 assert(hc); 431 usb_speed_t speed = 432 usb_device_keeper_get_speed(&hc->manager, target.address); 433 usb_log_debug("Control WRITE (%d) %d:%d %zu(%zu).\n", 434 speed, target.address, target.endpoint, size, max_packet_size); 435 endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager, 436 target.address, target.endpoint, USB_DIRECTION_BOTH, NULL); 437 if (ep == NULL) { 438 usb_log_warning("Endpoint(%d:%d) not registered for CONTROL.\n", 439 target.address, target.endpoint); 440 } 441 442 if (setup_size != 8) 443 return EINVAL; 444 445 usb_transfer_batch_t *batch = 446 batch_get(fun, target, USB_TRANSFER_CONTROL, max_packet_size, speed, 447 data, size, setup_data, setup_size, NULL, callback, arg, ep); 448 if (!batch) 449 return ENOMEM; 383 usb_transfer_batch_t *batch = NULL; 384 hc_t *hc = NULL; 385 int ret = setup_batch(fun, target, USB_DIRECTION_BOTH, data, size, 386 setup_data, setup_size, NULL, callback, arg, "Control WRITE", 387 &hc, &batch); 388 if (ret != EOK) 389 return ret; 450 390 usb_device_keeper_reset_if_need(&hc->manager, target, setup_data); 451 391 batch_control_write(batch); 452 const intret = hc_schedule(hc, batch);392 ret = hc_schedule(hc, batch); 453 393 if (ret != EOK) { 454 394 batch_dispose(batch); … … 475 415 usbhc_iface_transfer_in_callback_t callback, void *arg) 476 416 { 477 assert(fun); 478 hc_t *hc = fun_to_hc(fun); 479 assert(hc); 480 usb_speed_t speed = 481 usb_device_keeper_get_speed(&hc->manager, target.address); 482 483 usb_log_debug("Control READ(%d) %d:%d %zu(%zu).\n", 484 speed, target.address, target.endpoint, size, max_packet_size); 485 endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager, 486 target.address, target.endpoint, USB_DIRECTION_BOTH, NULL); 487 if (ep == NULL) { 488 usb_log_warning("Endpoint(%d:%d) not registered for CONTROL.\n", 489 target.address, target.endpoint); 490 } 491 usb_transfer_batch_t *batch = 492 batch_get(fun, target, USB_TRANSFER_CONTROL, max_packet_size, speed, 493 data, size, setup_data, setup_size, callback, NULL, arg, ep); 494 if (!batch) 495 return ENOMEM; 417 usb_transfer_batch_t *batch = NULL; 418 hc_t *hc = NULL; 419 int ret = setup_batch(fun, target, USB_DIRECTION_BOTH, data, size, 420 setup_data, setup_size, callback, NULL, arg, "Control READ", 421 &hc, &batch); 422 if (ret != EOK) 423 return ret; 496 424 batch_control_read(batch); 497 const intret = hc_schedule(hc, batch);425 ret = hc_schedule(hc, batch); 498 426 if (ret != EOK) { 499 427 batch_dispose(batch); -
uspace/drv/uhci-hcd/transfer_list.c
r3e490eb r8961c22 132 132 } 133 133 /*----------------------------------------------------------------------------*/ 134 /** Check list for finished batches. 135 * 136 * @param[in] instance List to use. 137 * @return Error code 138 * 139 * Creates a local list of finished batches and calls next_step on each and 140 * every one. This is safer because next_step may theoretically access 141 * this transfer list leading to the deadlock if its done inline. 134 /** Create list for finished batches. 135 * 136 * @param[in] instance List to use. 137 * @param[in] done list to fill 142 138 */ 143 139 void transfer_list_remove_finished(transfer_list_t *instance, link_t *done) … … 161 157 } 162 158 fibril_mutex_unlock(&instance->guard); 163 164 159 } 165 160 /*----------------------------------------------------------------------------*/ … … 176 171 list_get_instance(current, usb_transfer_batch_t, link); 177 172 transfer_list_remove_batch(instance, batch); 178 usb_transfer_batch_finish (batch, EIO);173 usb_transfer_batch_finish_error(batch, EIO); 179 174 } 180 175 fibril_mutex_unlock(&instance->guard); -
uspace/drv/uhci-rhd/root_hub.h
r3e490eb r8961c22 40 40 41 41 #define UHCI_ROOT_HUB_PORT_COUNT 2 42 #define ROOT_HUB_WAIT_USEC 5000000 /* 5seconds */42 #define ROOT_HUB_WAIT_USEC 250000 /* 250 miliseconds */ 43 43 44 44 typedef struct root_hub { -
uspace/drv/usbkbd/kbddev.c
r3e490eb r8961c22 265 265 static void usb_kbd_set_led(usb_kbd_t *kbd_dev) 266 266 { 267 if (kbd_dev->output_size == 0) { 268 return; 269 } 270 267 271 unsigned i = 0; 268 272 … … 288 292 289 293 int rc = usb_hid_report_output_translate(kbd_dev->parser, 290 kbd_dev->led_path, USB_HID_PATH_COMPARE_END, kbd_dev->output_buffer, 294 kbd_dev->led_path, 295 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 296 kbd_dev->output_buffer, 291 297 kbd_dev->output_size, kbd_dev->led_data, kbd_dev->led_output_size); 292 298 … … 539 545 * according to HID Usage Tables. 540 546 * @param count Number of key codes in report (size of the report). 541 * @param modifiers Bitmap of modifiers (Ctrl, Alt, Shift, GUI).547 * @param report_id 542 548 * @param arg User-specified argument. Expects pointer to the keyboard device 543 549 * structure representing the keyboard. … … 546 552 */ 547 553 static void usb_kbd_process_keycodes(const uint8_t *key_codes, size_t count, 548 uint8_t modifiers, void *arg)554 uint8_t report_id, void *arg) 549 555 { 550 556 if (arg == NULL) { … … 557 563 assert(kbd_dev != NULL); 558 564 559 usb_log_debug("Got keys from parser : %s\n",560 usb_debug_str_buffer(key_codes, count, 0));565 usb_log_debug("Got keys from parser (report id: %u): %s\n", 566 report_id, usb_debug_str_buffer(key_codes, count, 0)); 561 567 562 568 if (count != kbd_dev->key_count) { … … 608 614 usb_hid_report_path_t *path = usb_hid_report_path(); 609 615 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0); 616 usb_hid_report_path_set_report_id(path, 0); 610 617 611 618 int rc = usb_hid_parse_report(kbd_dev->parser, buffer, 612 actual_size, path, USB_HID_PATH_COMPARE_STRICT, callbacks, kbd_dev); 619 actual_size, path, 620 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 621 callbacks, kbd_dev); 613 622 614 623 usb_hid_report_path_free (path); … … 758 767 usb_hid_report_path_t *path = usb_hid_report_path(); 759 768 usb_hid_report_path_append_item(path, USB_HIDUT_PAGE_KEYBOARD, 0); 769 770 usb_hid_report_path_set_report_id(path, 0); 771 760 772 kbd_dev->key_count = usb_hid_report_input_length( 761 kbd_dev->parser, path, USB_HID_PATH_COMPARE_STRICT); 773 kbd_dev->parser, path, 774 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY); 762 775 usb_hid_report_path_free (path); 763 776 … … 777 790 kbd_dev->output_buffer = usb_hid_report_output(kbd_dev->parser, 778 791 &kbd_dev->output_size); 779 if (kbd_dev->output_buffer == NULL ) {792 if (kbd_dev->output_buffer == NULL && kbd_dev->output_size != 0) { 780 793 usb_log_warning("Error creating output report buffer.\n"); 781 794 free(kbd_dev->keys); … … 790 803 791 804 kbd_dev->led_output_size = usb_hid_report_output_size(kbd_dev->parser, 792 kbd_dev->led_path, USB_HID_PATH_COMPARE_END); 805 kbd_dev->led_path, 806 USB_HID_PATH_COMPARE_END | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY); 793 807 794 808 usb_log_debug("Output report size (in items): %zu\n", -
uspace/drv/usbkbd/main.c
r3e490eb r8961c22 33 33 /** 34 34 * @file 35 * Main routines of USB HID driver.35 * Main routines of USB KBD driver. 36 36 */ 37 37 … … 75 75 * @sa usb_kbd_fibril(), usb_kbd_repeat_fibril() 76 76 */ 77 static int usb hid_try_add_device(usb_device_t *dev)77 static int usb_kbd_try_add_device(usb_device_t *dev) 78 78 { 79 79 /* Create the function exposed under /dev/devices. */ … … 105 105 usb_kbd_free(&kbd_dev); 106 106 return rc; 107 } 107 } 108 108 109 109 usb_log_debug("USB/HID KBD device structure initialized.\n"); … … 195 195 * @retval EREFUSED if the device is not supported. 196 196 */ 197 static int usb hid_add_device(usb_device_t *dev)197 static int usb_kbd_add_device(usb_device_t *dev) 198 198 { 199 usb_log_debug("usb hid_add_device()\n");199 usb_log_debug("usb_kbd_add_device()\n"); 200 200 201 201 if (dev->interface_no < 0) { 202 202 usb_log_warning("Device is not a supported keyboard.\n"); 203 usb_log_error("Failed to add HID device: endpoint not found."204 " \n");203 usb_log_error("Failed to add USB KBD device: endpoint not " 204 "found.\n"); 205 205 return ENOTSUP; 206 206 } 207 207 208 int rc = usb hid_try_add_device(dev);208 int rc = usb_kbd_try_add_device(dev); 209 209 210 210 if (rc != EOK) { 211 211 usb_log_warning("Device is not a supported keyboard.\n"); 212 usb_log_error("Failed to add HID device: %s.\n",212 usb_log_error("Failed to add KBD device: %s.\n", 213 213 str_error(rc)); 214 214 return rc; … … 224 224 /* Currently, the framework supports only device adding. Once the framework 225 225 * supports unplug, more callbacks will be added. */ 226 static usb_driver_ops_t usb hid_driver_ops = {227 .add_device = usb hid_add_device,226 static usb_driver_ops_t usb_kbd_driver_ops = { 227 .add_device = usb_kbd_add_device, 228 228 }; 229 229 230 230 231 231 /* The driver itself. */ 232 static usb_driver_t usb hid_driver = {232 static usb_driver_t usb_kbd_driver = { 233 233 .name = NAME, 234 .ops = &usb hid_driver_ops,234 .ops = &usb_kbd_driver_ops, 235 235 .endpoints = usb_kbd_endpoints 236 236 }; … … 238 238 /*----------------------------------------------------------------------------*/ 239 239 240 //static driver_ops_t kbd_driver_ops = {241 // .add_device = usbhid_add_device,242 //};243 244 ///*----------------------------------------------------------------------------*/245 246 //static driver_t kbd_driver = {247 // .name = NAME,248 // .driver_ops = &kbd_driver_ops249 //};250 251 /*----------------------------------------------------------------------------*/252 253 240 int main(int argc, char *argv[]) 254 241 { 255 printf(NAME ": HelenOS USB HID driver.\n");242 printf(NAME ": HelenOS USB KBD driver.\n"); 256 243 257 244 usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME); 258 245 259 return usb_driver_main(&usb hid_driver);246 return usb_driver_main(&usb_kbd_driver); 260 247 } 261 248 -
uspace/drv/usbkbd/usbkbd.ma
r3e490eb r8961c22 1 100 usb&interface&class=HID&subclass=0x01&protocol=0x01 2 10 usb&interface&class=HID 1 10 usb&interface&class=HID&subclass=0x01&protocol=0x01
Note:
See TracChangeset
for help on using the changeset viewer.
