Ignore:
Timestamp:
2016-07-22T08:24:47Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f76d2c2
Parents:
5b18137 (diff), 8351f9a4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jan.vesely/helenos/usb

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbvirt/src/ctrltransfer.c

    r5b18137 rb4b534ac  
    5050 */
    5151int process_control_transfer(usbvirt_device_t *dev,
    52     usbvirt_control_request_handler_t *control_handlers,
    53     usb_device_request_setup_packet_t *setup,
     52    const usbvirt_control_request_handler_t *control_handlers,
     53    const usb_device_request_setup_packet_t *setup,
    5454    uint8_t *data, size_t *data_sent_size)
    5555{
     
    6060                return EFORWARD;
    6161        }
    62 
    63         usb_direction_t direction = setup->request_type & 128 ?
    64             USB_DIRECTION_IN : USB_DIRECTION_OUT;
    65         usb_request_recipient_t req_recipient = setup->request_type & 31;
    66         usb_request_type_t req_type = (setup->request_type >> 5) & 3;
    67 
    68         usbvirt_control_request_handler_t *handler = control_handlers;
    69         while (handler->callback != NULL) {
    70                 if (handler->req_direction != direction) {
    71                         goto next;
    72                 }
    73                 if (handler->req_recipient != req_recipient) {
    74                         goto next;
    75                 }
    76                 if (handler->req_type != req_type) {
    77                         goto next;
    78                 }
    79                 if (handler->request != setup->request) {
    80                         goto next;
     62        const usbvirt_control_request_handler_t *handler = control_handlers;
     63        for (;handler->callback != NULL; ++handler) {
     64                if (handler->request != setup->request ||
     65                    handler->request_type != setup->request_type) {
     66                        continue;
    8167                }
    8268
     
    8470                    usb_debug_str_buffer((uint8_t*) setup, sizeof(*setup), 0));
    8571                int rc = handler->callback(dev, setup, data, data_sent_size);
    86                 if (rc == EFORWARD) {
    87                         goto next;
     72                if (rc != EFORWARD) {
     73                        return rc;
    8874                }
    8975
    90                 return rc;
    91 
    92 next:
    93                 handler++;
    9476        }
    9577
Note: See TracChangeset for help on using the changeset viewer.