Changeset 2833bb4 in mainline for uspace/lib/usbhost
- Timestamp:
 - 2018-01-19T17:38:22Z (8 years ago)
 - Branches:
 - lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
 - Children:
 - 7e5a12b
 - Parents:
 - 944f8fdd
 - git-author:
 - Ondřej Hlavatý <aearsis@…> (2018-01-19 17:38:10)
 - git-committer:
 - Ondřej Hlavatý <aearsis@…> (2018-01-19 17:38:22)
 - Location:
 - uspace/lib/usbhost
 - Files:
 - 
      
- 2 edited
 
- 
          
  include/usb/host/utility.h (modified) (2 diffs)
 - 
          
  src/utility.c (modified) (1 diff)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
uspace/lib/usbhost/include/usb/host/utility.h
r944f8fdd r2833bb4 41 41 #include <usb/host/usb_transfer_batch.h> 42 42 #include <usb/descriptor.h> 43 #include <usb/classes/hub.h> 43 44 #include <usb/request.h> 44 45 … … 47 48 int hc_setup_virtual_root_hub(hc_device_t *); 48 49 int hc_get_device_desc(device_t *, usb_standard_device_descriptor_t *); 50 int hc_get_hub_desc(device_t *, usb_hub_descriptor_header_t *); 49 51 int hc_device_explore(device_t *); 50 52  - 
      
uspace/lib/usbhost/src/utility.c
r944f8fdd r2833bb4 162 162 } 163 163 164 int hc_get_hub_desc(device_t *device, usb_hub_descriptor_header_t *desc) 165 { 166 const usb_target_t control_ep = {{ 167 .address = device->address, 168 .endpoint = 0, 169 }}; 170 171 const usb_device_request_setup_packet_t get_hub_desc = { 172 .request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST 173 | (USB_REQUEST_TYPE_CLASS << 5) 174 | USB_REQUEST_RECIPIENT_DEVICE, 175 .request = USB_DEVREQ_GET_DESCRIPTOR, \ 176 .value = uint16_host2usb(USB_DESCTYPE_HUB << 8), \ 177 .length = sizeof(*desc), 178 }; 179 180 usb_log_debug("Device(%d): Requesting hub descriptor.", 181 device->address); 182 ssize_t got = bus_device_send_batch_sync(device, control_ep, USB_DIRECTION_IN, 183 (char *) desc, sizeof(*desc), *(uint64_t *)&get_hub_desc, 184 "get hub descriptor"); 185 186 if (got < 0) 187 return got; 188 189 return got == sizeof(*desc) ? EOK : EOVERFLOW; 190 } 191 164 192 int hc_device_explore(device_t *device) 165 193 {  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  