Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/vhc/hub/virthubops.c

    rf81498d r58563585  
    3333 * @brief Virtual USB hub operations.
    3434 */
     35
    3536#include <errno.h>
    3637#include <usb/classes/hub.h>
     
    340341
    341342
    342 /** IN class request. */
    343 #define CLASS_REQ_IN(recipient) \
    344         USBVIRT_MAKE_CONTROL_REQUEST_TYPE(USB_DIRECTION_IN, \
    345         USBVIRT_REQUEST_TYPE_CLASS, recipient)
    346 /** OUT class request. */
    347 #define CLASS_REQ_OUT(recipient) \
    348         USBVIRT_MAKE_CONTROL_REQUEST_TYPE(USB_DIRECTION_OUT, \
    349         USBVIRT_REQUEST_TYPE_CLASS, recipient)
    350343
    351344/** Recipient: other. */
     
    353346/** Recipient: device. */
    354347#define REC_DEVICE USB_REQUEST_RECIPIENT_DEVICE
    355 /** Direction: in. */
    356 #define DIR_IN USB_DIRECTION_IN
    357 /** Direction: out. */
    358 #define DIR_OUT USB_DIRECTION_OUT
    359 
    360 
    361 /** Create a class request.
    362  *
    363  * @param direction Request direction.
    364  * @param recipient Request recipient.
    365  * @param req Request code.
    366  */
    367 #define CLASS_REQ(direction, recipient, req) \
    368         .req_direction = direction, \
    369         .req_recipient = recipient, \
    370         .req_type = USB_REQUEST_TYPE_CLASS, \
    371         .request = req
    372 
    373 /** Create a standard request.
    374  *
    375  * @param direction Request direction.
    376  * @param recipient Request recipient.
    377  * @param req Request code.
    378  */
    379 #define STD_REQ(direction, recipient, req) \
    380         .req_direction = direction, \
    381         .req_recipient = recipient, \
    382         .req_type = USB_REQUEST_TYPE_STANDARD, \
    383         .request = req
     348
    384349
    385350/** Hub operations on control endpoint zero. */
    386351static usbvirt_control_request_handler_t endpoint_zero_handlers[] = {
    387352        {
    388                 STD_REQ(DIR_IN, REC_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
    389                 .name = "GetDescriptor",
     353                STD_REQ_IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
     354                .name = "GetStdDescriptor",
    390355                .callback = req_get_descriptor
    391356        },
    392357        {
    393                 CLASS_REQ(DIR_IN, REC_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
    394                 .name = "GetDescriptor",
     358                CLASS_REQ_IN(REC_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),
     359                .name = "GetClassDescriptor",
    395360                .callback = req_get_descriptor
    396361        },
    397362        {
    398                 CLASS_REQ(DIR_IN, REC_OTHER, USB_HUB_REQUEST_GET_STATUS),
     363                CLASS_REQ_IN(REC_OTHER, USB_HUB_REQUEST_GET_STATUS),
    399364                .name = "GetPortStatus",
    400365                .callback = req_get_port_status
    401366        },
    402367        {
    403                 CLASS_REQ(DIR_OUT, REC_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),
     368                CLASS_REQ_OUT(REC_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),
    404369                .name = "ClearHubFeature",
    405370                .callback = req_clear_hub_feature
    406371        },
    407372        {
    408                 CLASS_REQ(DIR_OUT, REC_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),
     373                CLASS_REQ_OUT(REC_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),
    409374                .name = "ClearPortFeature",
    410375                .callback = req_clear_port_feature
    411376        },
    412377        {
    413                 CLASS_REQ(DIR_IN, REC_OTHER, USB_HUB_REQUEST_GET_STATE),
     378                CLASS_REQ_IN(REC_OTHER, USB_HUB_REQUEST_GET_STATE),
    414379                .name = "GetBusState",
    415380                .callback = req_get_bus_state
    416381        },
    417382        {
    418                 CLASS_REQ(DIR_IN, REC_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),
     383                CLASS_REQ_IN(REC_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),
    419384                .name = "GetHubDescriptor",
    420385                .callback = req_get_descriptor
    421386        },
    422387        {
    423                 CLASS_REQ(DIR_IN, REC_DEVICE, USB_HUB_REQUEST_GET_STATUS),
     388                CLASS_REQ_IN(REC_DEVICE, USB_HUB_REQUEST_GET_STATUS),
    424389                .name = "GetHubStatus",
    425390                .callback = req_get_hub_status
    426391        },
    427392        {
    428                 CLASS_REQ(DIR_IN, REC_OTHER, USB_HUB_REQUEST_GET_STATUS),
     393                CLASS_REQ_IN(REC_OTHER, USB_HUB_REQUEST_GET_STATUS),
    429394                .name = "GetPortStatus",
    430395                .callback = req_get_port_status
    431396        },
    432397        {
    433                 CLASS_REQ(DIR_OUT, REC_DEVICE, USB_HUB_REQUEST_SET_FEATURE),
     398                CLASS_REQ_OUT(REC_DEVICE, USB_HUB_REQUEST_SET_FEATURE),
    434399                .name = "SetHubFeature",
    435400                .callback = req_set_hub_feature
    436401        },
    437402        {
    438                 CLASS_REQ(DIR_OUT, REC_OTHER, USB_HUB_REQUEST_SET_FEATURE),
     403                CLASS_REQ_OUT(REC_OTHER, USB_HUB_REQUEST_SET_FEATURE),
    439404                .name = "SetPortFeature",
    440405                .callback = req_set_port_feature
Note: See TracChangeset for help on using the changeset viewer.