Changes in uspace/drv/usbhub/utils.c [9223dc5c:f9a0cef] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/utils.c
r9223dc5c rf9a0cef 506 506 int hc, uint16_t port, usb_target_t target) { 507 507 508 usb_device_request_setup_packet_t request;509 508 int opResult; 510 509 printf("[usb_hub] finalizing add device\n"); 511 usb_address_t new_device_address = 512 usb_drv_request_address(hc); 513 usb_hub_set_set_address_request 514 (&request, new_device_address); 515 opResult = usb_drv_sync_control_write( 516 hc, target, 517 &request, 518 NULL, 0 519 ); 510 opResult = usb_hub_clear_port_feature(hc, target.address, 511 port, USB_HUB_FEATURE_C_PORT_RESET); 512 if (opResult != EOK) { 513 goto release; 514 } 515 516 /* Request address at from host controller. */ 517 usb_address_t new_device_address = usb_drv_request_address(hc); 518 if (new_device_address < 0) { 519 printf("[usb_hub] failed to get free USB address\n"); 520 opResult = new_device_address; 521 goto release; 522 } 523 printf("[usb_hub] setting new address\n"); 524 opResult = usb_drv_req_set_address(hc, USB_ADDRESS_DEFAULT, 525 new_device_address); 526 520 527 if (opResult != EOK) { 521 528 printf("[usb_hub] could not set address for new device\n"); 522 //will retry later... 523 return; 524 } 525 529 goto release; 530 } 531 532 release: 533 printf("[usb_hub] releasing default address\n"); 526 534 usb_drv_release_default_address(hc); 535 if (opResult != EOK) { 536 return; 537 } 527 538 528 539 devman_handle_t child_handle; 529 540 opResult = usb_drv_register_child_in_devman(hc, hub->device, 530 new_device_address, &child_handle);541 new_device_address, &child_handle); 531 542 if (opResult != EOK) { 532 543 printf("[usb_hub] could not start driver for new device \n"); … … 543 554 printf("[usb_hub] new device address %d, handle %d\n", 544 555 new_device_address, child_handle); 545 sleep(60);546 556 547 557 } … … 620 630 //something connected/disconnected 621 631 if (usb_port_connect_change(&status)) { 632 opResult = usb_hub_clear_port_feature(hc, target.address, 633 port, USB_HUB_FEATURE_C_PORT_CONNECTION); 634 // TODO: check opResult 622 635 if (usb_port_dev_connected(&status)) { 623 636 printf("[usb_hub] some connection changed\n"); … … 629 642 //port reset 630 643 if (usb_port_reset_completed(&status)) { 631 printf("[usb_hub] finalizing add device\n");644 printf("[usb_hub] port reset complete\n"); 632 645 if (usb_port_enabled(&status)) { 633 646 usb_hub_finalize_add_device(hub, hc, port, target); … … 670 683 lst_item != &usb_hub_list; 671 684 lst_item = lst_item->next) { 672 printf("[usb_hub] checking hub changes\n");673 685 usb_hub_info_t * hub_info = ((usb_hub_info_t*)lst_item->data); 674 686 /* … … 679 691 target.address = hub_info->usb_device->address; 680 692 target.endpoint = 1;/// \TODO get from endpoint descriptor 681 printf("checking changes for hub at addr %d \n",target.address); 693 printf("[usb_hub] checking changes for hub at addr %d\n", 694 target.address); 682 695 683 696 size_t port_count = hub_info->port_count;
Note:
See TracChangeset
for help on using the changeset viewer.