Changeset df6ded8 in mainline for uspace/lib/usb/src
- Timestamp:
- 2018-02-28T16:37:50Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b20da0
- Parents:
- f5e5f73 (diff), b2dca8de (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
- git-committer:
- Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
- Location:
- uspace/lib/usb/src
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/dump.c
rf5e5f73 rdf6ded8 1 1 /* 2 2 * Copyright (c) 2011 Vojtech Horky 3 * Copyright (c) 2018 Ondrej Hlavaty 3 4 * All rights reserved. 4 5 * … … 61 62 static void usb_dump_descriptor_endpoint(FILE *, const char *, const char *, 62 63 const uint8_t *, size_t); 64 static void usb_dump_descriptor_superspeed_endpoint_companion(FILE *, const char *, const char *, 65 const uint8_t *, size_t); 63 66 static void usb_dump_descriptor_hid(FILE *, const char *, const char *, 64 67 const uint8_t *, size_t); … … 75 78 { USB_DESCTYPE_INTERFACE, usb_dump_descriptor_interface }, 76 79 { USB_DESCTYPE_ENDPOINT, usb_dump_descriptor_endpoint }, 80 { USB_DESCTYPE_SSPEED_EP_COMPANION, usb_dump_descriptor_superspeed_endpoint_companion }, 77 81 { USB_DESCTYPE_HID, usb_dump_descriptor_hid }, 78 82 { USB_DESCTYPE_HUB, usb_dump_descriptor_hub }, … … 238 242 PRINTLINE("wMaxPacketSize = %d", d->max_packet_size); 239 243 PRINTLINE("bInterval = %dms", d->poll_interval); 244 } 245 246 static void usb_dump_descriptor_superspeed_endpoint_companion(FILE *output, 247 const char *line_prefix, const char *line_suffix, 248 const uint8_t *descriptor, size_t descriptor_length) 249 { 250 usb_superspeed_endpoint_companion_descriptor_t *d 251 = (usb_superspeed_endpoint_companion_descriptor_t *) descriptor; 252 if (descriptor_length < sizeof(*d)) { 253 return; 254 } 255 256 PRINTLINE("bLength = %u", d->length); 257 PRINTLINE("bDescriptorType = 0x%02X", d->descriptor_type); 258 PRINTLINE("bMaxBurst = %u", d->max_burst); 259 PRINTLINE("bmAttributes = %d", d->attributes); 260 PRINTLINE("wBytesPerInterval = %u", d->bytes_per_interval); 240 261 } 241 262 -
uspace/lib/usb/src/usb.c
rf5e5f73 rdf6ded8 44 44 [USB_SPEED_FULL] = "full", 45 45 [USB_SPEED_HIGH] = "high", 46 [USB_SPEED_SUPER] = "super", 46 47 }; 47 48 … … 118 119 } 119 120 120 /** Check setup packet data for signs of toggle reset.121 *122 * @param[in] requst Setup requst data.123 *124 * @retval -1 No endpoints need reset.125 * @retval 0 All endpoints need reset.126 * @retval >0 Specified endpoint needs reset.127 *128 */129 int usb_request_needs_toggle_reset(130 const usb_device_request_setup_packet_t *request)131 {132 assert(request);133 switch (request->request)134 {135 /* Clear Feature ENPOINT_STALL */136 case USB_DEVREQ_CLEAR_FEATURE: /*resets only cleared ep */137 /* 0x2 ( HOST to device | STANDART | TO ENPOINT) */138 if ((request->request_type == 0x2) &&139 (request->value == USB_FEATURE_ENDPOINT_HALT))140 return uint16_usb2host(request->index);141 break;142 case USB_DEVREQ_SET_CONFIGURATION:143 case USB_DEVREQ_SET_INTERFACE:144 /* Recipient must be device, this resets all endpoints,145 * In fact there should be no endpoints but EP 0 registered146 * as different interfaces use different endpoints,147 * unless you're changing configuration or alternative148 * interface of an already setup device. */149 if (!(request->request_type & SETUP_REQUEST_TYPE_DEVICE_TO_HOST))150 return 0;151 break;152 default:153 break;154 }155 return -1;156 }157 158 121 /** 159 122 * @}
Note:
See TracChangeset
for help on using the changeset viewer.
