Changeset 9f685aa in mainline for uspace/drv/bus/usb/usbhub/usbhub.c
- Timestamp:
- 2018-01-22T20:06:41Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 34d750c
- Parents:
- effbef3
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-22 20:04:03)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-22 20:06:41)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/usbhub.c
reffbef3 r9f685aa 58 58 #define HUB_FNC_NAME "hub" 59 59 60 #define HUB_STATUS_CHANGE_EP(protocol) { \ 61 .transfer_type = USB_TRANSFER_INTERRUPT, \ 62 .direction = USB_DIRECTION_IN, \ 63 .interface_class = USB_CLASS_HUB, \ 64 .interface_subclass = 0, \ 65 .interface_protocol = (protocol), \ 66 .flags = 0 \ 67 } 68 60 69 /** Hub status-change endpoint description. 61 70 * 62 71 * For more information see section 11.15.1 of USB 1.1 specification. 63 72 */ 64 const usb_endpoint_description_t hub_status_change_endpoint_description = 65 { 66 .transfer_type = USB_TRANSFER_INTERRUPT, 67 .direction = USB_DIRECTION_IN, 68 .interface_class = USB_CLASS_HUB, 69 .interface_subclass = 0, 70 .interface_protocol = -1, 71 .flags = 0 73 static const usb_endpoint_description_t 74 status_change_single_tt_only = HUB_STATUS_CHANGE_EP(0), 75 status_change_mtt_available = HUB_STATUS_CHANGE_EP(1); 76 77 const usb_endpoint_description_t *usb_hub_endpoints [] = { 78 &status_change_single_tt_only, 79 &status_change_mtt_available, 72 80 }; 81 73 82 74 83 /** Standard get hub global status request */ … … 135 144 str_error(opResult)); 136 145 return opResult; 146 } 147 148 const usb_endpoint_description_t *status_change = hub_dev->mtt_available 149 ? &status_change_mtt_available 150 : &status_change_single_tt_only; 151 152 usb_endpoint_mapping_t *status_change_mapping 153 = usb_device_get_mapped_ep_desc(hub_dev->usb_device, status_change); 154 if (!status_change_mapping) { 155 usb_log_error("Failed to map the Status Change Endpoint of a hub."); 156 return EIO; 137 157 } 138 158 … … 168 188 169 189 polling->device = hub_dev->usb_device; 170 polling->ep_mapping = usb_device_get_mapped_ep_desc(hub_dev->usb_device, 171 &hub_status_change_endpoint_description); 190 polling->ep_mapping = status_change_mapping; 172 191 polling->request_size = ((hub_dev->port_count + 1 + 7) / 8); 173 192 polling->buffer = malloc(polling->request_size); … … 339 358 /* Get hub descriptor. */ 340 359 usb_log_debug("(%p): Retrieving descriptor.", hub_dev); 341 usb_pipe_t *control_pipe = 342 usb_device_get_default_pipe(hub_dev->usb_device); 360 usb_pipe_t *control_pipe = usb_device_get_default_pipe(hub_dev->usb_device); 343 361 344 362 usb_descriptor_type_t desc_type = hub_dev->speed >= USB_SPEED_SUPER … … 383 401 hub_dev->per_port_power = 384 402 descriptor.characteristics & HUB_CHAR_POWER_PER_PORT_FLAG; 403 404 const uint8_t protocol = usb_device_descriptors(hub_dev->usb_device) 405 ->device.device_protocol; 406 hub_dev->mtt_available = (protocol == 2); 385 407 386 408 usb_hub_power_ports(hub_dev); … … 434 456 } 435 457 436 /* Check if this is a MTT hub */437 const size_t device_protocol =438 usb_device_descriptors(usb_device)->device.device_protocol;439 if (device_protocol == 2) {440 usb_log_debug("This is a MTT hub. MTT not supported, switching to Single-TT.");441 opResult = usb_request_set_interface(usb_device_get_default_pipe(usb_device), 1, 0);442 if (opResult != EOK)443 usb_log_error("Failed to switch to Single-TT protocol.");444 }445 458 return opResult; 446 459 }
Note:
See TracChangeset
for help on using the changeset viewer.