Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/classes/hid.h

    r1b29d6fa r0475e13  
    2727 */
    2828
    29 /** @addtogroup libusb usb
     29/** @addtogroup libusb
    3030 * @{
    3131 */
     
    3737
    3838#include <usb/usb.h>
    39 #include <driver.h>
    4039#include <usb/classes/hidparser.h>
     40#include <usb/descriptor.h>
    4141
    4242/** USB/HID device requests. */
     
    5151} usb_hid_request_t;
    5252
     53typedef enum {
     54        USB_HID_REPORT_TYPE_INPUT = 1,
     55        USB_HID_REPORT_TYPE_OUTPUT = 2,
     56        USB_HID_REPORT_TYPE_FEATURE = 3
     57} usb_hid_report_type_t;
     58
     59typedef enum {
     60        USB_HID_PROTOCOL_BOOT = 0,
     61        USB_HID_PROTOCOL_REPORT = 1
     62} usb_hid_protocol_t;
     63
     64/** USB/HID subclass constants. */
     65typedef enum {
     66        USB_HID_SUBCLASS_NONE = 0,
     67        USB_HID_SUBCLASS_BOOT = 1
     68} usb_hid_subclass_t;
     69
    5370/** USB/HID interface protocols. */
    5471typedef enum {
     
    5673        USB_HID_PROTOCOL_KEYBOARD = 1,
    5774        USB_HID_PROTOCOL_MOUSE = 2
    58 } usb_hid_protocol_t;
     75} usb_hid_iface_protocol_t;
    5976
    6077/** Part of standard USB HID descriptor specifying one class descriptor.
     
    6380 */
    6481typedef struct {
    65         /** Type of class descriptor (Report or Physical). */
    66         uint8_t class_descriptor_type;
    67         /** Length of class descriptor. */
    68         uint16_t class_descriptor_length;
    69 } __attribute__ ((packed)) usb_standard_hid_descriptor_class_item_t;
     82        /** Type of class-specific descriptor (Report or Physical). */
     83        uint8_t type;
     84        /** Length of class-specific descriptor in bytes. */
     85        uint16_t length;
     86} __attribute__ ((packed)) usb_standard_hid_class_descriptor_info_t;
    7087
    7188/** Standard USB HID descriptor.
     
    7390 * (See HID Specification, p.22)
    7491 *
    75  * It is actually only the "header" of the descriptor, as it may have arbitrary
    76  * length if more than one class descritor is provided.
     92 * It is actually only the "header" of the descriptor, it does not contain
     93 * the last two mandatory fields (type and length of the first class-specific
     94 * descriptor).
    7795 */
    7896typedef struct {
    79         /** Size of this descriptor in bytes. */
     97        /** Total size of this descriptor in bytes.
     98         *
     99         * This includes all class-specific descriptor info - type + length
     100         * for each descriptor.
     101         */
    80102        uint8_t length;
    81103        /** Descriptor type (USB_DESCTYPE_HID). */
     
    85107        /** Country code of localized hardware. */
    86108        uint8_t country_code;
    87         /** Total number of class (i.e. Report and Physical) descriptors. */
    88         uint8_t class_count;
    89         /** First mandatory class descriptor info. */
    90         usb_standard_hid_descriptor_class_item_t class_descriptor;
     109        /** Total number of class-specific (i.e. Report and Physical)
     110         * descriptors.
     111         *
     112         * @note There is always only one Report descriptor.
     113         */
     114        uint8_t class_desc_count;
     115        /** First mandatory class descriptor (Report) info. */
     116        usb_standard_hid_class_descriptor_info_t report_desc_info;
    91117} __attribute__ ((packed)) usb_standard_hid_descriptor_t;
    92118
    93 
    94 /**
    95  * @brief USB/HID keyboard device type.
    96  *
    97  * Quite dummy right now.
    98  */
    99 typedef struct {
    100         device_t *device;
    101         usb_address_t address;
    102         usb_endpoint_t poll_endpoint;
    103         usb_hid_report_parser_t *parser;
    104 } usb_hid_dev_kbd_t;
    105119
    106120#endif
Note: See TracChangeset for help on using the changeset viewer.