Changeset 904b1bc in mainline for uspace/lib/usbhost/src
- 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)
- Location:
- uspace/lib/usbhost/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/ddf_helpers.c
r4f8772d4 r904b1bc 66 66 */ 67 67 static errno_t register_endpoint(ddf_fun_t *fun, usb_pipe_desc_t *pipe_desc, 68 68 const usb_endpoint_descriptors_t *ep_desc) 69 69 { 70 70 assert(fun); … … 92 92 } 93 93 94 95 96 97 98 99 100 101 94 /** 95 * DDF usbhc_iface callback. Unregister endpoint that makes the other end of 96 * the pipe described. 97 * 98 * @param fun DDF function of the device in question. 99 * @param pipe_desc Pipe description. 100 * @return Error code. 101 */ 102 102 static errno_t unregister_endpoint(ddf_fun_t *fun, const usb_pipe_desc_t *pipe_desc) 103 103 { … … 182 182 } 183 183 184 /* If the driver didn't name the dev when enumerating, 184 /* 185 * If the driver didn't name the dev when enumerating, 185 186 * do it in some generic way. 186 187 */ … … 281 282 assert(dev); 282 283 283 const usb_target_t target = {{ 284 .address = dev->address, 285 .endpoint = ifreq->endpoint, 286 .stream = ifreq->stream, 287 }}; 284 const usb_target_t target = { 285 { 286 .address = dev->address, 287 .endpoint = ifreq->endpoint, 288 .stream = ifreq->stream, 289 } 290 }; 288 291 289 292 if (!usb_target_is_valid(&target)) -
uspace/lib/usbhost/src/usb2_bus.c
r4f8772d4 r904b1bc 89 89 } 90 90 91 static const usb_target_t usb2_default_target = {{ 92 .address = USB_ADDRESS_DEFAULT, 93 .endpoint = 0, 94 }}; 91 static const usb_target_t usb2_default_target = { 92 { 93 .address = USB_ADDRESS_DEFAULT, 94 .endpoint = 0, 95 } 96 }; 95 97 96 98 /** … … 120 122 121 123 usb_endpoint_descriptors_t ep0_desc = { 122 124 .endpoint.max_packet_size = CTRL_PIPE_MIN_PACKET_SIZE, 123 125 }; 124 126 -
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.