Changeset 4c74ac3 in mainline for uspace/drv/usbhub/utils.c
- Timestamp:
- 2010-12-12T14:46:13Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 16ecc28
- Parents:
- b666608
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/utils.c
rb666608 r4c74ac3 48 48 49 49 50 static void check_hub_changes(void);51 52 50 size_t USB_HUB_MAX_DESCRIPTOR_SIZE = 71; 53 51 … … 365 363 } 366 364 367 /** Callback when new hub device is detected.368 *369 * @param dev New device.370 * @return Error code.371 */372 365 int usb_add_hub_device(device_t *dev) { 373 366 printf(NAME ": add_hub_device(handle=%d)\n", (int) dev->handle); … … 407 400 printf("[usb_hub] hub info added to list\n"); 408 401 //(void)hub_info; 409 check_hub_changes();402 usb_hub_check_hub_changes(); 410 403 411 404 /// \TODO start the check loop, if not already started... … … 415 408 416 409 printf("[usb_hub] hub dev added\n"); 410 printf("\taddress %d, has %d ports \n", 411 hub_info->usb_device->address, 412 hub_info->port_count); 417 413 418 414 return EOK; … … 461 457 * @param target 462 458 */ 463 static void usb_hub_finalize_add_device( 459 static void usb_hub_finalize_add_device( usb_hub_info_t * hub, 464 460 int hc, uint16_t port, usb_target_t target) { 465 461 … … 484 480 485 481 usb_drv_release_default_address(hc); 486 /* 487 devman_handle_t dev_handle; 488 rc = child_device_register_wrapper(hub_dev, "dev", 489 * match_id, match_score, &dev_handle); 490 if (rc != EOK) { 491 free(id); 492 } 493 * 494 */ 495 496 497 /// \TODO driver work 498 //add_child_device..... 499 //opResult = usb_drv_bind_address(hc, new_device_address, 500 //devman_handle_t handle);... 482 483 devman_handle_t child_handle; 484 opResult = usb_drv_register_child_in_devman(hc, hub->device, 485 new_device_address, &child_handle); 486 if (opResult != EOK) { 487 printf("[usb_hub] could not start driver for new device \n"); 488 return; 489 } 490 usb_drv_bind_address(hc, new_device_address, child_handle); 491 501 492 } 502 493 … … 534 525 * @param target 535 526 */ 536 static void usb_hub_process_interrupt( int hc, uint16_t port, usb_target_t target) {527 static void usb_hub_process_interrupt(usb_hub_info_t * hub, int hc, uint16_t port, usb_target_t target) { 537 528 printf("[usb_hub] interrupt at port %d\n", port); 538 529 //determine type of change … … 569 560 printf("[usb_hub] finalizing add device\n"); 570 561 if (usb_port_enabled(&status)) { 571 usb_hub_finalize_add_device(h c, port, target);562 usb_hub_finalize_add_device(hub, hc, port, target); 572 563 } else { 573 564 printf("[usb_hub] ERROR: port reset, but port still not enabled\n"); … … 600 591 /** Check changes on all known hubs. 601 592 */ 602 static voidcheck_hub_changes(void) {593 void usb_hub_check_hub_changes(void) { 603 594 /* 604 595 * Iterate through all hubs. … … 652 643 bool interrupt = (((uint8_t*) change_bitmap)[port / 8] >> (port % 8)) % 2; 653 644 if (interrupt) { 654 usb_hub_process_interrupt(h c, port, target);645 usb_hub_process_interrupt(hub_info, hc, port, target); 655 646 } 656 647 }
Note:
See TracChangeset
for help on using the changeset viewer.