Changeset ca07cd3 in mainline for uspace/lib/usbvirt/ctrlpipe.c


Ignore:
Timestamp:
2010-10-25T13:23:33Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
23cb44b
Parents:
355f7c2
Message:

Code cleanup, various bugfixes

The internal functions of virtual device framework always get
device structure as parameter, thus possible enabling more devices
within single task (that is not possible because currently there
is no way to pass extra argument into callback_connection()).

Also, added some missing comments and completely removed the device
id nonsense (devices can send their descriptors and the hub is able
to enable/disable its ports).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbvirt/ctrlpipe.c

    r355f7c2 rca07cd3  
    4747usb_address_t dev_new_address = -1;
    4848
     49/** Tell request type.
     50 * By type is meant either standard, class, vendor or other.
     51 */
    4952static int request_get_type(uint8_t request_type)
    5053{
     
    5255}
    5356
    54 
    55 int control_pipe(usbvirt_control_transfer_t *transfer)
     57/** Handle communication over control pipe zero.
     58 */
     59int control_pipe(usbvirt_device_t *device, usbvirt_control_transfer_t *transfer)
    5660{
    5761        if (transfer->request_size < sizeof(usb_device_request_setup_packet_t)) {
     
    6872        switch (type) {
    6973                case REQUEST_TYPE_STANDARD:
    70                         rc = handle_std_request(request, remaining_data);
     74                        rc = handle_std_request(device, request, remaining_data);
    7175                        break;
    7276                case REQUEST_TYPE_CLASS:
     
    8084        }
    8185       
    82         if (dev_new_address != -1) {
     86        if (device->new_address != -1) {
    8387                /*
    8488                 * TODO: handle when this request is invalid (e.g.
    8589                 * setting address when in configured state).
    8690                 */
    87                 if (dev_new_address == 0) {
     91                if (device->new_address == 0) {
    8892                        device->state = USBVIRT_STATE_DEFAULT;
    8993                } else {
    9094                        device->state = USBVIRT_STATE_ADDRESS;
    9195                }
    92                 device->address = dev_new_address;
     96                device->address = device->new_address;
    9397               
    94                 dev_new_address = -1;
     98                device->new_address = -1;
    9599        }
    96100       
Note: See TracChangeset for help on using the changeset viewer.