Changes in uspace/drv/bus/usb/vhc/hub/virthubops.c [58563585:f81498d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/vhc/hub/virthubops.c
r58563585 rf81498d 33 33 * @brief Virtual USB hub operations. 34 34 */ 35 36 35 #include <errno.h> 37 36 #include <usb/classes/hub.h> … … 341 340 342 341 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) 343 350 344 351 /** Recipient: other. */ … … 346 353 /** Recipient: device. */ 347 354 #define REC_DEVICE USB_REQUEST_RECIPIENT_DEVICE 348 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 349 384 350 385 /** Hub operations on control endpoint zero. */ 351 386 static usbvirt_control_request_handler_t endpoint_zero_handlers[] = { 352 387 { 353 STD_REQ _IN(USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),354 .name = "Get StdDescriptor",388 STD_REQ(DIR_IN, REC_DEVICE, USB_DEVREQ_GET_DESCRIPTOR), 389 .name = "GetDescriptor", 355 390 .callback = req_get_descriptor 356 391 }, 357 392 { 358 CLASS_REQ _IN(REC_DEVICE, USB_DEVREQ_GET_DESCRIPTOR),359 .name = "Get ClassDescriptor",393 CLASS_REQ(DIR_IN, REC_DEVICE, USB_DEVREQ_GET_DESCRIPTOR), 394 .name = "GetDescriptor", 360 395 .callback = req_get_descriptor 361 396 }, 362 397 { 363 CLASS_REQ _IN(REC_OTHER, USB_HUB_REQUEST_GET_STATUS),398 CLASS_REQ(DIR_IN, REC_OTHER, USB_HUB_REQUEST_GET_STATUS), 364 399 .name = "GetPortStatus", 365 400 .callback = req_get_port_status 366 401 }, 367 402 { 368 CLASS_REQ _OUT(REC_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE),403 CLASS_REQ(DIR_OUT, REC_DEVICE, USB_HUB_REQUEST_CLEAR_FEATURE), 369 404 .name = "ClearHubFeature", 370 405 .callback = req_clear_hub_feature 371 406 }, 372 407 { 373 CLASS_REQ _OUT(REC_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE),408 CLASS_REQ(DIR_OUT, REC_OTHER, USB_HUB_REQUEST_CLEAR_FEATURE), 374 409 .name = "ClearPortFeature", 375 410 .callback = req_clear_port_feature 376 411 }, 377 412 { 378 CLASS_REQ _IN(REC_OTHER, USB_HUB_REQUEST_GET_STATE),413 CLASS_REQ(DIR_IN, REC_OTHER, USB_HUB_REQUEST_GET_STATE), 379 414 .name = "GetBusState", 380 415 .callback = req_get_bus_state 381 416 }, 382 417 { 383 CLASS_REQ _IN(REC_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR),418 CLASS_REQ(DIR_IN, REC_DEVICE, USB_HUB_REQUEST_GET_DESCRIPTOR), 384 419 .name = "GetHubDescriptor", 385 420 .callback = req_get_descriptor 386 421 }, 387 422 { 388 CLASS_REQ _IN(REC_DEVICE, USB_HUB_REQUEST_GET_STATUS),423 CLASS_REQ(DIR_IN, REC_DEVICE, USB_HUB_REQUEST_GET_STATUS), 389 424 .name = "GetHubStatus", 390 425 .callback = req_get_hub_status 391 426 }, 392 427 { 393 CLASS_REQ _IN(REC_OTHER, USB_HUB_REQUEST_GET_STATUS),428 CLASS_REQ(DIR_IN, REC_OTHER, USB_HUB_REQUEST_GET_STATUS), 394 429 .name = "GetPortStatus", 395 430 .callback = req_get_port_status 396 431 }, 397 432 { 398 CLASS_REQ _OUT(REC_DEVICE, USB_HUB_REQUEST_SET_FEATURE),433 CLASS_REQ(DIR_OUT, REC_DEVICE, USB_HUB_REQUEST_SET_FEATURE), 399 434 .name = "SetHubFeature", 400 435 .callback = req_set_hub_feature 401 436 }, 402 437 { 403 CLASS_REQ _OUT(REC_OTHER, USB_HUB_REQUEST_SET_FEATURE),438 CLASS_REQ(DIR_OUT, REC_OTHER, USB_HUB_REQUEST_SET_FEATURE), 404 439 .name = "SetPortFeature", 405 440 .callback = req_set_port_feature
Note:
See TracChangeset
for help on using the changeset viewer.