Changeset 8b8c164 in mainline for uspace/lib/usbhost/src/usb2_bus.c
- Timestamp:
- 2017-10-27T15:22:06Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 58ac3ec
- Parents:
- 7010861
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/usb2_bus.c
r7010861 r8b8c164 110 110 111 111 /** Reserve address early, we want pretty log messages */ 112 const usb_address_t address = bus_reserve_default_address(bus, dev->speed);113 if ( address < 0) {112 usb_address_t address; 113 if ((err = bus_request_address(bus, &address, false, dev->speed))) { 114 114 usb_log_error("Failed to reserve new address: %s.", 115 str_error( address));116 return address;115 str_error(err)); 116 return err; 117 117 } 118 118 usb_log_debug("Device(%d): Reserved new address.", address); … … 159 159 } 160 160 161 /* We need to remove ep before we change the address */ 162 if ((err = bus_remove_endpoint(bus, default_ep))) { 163 usb_log_error("Device(%d): Failed to unregister default target: %s", address, str_error(err)); 164 goto err_address; 165 } 166 endpoint_del_ref(default_ep); 167 161 168 dev->address = address; 162 169 … … 175 182 usb_log_error("Device(%d): Failed to register EP0: %s", 176 183 address, str_error(err)); 177 goto err_default_control_ep; 178 } 179 180 err = bus_remove_endpoint(bus, default_ep); 181 assert(err == EOK); 182 endpoint_del_ref(default_ep); 183 184 err = bus_release_address(bus, address); 185 assert(err == EOK); 184 goto err_address; 185 } 186 186 187 187 return EOK; … … 210 210 usb_log_debug("Found new %s speed USB device.", usb_str_speed(dev->speed)); 211 211 212 /* Manage TT */ 213 if (dev->hub->speed == USB_SPEED_HIGH && usb_speed_is_11(dev->speed)) { 214 /* For LS devices under HS hub */ 215 /* TODO: How about SS hubs? */ 216 dev->tt.address = dev->hub->address; 217 dev->tt.port = dev->port; 212 if (dev->hub) { 213 /* Manage TT */ 214 if (dev->hub->speed == USB_SPEED_HIGH && usb_speed_is_11(dev->speed)) { 215 /* For LS devices under HS hub */ 216 /* TODO: How about SS hubs? */ 217 dev->tt.address = dev->hub->address; 218 dev->tt.port = dev->port; 219 } 220 else { 221 /* Inherit hub's TT */ 222 dev->tt = dev->hub->tt; 223 } 218 224 } 219 225 else { 220 /* Inherit hub's TT */ 221 dev->tt = dev->hub->tt; 226 dev->tt = (usb_tt_address_t) { 227 .address = -1, 228 .port = 0, 229 }; 222 230 } 223 231 … … 310 318 * @param endpoint USB endpoint number. 311 319 */ 312 static int usb2_bus_register_ep(bus_t *bus_base, endpoint_t *ep, const usb_endpoint_desc_t *desc)320 static int usb2_bus_register_ep(bus_t *bus_base, device_t *device, endpoint_t *ep, const usb_endpoint_desc_t *desc) 313 321 { 314 322 usb2_bus_t *bus = bus_to_usb2_bus(bus_base); 315 323 assert(ep); 316 324 317 assert(ep->device);325 ep->device = device; 318 326 319 327 /* Extract USB2-related information from endpoint_desc */ … … 347 355 usb2_bus_t *bus = bus_to_usb2_bus(bus_base); 348 356 assert(ep); 357 358 list_remove(&ep->link); 359 ep->device = NULL; 349 360 350 361 bus->free_bw += ep->bandwidth;
Note:
See TracChangeset
for help on using the changeset viewer.