Changeset 904b1bc in mainline for uspace/lib/usbhost/src/utility.c
- Timestamp:
- 2018-05-22T10:36:58Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a4eb3ba2
- Parents:
- 4f8772d4
- git-author:
- Jiri Svoboda <jiri@…> (2018-05-21 17:36:30)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-05-22 10:36:58)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/utility.c
r4f8772d4 r904b1bc 84 84 } 85 85 86 const usb_target_t control_ep = {{ 87 .address = dev->address, 88 .endpoint = 0, 89 }}; 86 const usb_target_t control_ep = { 87 { 88 .address = dev->address, 89 .endpoint = 0, 90 } 91 }; 90 92 91 93 usb_standard_device_descriptor_t desc = { 0 }; … … 123 125 int hc_get_device_desc(device_t *device, usb_standard_device_descriptor_t *desc) 124 126 { 125 const usb_target_t control_ep = {{ 126 .address = device->address, 127 .endpoint = 0, 128 }}; 127 const usb_target_t control_ep = { 128 { 129 .address = device->address, 130 .endpoint = 0, 131 } 132 }; 129 133 130 134 /* Get std device descriptor */ … … 147 151 int hc_get_hub_desc(device_t *device, usb_hub_descriptor_header_t *desc) 148 152 { 149 const usb_target_t control_ep = {{ 150 .address = device->address, 151 .endpoint = 0, 152 }}; 153 154 const usb_descriptor_type_t type = device->speed >= USB_SPEED_SUPER 155 ? USB_DESCTYPE_SSPEED_HUB : USB_DESCTYPE_HUB; 153 const usb_target_t control_ep = { 154 { 155 .address = device->address, 156 .endpoint = 0, 157 } 158 }; 159 160 const usb_descriptor_type_t type = device->speed >= USB_SPEED_SUPER ? 161 USB_DESCTYPE_SSPEED_HUB : USB_DESCTYPE_HUB; 156 162 157 163 const usb_device_request_setup_packet_t get_hub_desc = { 158 .request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST 159 | (USB_REQUEST_TYPE_CLASS << 5)160 |USB_REQUEST_RECIPIENT_DEVICE,164 .request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST | 165 (USB_REQUEST_TYPE_CLASS << 5) | 166 USB_REQUEST_RECIPIENT_DEVICE, 161 167 .request = USB_DEVREQ_GET_DESCRIPTOR, 162 168 .value = uint16_host2usb(type << 8), … … 244 250 void hc_reset_toggles(const usb_transfer_batch_t *batch, endpoint_reset_toggle_t reset_cb) 245 251 { 246 if (batch->ep->transfer_type != USB_TRANSFER_CONTROL 247 ||batch->dir != USB_DIRECTION_OUT)252 if (batch->ep->transfer_type != USB_TRANSFER_CONTROL || 253 batch->dir != USB_DIRECTION_OUT) 248 254 return; 249 255 250 256 const usb_device_request_setup_packet_t *request = &batch->setup.packet; 251 device_t * const dev = batch->ep->device; 252 253 switch (request->request) 254 { 255 /* Clear Feature ENPOINT_STALL */ 257 device_t *const dev = batch->ep->device; 258 259 switch (request->request) { 260 /* Clear Feature ENPOINT_STALL */ 256 261 case USB_DEVREQ_CLEAR_FEATURE: /*resets only cleared ep */ 257 262 /* 0x2 ( HOST to device | STANDART | TO ENPOINT) */ … … 273 278 case USB_DEVREQ_SET_CONFIGURATION: 274 279 case USB_DEVREQ_SET_INTERFACE: 275 /* Recipient must be device, this resets all endpoints, 280 /* 281 * Recipient must be device, this resets all endpoints, 276 282 * In fact there should be no endpoints but EP 0 registered 277 283 * as different interfaces use different endpoints, 278 284 * unless you're changing configuration or alternative 279 * interface of an already setup device. */ 285 * interface of an already setup device. 286 */ 280 287 if (!(request->request_type & SETUP_REQUEST_TYPE_DEVICE_TO_HOST)) 281 288 for (usb_endpoint_t i = 0; i < 2 * USB_ENDPOINT_MAX; ++i)
Note:
See TracChangeset
for help on using the changeset viewer.