Ignore:
File:
1 edited

Legend:

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

    rc32688d rd972534  
    3737
    3838#include <stdint.h>
    39 #include <adt/list.h>
    40 #include <usb/classes/hid_report_items.h>
    41 
    42 /**
    43  * Item prefix
    44  */
    45 #define USB_HID_ITEM_SIZE(data)         ((uint8_t)(data & 0x3))
    46 #define USB_HID_ITEM_TAG(data)          ((uint8_t)((data & 0xF0) >> 4))
    47 #define USB_HID_ITEM_TAG_CLASS(data)    ((uint8_t)((data & 0xC) >> 2))
    48 #define USB_HID_ITEM_IS_LONG(data)      (data == 0xFE)
    49 
    50 
    51 /**
    52  * Input/Output/Feature Item flags
    53  */
    54 /** Constant (1) / Variable (0) */
    55 #define USB_HID_ITEM_FLAG_CONSTANT(flags)       ((flags & 0x1) == 0x1)
    56 /** Variable (1) / Array (0) */
    57 #define USB_HID_ITEM_FLAG_VARIABLE(flags)       ((flags & 0x2) == 0x2)
    58 /** Absolute / Relative*/
    59 #define USB_HID_ITEM_FLAG_RELATIVE(flags)       ((flags & 0x4) == 0x4)
    60 /** Wrap / No Wrap */
    61 #define USB_HID_ITEM_FLAG_WRAP(flags)           ((flags & 0x8) == 0x8)
    62 #define USB_HID_ITEM_FLAG_LINEAR(flags)         ((flags & 0x10) == 0x10)
    63 #define USB_HID_ITEM_FLAG_PREFERRED(flags)      ((flags & 0x20) == 0x20)
    64 #define USB_HID_ITEM_FLAG_POSITION(flags)       ((flags & 0x40) == 0x40)
    65 #define USB_HID_ITEM_FLAG_VOLATILE(flags)       ((flags & 0x80) == 0x80)
    66 #define USB_HID_ITEM_FLAG_BUFFERED(flags)       ((flags & 0x100) == 0x100)
    67 
    68 
    69 /**
    70  * Description of path of usage pages and usages in report descriptor
    71  */
    72 typedef struct {
    73         int32_t usage_page;
    74 } usb_hid_report_path_t;
    7539
    7640/**
     
    7842 */
    7943typedef struct {
    80         int32_t id;
    81         int32_t usage_page;
    82         int32_t usage; 
    83         int32_t usage_minimum;
    84         int32_t usage_maximum;
    85         int32_t logical_minimum;
    86         int32_t logical_maximum;
    87         int32_t size;
    88         int32_t count;
    89         size_t offset;
    90         int32_t delimiter;
    9144
    92         int32_t unit_exponent;
    93         int32_t unit;
     45        uint8_t usage_min;
     46        uint8_t usage_max;
     47        uint8_t logical_min;
     48        uint8_t logical_max;
     49        uint8_t size;
     50        uint8_t count;
     51        uint8_t offset;
    9452
    95         /*
    96          * some not yet used fields
    97          */
    98         int32_t string_index;
    99         int32_t string_minimum;
    100         int32_t string_maximum;
    101         int32_t designator_index;
    102         int32_t designator_minimum;
    103         int32_t designator_maximum;
    104         int32_t physical_minimum;
    105         int32_t physical_maximum;
    106 
    107         uint8_t item_flags;
    108 
    109         link_t link;
    11053} usb_hid_report_item_t;
    11154
    11255
    11356/** HID report parser structure. */
    114 typedef struct {       
    115         link_t input;
    116         link_t output;
    117         link_t feature;
    118 } usb_hid_report_parser_t;     
    119 
     57typedef struct {
     58} usb_hid_report_parser_t;
    12059
    12160
     
    188127int usb_hid_boot_keyboard_output_report(uint8_t leds, uint8_t *data, size_t size);
    189128
    190 int usb_hid_parser_init(usb_hid_report_parser_t *parser);
    191129int usb_hid_parse_report_descriptor(usb_hid_report_parser_t *parser,
    192130    const uint8_t *data, size_t size);
     
    196134    const usb_hid_report_in_callbacks_t *callbacks, void *arg);
    197135
    198 int usb_hid_report_input_length(const usb_hid_report_parser_t *parser,
    199         const usb_hid_report_path_t *path);
    200136
    201 
    202 void usb_hid_free_report_parser(usb_hid_report_parser_t *parser);
    203 
    204 void usb_hid_descriptor_print(usb_hid_report_parser_t *parser);
     137int usb_hid_free_report_parser(usb_hid_report_parser_t *parser);
    205138
    206139#endif
Note: See TracChangeset for help on using the changeset viewer.