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


Ignore:
Timestamp:
2010-10-26T22:21:45Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
efedee77
Parents:
fa2a361
Message:

Debugging support for libusbvirt

Added methods debug and lib_debug to device structure to simplify
debugging. Each method gets as a parameter debug level describing
verbosity of the message and also message tag that allows filtering
based on message type (e.g. messages related to transactions, to
device requests etc.).

File:
1 edited

Legend:

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

    rfa2a361 raab02fb  
    4545        ((value & GET_MIDBITS_MASK(size, shift)) >> shift)
    4646
    47 usb_address_t dev_new_address = -1;
     47
     48static const char *str_request_type(int type)
     49{
     50        switch (type) {
     51                case REQUEST_TYPE_STANDARD:
     52                        return "standard";
     53                case REQUEST_TYPE_CLASS:
     54                        return "class";
     55                default:
     56                        return "unknown";
     57        }
     58}
    4859
    4960/** Tell request type.
     
    5970int control_pipe(usbvirt_device_t *device, usbvirt_control_transfer_t *transfer)
    6071{
     72        device->lib_debug(device, 1, USBVIRT_DEBUGTAG_CONTROL_PIPE_ZERO,
     73            "op on control pipe zero (request_size=%u)", transfer->request_size);
     74       
    6175        if (transfer->request_size < sizeof(usb_device_request_setup_packet_t)) {
    6276                return ENOMEM;
     
    6983       
    7084        int rc = EOK;
     85       
     86        device->lib_debug(device, 2, USBVIRT_DEBUGTAG_CONTROL_PIPE_ZERO,
     87            "request type: %s", str_request_type(type));
    7188       
    7289        switch (type) {
     
    97114               
    98115                device->new_address = -1;
     116               
     117                device->lib_debug(device, 2, USBVIRT_DEBUGTAG_CONTROL_PIPE_ZERO,
     118                    "device address changed to %d (state %s)",
     119                    device->address, str_device_state(device->state));
    99120        }
    100121       
Note: See TracChangeset for help on using the changeset viewer.