Changeset 2833bb4 in mainline for uspace/lib/usbhost/src/utility.c


Ignore:
Timestamp:
2018-01-19T17:38:22Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
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)
Message:

xhci: recognise hubs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/utility.c

    r944f8fdd r2833bb4  
    162162}
    163163
     164int 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
    164192int hc_device_explore(device_t *device)
    165193{
Note: See TracChangeset for help on using the changeset viewer.