Changeset 3f42eab in mainline for uspace/lib/usbdev/src/pipesinit.c


Ignore:
Timestamp:
2018-01-05T22:50:13Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c901632
Parents:
86650db
Message:

usbdev: remove dead code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/pipesinit.c

    r86650db r3f42eab  
    379379}
    380380
    381 /** Probe default control pipe for max packet size.
    382  *
    383  * The function tries to get the correct value of max packet size several
    384  * time before giving up.
    385  *
    386  * The session on the pipe shall not be started.
    387  *
    388  * @param pipe Default control pipe.
    389  * @return Error code.
    390  */
    391 int usb_pipe_probe_default_control(usb_pipe_t *pipe)
    392 {
    393         assert(pipe);
    394         static_assert(DEV_DESCR_MAX_PACKET_SIZE_OFFSET < CTRL_PIPE_MIN_PACKET_SIZE);
    395 
    396         if ((pipe->desc.direction != USB_DIRECTION_BOTH) ||
    397             (pipe->desc.transfer_type != USB_TRANSFER_CONTROL) ||
    398             (pipe->desc.endpoint_no != 0)) {
    399                 return EINVAL;
    400         }
    401 
    402         uint8_t dev_descr_start[CTRL_PIPE_MIN_PACKET_SIZE];
    403         size_t transferred_size;
    404         int rc;
    405         for (size_t attempt_var = 0; attempt_var < 3; ++attempt_var) {
    406                 rc = usb_request_get_descriptor(pipe, USB_REQUEST_TYPE_STANDARD,
    407                     USB_REQUEST_RECIPIENT_DEVICE, USB_DESCTYPE_DEVICE,
    408                     0, 0, dev_descr_start, CTRL_PIPE_MIN_PACKET_SIZE,
    409                     &transferred_size);
    410                 if (rc == EOK) {
    411                         if (transferred_size != CTRL_PIPE_MIN_PACKET_SIZE) {
    412                                 rc = ELIMIT;
    413                                 continue;
    414                         }
    415                         break;
    416                 }
    417         }
    418         if (rc != EOK) {
    419                 return rc;
    420         }
    421 
    422         pipe->desc.max_packet_size
    423             = dev_descr_start[DEV_DESCR_MAX_PACKET_SIZE_OFFSET];
    424 
    425         return EOK;
    426 }
    427 
    428381/**
    429382 * @}
Note: See TracChangeset for help on using the changeset viewer.