Changeset 2833bb4 in mainline for uspace/drv/bus/usb/xhci/bus.c
- Timestamp:
- 2018-01-19T17:38:22Z (7 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/bus.c
r944f8fdd r2833bb4 37 37 #include <usb/host/hcd.h> 38 38 #include <usb/host/utility.h> 39 #include <usb/classes/classes.h> 40 #include <usb/classes/hub.h> 39 41 #include <usb/descriptor.h> 40 42 #include <usb/debug.h> … … 136 138 137 139 /** 140 * Check whether the device is a hub and if so, fill its characterstics. 141 * 142 * If this fails, it does not necessarily mean the device is unusable. 143 * Just the TT will not work correctly. 144 */ 145 static int setup_hub(xhci_device_t *dev, usb_standard_device_descriptor_t *desc) 146 { 147 if (desc->device_class != USB_CLASS_HUB) 148 return EOK; 149 150 usb_hub_descriptor_header_t hub_desc = { 0 }; 151 const int err = hc_get_hub_desc(&dev->base, &hub_desc); 152 if (err) 153 return err; 154 155 dev->is_hub = 1; 156 dev->num_ports = hub_desc.port_count; 157 dev->tt_think_time = 8 + 158 8 * !!(hub_desc.characteristics & HUB_CHAR_TT_THINK_8) + 159 16 * !!(hub_desc.characteristics & HUB_CHAR_TT_THINK_16); 160 161 usb_log_debug2("Device(%u): recognised USB hub with %u ports", dev->base.address, dev->num_ports); 162 return EOK; 163 } 164 165 /** 138 166 * Respond to a new device on the XHCI bus. Address it, negotiate packet size 139 167 * and retrieve USB descriptors. … … 184 212 } 185 213 186 /* Read the device descriptor, derive the match ids */ 187 if ((err = hc_device_explore(dev))) { 188 usb_log_error("Device(%d): Failed to explore device: %s", dev->address, str_error(err)); 214 usb_standard_device_descriptor_t desc = { 0 }; 215 216 if ((err = hc_get_device_desc(dev, &desc))) { 217 usb_log_error("Device(%d): failed to get devices descriptor: %s", dev->address, str_error(err)); 218 goto err_address; 219 } 220 221 if ((err = setup_hub(xhci_dev, &desc))) 222 usb_log_warning("Device(%d): failed to setup hub characteristics: %s. " 223 " Continuing anyway.", dev->address, str_error(err)); 224 225 if ((err = hcd_ddf_setup_match_ids(dev, &desc))) { 226 usb_log_error("Device(%d): failed to setup match IDs: %s", dev->address, str_error(err)); 189 227 goto err_address; 190 228 }
Note:
See TracChangeset
for help on using the changeset viewer.