1 /* 2 * Copyright 2004-2010, Haiku Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _USB_HID_H 6 #define _USB_HID_H 7 8 9 #include <SupportDefs.h> 10 #include <usb/USB_hid_page_alphanumeric_display.h> 11 #include <usb/USB_hid_page_arcade.h> 12 #include <usb/USB_hid_page_bar_code_scanner.h> 13 #include <usb/USB_hid_page_battery_system.h> 14 #include <usb/USB_hid_page_consumer.h> 15 #include <usb/USB_hid_page_digitizers.h> 16 #include <usb/USB_hid_page_game_controls.h> 17 #include <usb/USB_hid_page_generic_desktop.h> 18 #include <usb/USB_hid_page_generic_device_controls.h> 19 #include <usb/USB_hid_page_keyboard.h> 20 #include <usb/USB_hid_page_led.h> 21 #include <usb/USB_hid_page_magnetic_stripe_reader.h> 22 #include <usb/USB_hid_page_medical_instrument.h> 23 #include <usb/USB_hid_page_pid.h> 24 #include <usb/USB_hid_page_power_device.h> 25 #include <usb/USB_hid_page_simulation.h> 26 #include <usb/USB_hid_page_telephony.h> 27 #include <usb/USB_hid_page_usb_monitor.h> 28 #include <usb/USB_hid_page_vesa_virtual_controls.h> 29 #include <usb/USB_hid_page_vr_controls.h> 30 #include <usb/USB_hid_page_weighing_device.h> 31 32 33 /* References: 34 * 35 * Device Class Definition for Human Interface Devices (HID) Ver. 1.11 36 * http://www.usb.org/developers/devclass_docs/hid1_11.pdf 37 * 38 * HID Usage Tables Ver. 1.12 39 * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf 40 * 41 * Device Class Definition for Physical Interface Deviced (PID) Ver. 1.0 42 * http://www.usb.org/developers/devclass_docs/pid1_01.pdf 43 * 44 * Universal Serial Bus Usage Tables for HID Power Devices Ver. 1.0 45 * http://www.usb.org/developers/devclass_docs/pdcv10.pdf 46 * 47 * HID Point of Sale Usage Tables Ver. 1.0 48 * http://www.usb.org/developers/devclass_docs/pos1_02.pdf 49 * 50 * USB Monitor Control Class Specification, Rev. 1.0 51 * http://www.usb.org/developers/devclass_docs/usbmon10.pdf 52 * 53 * Open Arcade Architecture Device (OAAD) 54 * Data Format Specification Rev. 1.100 55 * http://www.usb.org/developers/devclass_docs/oaaddataformatsv6.pdf 56 */ 57 58 #define USB_HID_DEVICE_CLASS 0x03 59 #define USB_HID_CLASS_VERSION 0x0100 60 61 // HID Interface Subclasses 62 enum { 63 B_USB_HID_INTERFACE_NO_SUBCLASS = 0x00, // No Subclass 64 B_USB_HID_INTERFACE_BOOT_SUBCLASS // Boot Interface Subclass 65 }; 66 67 // HID Class-Specific descriptor subtypes 68 enum { 69 B_USB_HID_DESCRIPTOR_HID = 0x21, 70 B_USB_HID_DESCRIPTOR_REPORT, 71 B_USB_HID_DESCRIPTOR_PHYSICAL 72 }; 73 74 // HID Class-specific requests 75 enum { 76 B_USB_REQUEST_HID_GET_REPORT = 0x01, 77 B_USB_REQUEST_HID_GET_IDLE, 78 B_USB_REQUEST_HID_GET_PROTOCOL, 79 80 B_USB_REQUEST_HID_SET_REPORT = 0x09, 81 B_USB_REQUEST_HID_SET_IDLE, 82 B_USB_REQUEST_HID_SET_PROTOCOL 83 }; 84 85 // HID Class-specific requests report types 86 enum { 87 B_USB_REQUEST_HID_INPUT_REPORT = 0x01, 88 B_USB_REQUEST_HID_OUTPUT_REPORT, 89 B_USB_REQUEST_HID_FEATURE_REPORT 90 }; 91 92 // HID Usage Pages 93 enum { 94 B_HID_USAGE_PAGE_GENERIC_DESKTOP = 0x1, 95 B_HID_USAGE_PAGE_SIMULATION, 96 B_HID_USAGE_PAGE_VR, 97 B_HID_USAGE_PAGE_SPORT, 98 B_HID_USAGE_PAGE_GAME, 99 B_HID_USAGE_PAGE_GENERIC, 100 B_HID_USAGE_PAGE_KEYBOARD, 101 B_HID_USAGE_PAGE_LED, 102 B_HID_USAGE_PAGE_BUTTON, 103 B_HID_USAGE_PAGE_ORDINAL, 104 B_HID_USAGE_PAGE_TELEPHONY, 105 B_HID_USAGE_PAGE_CONSUMER, 106 B_HID_USAGE_PAGE_DIGITIZER, 107 108 B_HID_USAGE_PAGE_PID = 0xf, 109 B_HID_USAGE_PAGE_UNICODE, 110 B_HID_USAGE_PAGE_ALPHANUM_DISPLAY = 0x14, 111 B_HID_USAGE_PAGE_MEDICAL = 0x40, 112 113 B_HID_USAGE_PAGE_USB_MONITOR = 0x80, // alt. B_HID_USAGE_PAGE_MONITOR_0, 114 B_HID_USAGE_PAGE_USB_ENUMERATED_VALUES, // alt. B_HID_USAGE_PAGE_MONITOR_1, 115 B_HID_USAGE_PAGE_VESA_VIRTUAL_CONTROLS, // alt. B_HID_USAGE_PAGE_MONITOR_2, 116 B_HID_USAGE_PAGE_MONITOR_3, 117 118 B_HID_USAGE_PAGE_POWER_DEVICE = 0x84, // alt. B_HID_USAGE_PAGE_POWER_0, 119 B_HID_USAGE_PAGE_BATTERY_SYSTEM, // alt. B_HID_USAGE_PAGE_POWER_1, 120 B_HID_USAGE_PAGE_POWER_2, 121 B_HID_USAGE_PAGE_POWER_3, 122 123 B_HID_USAGE_PAGE_BAR_CODE_SCANNER = 0x8c, 124 B_HID_USAGE_PAGE_WEIGHING_DEVICES, // alt. B_HID_USAGE_PAGE_SCALE, 125 B_HID_USAGE_PAGE_MAGNETIC_STRIPE_READER, 126 B_HID_USAGE_PAGE_RESERVED_POS_PAGE, 127 B_HID_USAGE_PAGE_CAMERA_CONTROL, 128 B_HID_USAGE_PAGE_ARCADE, 129 130 B_HID_USAGE_PAGE_MICROSOFT = 0xff00 131 }; 132 133 typedef struct { 134 uint8 length; 135 uint8 descriptor_type; 136 uint16 hid_version; 137 uint8 country_code; 138 uint8 num_descriptors; 139 struct { 140 uint8 descriptor_type; 141 uint16 descriptor_length; 142 } _PACKED descriptor_info[1]; 143 } _PACKED usb_hid_descriptor; 144 145 146 #endif // _USB_HID_H 147