Changeset 45e49e6 in mainline for uspace/drv/bus/usb/usbhub/usbhub.c
- Timestamp:
- 2018-01-20T18:53:23Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 26beeda
- Parents:
- 24fcb8b
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-20 18:52:27)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-20 18:53:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/usbhub.c
r24fcb8b r45e49e6 318 318 usb_device_get_default_pipe(hub_dev->usb_device); 319 319 320 usb_descriptor_type_t desc_type = hub_dev->speed >= USB_SPEED_SUPER 321 ? USB_DESCTYPE_SSPEED_HUB : USB_DESCTYPE_HUB; 322 320 323 usb_hub_descriptor_header_t descriptor; 321 324 size_t received_size; 322 325 int opResult = usb_request_get_descriptor(control_pipe, 323 326 USB_REQUEST_TYPE_CLASS, USB_REQUEST_RECIPIENT_DEVICE, 324 USB_DESCTYPE_HUB, 0, 0, &descriptor,327 desc_type, 0, 0, &descriptor, 325 328 sizeof(usb_hub_descriptor_header_t), &received_size); 326 329 if (opResult != EOK) { … … 334 337 hub_dev->port_count = descriptor.port_count; 335 338 hub_dev->control_pipe = control_pipe; 339 340 if ((opResult = usb_hub_set_depth(hub_dev))) { 341 usb_log_error("(%p): Failed to set hub depth: %s.", 342 hub_dev, str_error(opResult)); 343 return opResult; 344 } 336 345 337 346 hub_dev->ports = calloc(hub_dev->port_count, sizeof(usb_hub_port_t)); … … 458 467 } 459 468 } 469 } 470 471 /** 472 * Set feature on the real hub port. 473 * 474 * @param port Port structure. 475 * @param feature Feature selector. 476 */ 477 int usb_hub_set_depth(const usb_hub_dev_t *hub) 478 { 479 assert(hub); 480 481 /* Slower hubs do not care about depth */ 482 if (hub->speed < USB_SPEED_SUPER) 483 return EOK; 484 485 const usb_device_request_setup_packet_t set_request = { 486 .request_type = USB_HUB_REQ_TYPE_SET_HUB_DEPTH, 487 .request = USB_HUB_REQUEST_SET_HUB_DEPTH, 488 .value = uint16_host2usb(usb_device_get_depth(hub->usb_device)), 489 .index = 0, 490 .length = 0, 491 }; 492 return usb_pipe_control_write(hub->control_pipe, &set_request, 493 sizeof(set_request), NULL, 0); 460 494 } 461 495
Note:
See TracChangeset
for help on using the changeset viewer.