Changes in / [039c66c:fcf07e6] in mainline
- Location:
- uspace/drv/usbhub
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/usbhub.c
r039c66c rfcf07e6 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 } … … 384 380 * @param target 385 381 */ 386 static void usb_hub_init_add_device(usb_hub_info_t * hub, uint16_t port, 387 bool isLowSpeed) { 382 static void usb_hub_init_add_device(usb_hub_info_t * hub, uint16_t port) { 388 383 usb_device_request_setup_packet_t request; 389 384 int opResult; … … 391 386 assert(hub->endpoints.control.hc_phone); 392 387 //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);388 //opResult = usb_drv_reserve_default_address(hc); 389 opResult = usb_hc_reserve_default_address(&hub->connection, USB_SPEED_LOW); 395 390 396 391 if (opResult != EOK) { … … 451 446 usb_address_t new_device_address = usb_hc_request_address( 452 447 &hub->connection, 453 speed 448 speed/// \TODO fullspeed?? 454 449 ); 455 450 if (new_device_address < 0) { … … 515 510 static void usb_hub_removed_device( 516 511 usb_hub_info_t * hub,uint16_t port) { 517 512 //usb_device_request_setup_packet_t request; 513 int opResult; 514 518 515 /** \TODO remove device from device manager - not yet implemented in 519 516 * devide manager … … 522 519 //close address 523 520 if(hub->attached_devs[port].address!=0){ 524 / *uncomment this code to use it when DDF allows device removal521 //opResult = usb_drv_release_address(hc,hub->attached_devs[port].address); 525 522 opResult = usb_hc_unregister_device( 526 523 &hub->connection, hub->attached_devs[port].address); … … 531 528 hub->attached_devs[port].address = 0; 532 529 hub->attached_devs[port].handle = 0; 533 */534 530 }else{ 535 531 dprintf(USB_LOG_LEVEL_WARNING, "this is strange, disconnected device had no address"); … … 601 597 if (usb_port_dev_connected(&status)) { 602 598 dprintf(USB_LOG_LEVEL_INFO, "some connection changed"); 603 usb_hub_init_add_device(hub, port , usb_port_low_speed(&status));599 usb_hub_init_add_device(hub, port); 604 600 } else { 605 601 usb_hub_removed_device(hub, port); … … 639 635 /** 640 636 * 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){ 637 * @param hub_info_param 638 */ 639 void usb_hub_check_hub_changes(usb_hub_info_t * hub_info){ 646 640 int opResult; 647 641 opResult = usb_endpoint_pipe_start_session(&hub_info->endpoints.status_change); … … 649 643 dprintf(USB_LOG_LEVEL_ERROR, 650 644 "could not initialize communication for hub; %d", opResult); 651 return opResult;645 return; 652 646 } 653 647 … … 671 665 dprintf(USB_LOG_LEVEL_WARNING, "something went wrong while getting status of hub"); 672 666 usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change); 673 return opResult;667 return; 674 668 } 675 669 unsigned int port; … … 679 673 opResult); 680 674 usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change); 681 return opResult;675 return; 682 676 } 683 677 opResult = usb_hc_connection_open(&hub_info->connection); … … 687 681 usb_endpoint_pipe_end_session(&hub_info->endpoints.control); 688 682 usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change); 689 return opResult;683 return; 690 684 } 691 685 … … 703 697 usb_endpoint_pipe_end_session(&hub_info->endpoints.status_change); 704 698 free(change_bitmap); 705 return EOK;706 699 } 707 700 -
uspace/drv/usbhub/usbhub.h
r039c66c rfcf07e6 87 87 88 88 /** 89 * Check changes on specified hub89 * check changes on specified hub 90 90 * @param hub_info_param pointer to usb_hub_info_t structure 91 * @return error code if there is problem when initializing communication with92 * hub, EOK otherwise93 91 */ 94 intusb_hub_check_hub_changes(usb_hub_info_t * hub_info_param);92 void usb_hub_check_hub_changes(usb_hub_info_t * hub_info_param); 95 93 96 94
Note:
See TracChangeset
for help on using the changeset viewer.