Ignore:
File:
1 edited

Legend:

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

    r160b75e r3238506  
    250250}
    251251
    252 /** Change address of connected device.
    253  * This function automatically updates the backing connection to point to
    254  * the new address.
    255  *
    256  * @param pipe Control endpoint pipe (session must be already started).
    257  * @param new_address New USB address to be set (in native endianness).
    258  * @return Error code.
    259  */
    260 int usb_request_set_address(usb_pipe_t *pipe,
    261     usb_address_t new_address)
    262 {
    263         if ((new_address < 0) || (new_address >= USB11_ADDRESS_MAX)) {
    264                 return EINVAL;
    265         }
    266 
    267         uint16_t addr = uint16_host2usb((uint16_t)new_address);
    268 
    269         int rc = usb_control_request_set(pipe,
    270             USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
    271             USB_DEVREQ_SET_ADDRESS,
    272             addr, 0,
    273             NULL, 0);
    274 
    275         if (rc != EOK) {
    276                 return rc;
    277         }
    278 
    279         assert(pipe->wire != NULL);
    280         /* TODO: prevent other from accessing wire now. */
    281         pipe->wire->address = new_address;
    282 
    283         return EOK;
    284 }
    285 
    286252/** Retrieve USB descriptor of a USB device.
    287253 *
     
    425391
    426392        /* Everything is okay, copy the descriptor. */
    427         memcpy(descriptor, &descriptor_tmp,
    428             sizeof(descriptor_tmp));
     393        memcpy(descriptor, &descriptor_tmp, sizeof(descriptor_tmp));
    429394
    430395        return EOK;
     
    470435
    471436        /* Everything is okay, copy the descriptor. */
    472         memcpy(descriptor, &descriptor_tmp,
    473             sizeof(descriptor_tmp));
     437        memcpy(descriptor, &descriptor_tmp, sizeof(descriptor_tmp));
    474438
    475439        return EOK;
Note: See TracChangeset for help on using the changeset viewer.