Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 306a36d in mainline for uspace/lib/usbhost/src/usb2_bus.c


Ignore:
Timestamp:
2017-11-19T23:43:31Z (4 years ago)
Author:
Aearsis <Hlavaty.Ondrej@…>
Branches:
lfn, master
Children:
ff14aede
Parents:
e76c0ea
Message:

xhci: configuration of endpoint 0

Moved fetching of the first 8B of device descriptor from usb2_bus to
hcd, and using it in xhci bus. Also, the value was previously read wrong
by the endpoint descriptor macros, although the value is raw in the
device descriptor - now fixed.

File:
1 edited

Legend:

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

    re76c0ea r306a36d  
    132132        }
    133133
    134         /* Get max packet size for default pipe */
    135         usb_standard_device_descriptor_t desc = { 0 };
    136         const usb_device_request_setup_packet_t get_device_desc_8 =
    137             GET_DEVICE_DESC(CTRL_PIPE_MIN_PACKET_SIZE);
    138 
    139         usb_log_debug("Device(%d): Requesting first 8B of device descriptor.",
    140             address);
    141         ssize_t got = hcd_send_batch_sync(hcd, dev, usb2_default_target, USB_DIRECTION_IN,
    142             (char *) &desc, CTRL_PIPE_MIN_PACKET_SIZE, *(uint64_t *)&get_device_desc_8,
    143             "read first 8 bytes of dev descriptor");
    144 
    145         if (got != CTRL_PIPE_MIN_PACKET_SIZE) {
    146                 err = got < 0 ? got : EOVERFLOW;
    147                 usb_log_error("Device(%d): Failed to get 8B of dev descr: %s.",
    148                     address, str_error(err));
    149                 goto err_default_control_ep;
    150         }
     134        uint16_t max_packet_size;
     135        if ((err = hcd_get_ep0_max_packet_size(&max_packet_size, hcd, dev)))
     136                goto err_address;
    151137
    152138        /* Set new address */
     
    158144        if (err != 0) {
    159145                usb_log_error("Device(%d): Failed to set new address: %s.",
    160                     address, str_error(got));
     146                    address, str_error(err));
    161147                goto err_default_control_ep;
    162148        }
     
    175161                .transfer_type = USB_TRANSFER_CONTROL,
    176162                .direction = USB_DIRECTION_BOTH,
    177                 .max_packet_size = ED_MPS_PACKET_SIZE_GET(uint16_usb2host(desc.max_packet_size)),
    178                 .packets = ED_MPS_TRANS_OPPORTUNITIES_GET(uint16_usb2host(desc.max_packet_size)),
     163                .max_packet_size = max_packet_size,
     164                .packets = 1,
    179165        };
    180166
Note: See TracChangeset for help on using the changeset viewer.