Changes in uspace/drv/usbhub/usbhub.c [42a3a57:4e900c1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/usbhub.c
r42a3a57 r4e900c1 72 72 int usb_hub_control_loop(void * hub_info_param){ 73 73 usb_hub_info_t * hub_info = (usb_hub_info_t*)hub_info_param; 74 int errorCode = EOK; 75 76 while(errorCode == EOK){ 77 errorCode = usb_hub_check_hub_changes(hub_info); 74 while(true){ 75 usb_hub_check_hub_changes(hub_info); 78 76 async_usleep(1000 * 1000 );/// \TODO proper number once 79 77 } 80 dprintf(USB_LOG_LEVEL_ERROR,81 "something in ctrl loop went wrong, errno %d",errorCode);82 78 return 0; 83 79 } … … 122 118 dprintf(USB_LOG_LEVEL_ERROR, 123 119 "could not initialize connection to device endpoint, errno %d",opResult); 124 return opResult; 125 } 126 127 opResult = usb_endpoint_pipe_probe_default_control(&hub->endpoints.control); 128 if (opResult != EOK) { 129 dprintf(USB_LOG_LEVEL_ERROR, "failed probing endpoint 0, %d", opResult); 130 return opResult; 131 } 132 133 return EOK; 120 } 121 return opResult; 134 122 } 135 123 … … 384 372 * @param target 385 373 */ 386 static void usb_hub_init_add_device(usb_hub_info_t * hub, uint16_t port, 387 bool isLowSpeed) { 374 static void usb_hub_init_add_device(usb_hub_info_t * hub, uint16_t port) { 388 375 usb_device_request_setup_packet_t request; 389 376 int opResult; … … 391 378 assert(hub->endpoints.control.hc_phone); 392 379 //get default address 393 usb_speed_t speed = isLowSpeed?USB_SPEED_LOW:USB_SPEED_FULL;394 opResult = usb_hc_reserve_default_address(&hub->connection, speed);380 //opResult = usb_drv_reserve_default_address(hc); 381 opResult = usb_hc_reserve_default_address(&hub->connection, USB_SPEED_LOW); 395 382 396 383 if (opResult != EOK) { … … 443 430 &new_device_pipe, 444 431 &new_device_connection); 445 usb_endpoint_pipe_probe_default_control(&new_device_pipe);446 432 /// \TODO get highspeed info 447 433 usb_speed_t speed = isLowSpeed?USB_SPEED_LOW:USB_SPEED_FULL; … … 451 437 usb_address_t new_device_address = usb_hc_request_address( 452 438 &hub->connection, 453 speed 439 speed/// \TODO fullspeed?? 454 440 ); 455 441 if (new_device_address < 0) { … … 515 501 static void usb_hub_removed_device( 516 502 usb_hub_info_t * hub,uint16_t port) { 517 503 //usb_device_request_setup_packet_t request; 504 int opResult; 505 518 506 /** \TODO remove device from device manager - not yet implemented in 519 507 * devide manager … … 522 510 //close address 523 511 if(hub->attached_devs[port].address!=0){ 524 / *uncomment this code to use it when DDF allows device removal512 //opResult = usb_drv_release_address(hc,hub->attached_devs[port].address); 525 513 opResult = usb_hc_unregister_device( 526 514 &hub->connection, hub->attached_devs[port].address); … … 531 519 hub->attached_devs[port].address = 0; 532 520 hub->attached_devs[port].handle = 0; 533 */534 521 }else{ 535 522 dprintf(USB_LOG_LEVEL_WARNING, "this is strange, disconnected device had no address"); … … 601 588 if (usb_port_dev_connected(&status)) { 602 589 dprintf(USB_LOG_LEVEL_INFO, "some connection changed"); 603 usb_hub_init_add_device(hub, port , usb_port_low_speed(&status));590 usb_hub_init_add_device(hub, port); 604 591 } else { 605 592 usb_hub_removed_device(hub, port); … … 639 626 /** 640 627 * Check changes on particular hub 641 * @param hub_info_param pointer to usb_hub_info_t structure 642 * @return error code if there is problem when initializing communication with 643 * hub, EOK otherwise 644 */ 645 int usb_hub_check_hub_changes(usb_hub_info_t * hub_info){ 628 * @param hub_info_param 629 */ 630 void usb_hub_check_hub_changes(usb_hub_info_t * hub_info){ 646 631 int opResult; 647 632 opResult = usb_endpoint_pipe_start_session(&hub_info->endpoints.status_change); … … 649 634 dprintf(USB_LOG_LEVEL_ERROR, 650 635 "could not initialize communication for hub; %d", opResult); 651 return opResult;636 return; 652 637 } 653 638 … … 671 656 dprintf(USB_LOG_LEVEL_WARNING, "something went wrong while getting status of hub"); 672 657 usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change); 673 return opResult;658 return; 674 659 } 675 660 unsigned int port; … … 679 664 opResult); 680 665 usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change); 681 return opResult;666 return; 682 667 } 683 668 opResult = usb_hc_connection_open(&hub_info->connection); … … 687 672 usb_endpoint_pipe_end_session(&hub_info->endpoints.control); 688 673 usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change); 689 return opResult;674 return; 690 675 } 691 676 … … 703 688 usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change); 704 689 free(change_bitmap); 705 return EOK;706 690 } 707 691
Note:
See TracChangeset
for help on using the changeset viewer.