Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 2963a0d in mainline


Ignore:
Timestamp:
2011-12-06T21:04:40Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
481dec00
Parents:
b6bade0
Message:

ohci, root hub: Implement standard device GET_STATUS requests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/root_hub.c

    rb6bade0 r2963a0d  
    100100        .attributes = USB_TRANSFER_INTERRUPT,
    101101        .descriptor_type = USB_DESCTYPE_ENDPOINT,
    102         .endpoint_address = 1 + (1 << 7),
     102        .endpoint_address = 1 | (1 << 7),
    103103        .length = sizeof(usb_standard_endpoint_descriptor_t),
    104104        .max_packet_size = 2,
     
    428428                        TRANSFER_END_DATA(request, &data, sizeof(data));
    429429                }
     430        case SETUP_REQUEST_TO_HOST(USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE):
     431                if (request->buffer_size < 2) {
     432                        usb_log_error("Buffer(%zu) too small for hub generic "
     433                            "get status request.\n", request->buffer_size);
     434                        TRANSFER_END(request, EOVERFLOW);
     435                } else {
     436                        static const uint16_t data =
     437                            uint16_host2usb(USB_DEVICE_STATUS_SELF_POWERED);
     438                        TRANSFER_END_DATA(request, &data, sizeof(data));
     439                }
     440
     441        case SETUP_REQUEST_TO_HOST(USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_INTERFACE):
     442                /* Hubs are allowed to have only one interface */
     443                if (request_packet->index != 0)
     444                        TRANSFER_END(request, EINVAL);
     445                /* Fall through, as the answer will be the same: 0x0000 */
     446        case SETUP_REQUEST_TO_HOST(USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_ENDPOINT):
     447                /* Endpoint 0 (default control) and 1 (interrupt) */
     448                if (request_packet->index >= 2)
     449                        TRANSFER_END(request, EINVAL);
     450
     451                if (request->buffer_size < 2) {
     452                        usb_log_error("Buffer(%zu) too small for hub generic "
     453                            "get status request.\n", request->buffer_size);
     454                        TRANSFER_END(request, EOVERFLOW);
     455                } else {
     456                        /* Endpoints are OK. (We don't halt) */
     457                        static const uint16_t data = 0;
     458                        TRANSFER_END_DATA(request, &data, sizeof(data));
     459                }
     460
    430461        default:
    431462                usb_log_error("Unsupported GET_STATUS request.\n");
Note: See TracChangeset for help on using the changeset viewer.