[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH 4/5] hid: Specify interface



Signed-off-by: Max Reitz <max@xxxxxxxxxx>
---
 include/cdi-osdep.h        |  20 ++++
 include/cdi.h              |   1 +
 include/cdi/hid-keycodes.h | 262 +++++++++++++++++++++++++++++++++++++++++++++
 include/cdi/hid-ledcodes.h |  85 +++++++++++++++
 include/cdi/hid.h          | 113 +++++++++++++++++++
 5 files changed, 481 insertions(+)
 create mode 100644 include/cdi/hid-keycodes.h
 create mode 100644 include/cdi/hid-ledcodes.h
 create mode 100644 include/cdi/hid.h

diff --git a/include/cdi-osdep.h b/include/cdi-osdep.h
index 2a80be8..89038c7 100644
--- a/include/cdi-osdep.h
+++ b/include/cdi-osdep.h
@@ -67,6 +67,26 @@ typedef struct {
 
 /**
  * \german
+ * OS-spezifische Daten zu HIDs.
+ * \endgerman
+ * \english
+ * OS-specific HID data.
+ * \endenglish
+ * \thuringiansaxonian
+ * Vonnä jäwailschn Bedriebssysdääm abhängsche Dåhdn, nu für so HID-Dingor.
+ * \endthuringiansaxonian
+ * \french
+ * Des données tributaires du système d'exploitation pour des HIDs.
+ * \endfrench
+ * \japanese
+ * HIDを記述するとあるOSの依存のデータ。
+ * \endjapanese
+ */
+typedef struct {
+} cdi_hid_osdep;
+
+/**
+ * \german
  * OS-spezifische Daten fuer einen ISA-DMA-Zugriff
  * \endgerman
  * \english
diff --git a/include/cdi.h b/include/cdi.h
index 8ed0738..f90f5ea 100644
--- a/include/cdi.h
+++ b/include/cdi.h
@@ -119,6 +119,7 @@ typedef enum {
     CDI_FILESYSTEM      = 9,
     CDI_PCI             = 10,
     CDI_AHCI            = 11,
+    CDI_HID             = 12,
 } cdi_device_type_t;
 
 struct cdi_driver;
diff --git a/include/cdi/hid-keycodes.h b/include/cdi/hid-keycodes.h
new file mode 100644
index 0000000..63f6793
--- /dev/null
+++ b/include/cdi/hid-keycodes.h
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2015 Max Reitz
+ *
+ * This program is free software. It comes without any warranty, to
+ * the extent permitted by applicable law. You can redistribute it
+ * and/or modify it under the terms of the Do What The Fuck You Want
+ * To Public License, Version 2, as published by Sam Hocevar. See
+ * http://sam.zoy.org/projects/COPYING.WTFPL for more details.
+ */
+
+#ifndef _CDI_HID_KEYCODES_H_
+#define _CDI_HID_KEYCODES_H_
+
+/**
+ * These codes are those used by USB HID keyboards
+ * (see Universal Serial Bus HID Usage Tables, section 10
+ *  "Keyboard/Keypad Page (0x07)").
+ *
+ * Note that the naming convention follows the US keyboard layout. Non-US keys
+ * are named after the DE-de keyboard layout (if available).
+ */
+enum cdi_hid_keycodes {
+    CDI_HID_KEY_A                   = 0x04,
+    CDI_HID_KEY_B,
+    CDI_HID_KEY_C,
+    CDI_HID_KEY_D,
+    CDI_HID_KEY_E,
+    CDI_HID_KEY_F,
+    CDI_HID_KEY_G,
+    CDI_HID_KEY_H,
+    CDI_HID_KEY_I,
+    CDI_HID_KEY_J,
+    CDI_HID_KEY_K,
+    CDI_HID_KEY_L,
+    CDI_HID_KEY_M,
+    CDI_HID_KEY_N,
+    CDI_HID_KEY_O,
+    CDI_HID_KEY_P,
+    CDI_HID_KEY_Q,
+    CDI_HID_KEY_R,
+    CDI_HID_KEY_S,
+    CDI_HID_KEY_T,
+    CDI_HID_KEY_U,
+    CDI_HID_KEY_V,
+    CDI_HID_KEY_W,
+    CDI_HID_KEY_X,
+    CDI_HID_KEY_Y,
+    CDI_HID_KEY_Z,
+
+    CDI_HID_KEY_1                   = 0x1e,
+    CDI_HID_KEY_2,
+    CDI_HID_KEY_3,
+    CDI_HID_KEY_4,
+    CDI_HID_KEY_5,
+    CDI_HID_KEY_6,
+    CDI_HID_KEY_7,
+    CDI_HID_KEY_8,
+    CDI_HID_KEY_9,
+    CDI_HID_KEY_0,
+
+    CDI_HID_KEY_RETURN              = 0x28, // Defined as "Return (ENTER)"
+    CDI_HID_KEY_ESCAPE              = 0x29,
+    CDI_HID_KEY_BACKSPACE           = 0x2a,
+    CDI_HID_KEY_TAB                 = 0x2b,
+    CDI_HID_KEY_SPACE               = 0x2c,
+    CDI_HID_KEY_MINUS               = 0x2d,
+    CDI_HID_KEY_EQUAL               = 0x2e,
+    CDI_HID_KEY_LBRACKET            = 0x2f,
+    CDI_HID_KEY_RBRACKET            = 0x30,
+    CDI_HID_KEY_BACKSLASH           = 0x31,
+    CDI_HID_KEY_HASH                = 0x32, // Non-US keyboards
+    CDI_HID_KEY_SEMICOLON           = 0x33,
+    CDI_HID_KEY_APOSTROPHE          = 0x34,
+    CDI_HID_KEY_GRAVE_ACCENT        = 0x35,
+    CDI_HID_KEY_COMMA               = 0x36,
+    CDI_HID_KEY_PERIOD              = 0x37,
+    CDI_HID_KEY_SLASH               = 0x38,
+    CDI_HID_KEY_CAPS_LOCK           = 0x39,
+
+    CDI_HID_KEY_F1                  = 0x3a,
+    CDI_HID_KEY_F2,
+    CDI_HID_KEY_F3,
+    CDI_HID_KEY_F4,
+    CDI_HID_KEY_F5,
+    CDI_HID_KEY_F6,
+    CDI_HID_KEY_F7,
+    CDI_HID_KEY_F8,
+    CDI_HID_KEY_F9,
+    CDI_HID_KEY_F10,
+    CDI_HID_KEY_F11,
+    CDI_HID_KEY_F12,
+
+    CDI_HID_KEY_PRINT_SCREEN        = 0x46,
+    CDI_HID_KEY_SCROLL_LOCK         = 0x47,
+    CDI_HID_KEY_PAUSE               = 0x48,
+    CDI_HID_KEY_INSERT              = 0x49,
+    CDI_HID_KEY_HOME                = 0x4a,
+    CDI_HID_KEY_PAGE_UP             = 0x4b,
+    CDI_HID_KEY_DELETE              = 0x4c,
+    CDI_HID_KEY_END                 = 0x4d,
+    CDI_HID_KEY_PAGE_DOWN           = 0x4e,
+    CDI_HID_KEY_RIGHT_ARROW         = 0x4f,
+    CDI_HID_KEY_LEFT_ARROW          = 0x50,
+    CDI_HID_KEY_DOWN_ARROW          = 0x51,
+    CDI_HID_KEY_UP_ARROW            = 0x52,
+    CDI_HID_KEY_NUM_LOCK            = 0x53,
+
+    CDI_HID_KEY_KEYPAD_SLASH        = 0x54,
+    CDI_HID_KEY_KEYPAD_ASTERISK     = 0x55,
+    CDI_HID_KEY_KEYPAD_MINUS        = 0x56,
+    CDI_HID_KEY_KEYPAD_PLUS         = 0x57,
+    CDI_HID_KEY_KEYPAD_ENTER        = 0x58,
+
+    CDI_HID_KEY_KEYPAD_1            = 0x59,
+    CDI_HID_KEY_KEYPAD_2,
+    CDI_HID_KEY_KEYPAD_3,
+    CDI_HID_KEY_KEYPAD_4,
+    CDI_HID_KEY_KEYPAD_5,
+    CDI_HID_KEY_KEYPAD_6,
+    CDI_HID_KEY_KEYPAD_7,
+    CDI_HID_KEY_KEYPAD_8,
+    CDI_HID_KEY_KEYPAD_9,
+    CDI_HID_KEY_KEYPAD_0,
+
+    CDI_HID_KEY_KEYPAD_POINT        = 0x63,
+
+    CDI_HID_KEY_CHEVRONS            = 0x64, // Non-US keyboards
+    CDI_HID_KEY_APPLICATION         = 0x65,
+    CDI_HID_KEY_POWER               = 0x66,
+
+    CDI_HID_KEY_KEYPAD_EQUAL        = 0x67,
+
+    CDI_HID_KEY_F13                 = 0x68,
+    CDI_HID_KEY_F14,
+    CDI_HID_KEY_F15,
+    CDI_HID_KEY_F16,
+    CDI_HID_KEY_F17,
+    CDI_HID_KEY_F18,
+    CDI_HID_KEY_F19,
+    CDI_HID_KEY_F20,
+    CDI_HID_KEY_F21,
+    CDI_HID_KEY_F22,
+    CDI_HID_KEY_F23,
+    CDI_HID_KEY_F24,
+
+    CDI_HID_KEY_EXECUTE             = 0x74,
+    CDI_HID_KEY_HELP                = 0x75,
+    CDI_HID_KEY_MENU                = 0x76,
+    CDI_HID_KEY_SELECT              = 0x77,
+    CDI_HID_KEY_STOP                = 0x78,
+    CDI_HID_KEY_AGAIN               = 0x79,
+    CDI_HID_KEY_UNDO                = 0x7a,
+    CDI_HID_KEY_CUT                 = 0x7b,
+    CDI_HID_KEY_COPY                = 0x7c,
+    CDI_HID_KEY_PASTE               = 0x7d,
+    CDI_HID_KEY_FIND                = 0x7e,
+    CDI_HID_KEY_MUTE                = 0x7f,
+    CDI_HID_KEY_VOLUME_UP           = 0x80,
+    CDI_HID_KEY_VOLUME_DOWN         = 0x81,
+
+    CDI_HID_KEY_LOCKING_CAPS_LOCK   = 0x82,
+    CDI_HID_KEY_LOCKING_NUM_LOCK    = 0x83,
+    CDI_HID_KEY_LOCKING_SCROLL_LOCK = 0x84,
+
+    CDI_HID_KEY_KEYPAD_COMMA        = 0x85,
+    CDI_HID_KEY_KEYPAD_EQUAL_AS400  = 0x86,
+
+    CDI_HID_KEY_INTERNATIONAL_1     = 0x87,
+    CDI_HID_KEY_INTERNATIONAL_2,
+    CDI_HID_KEY_INTERNATIONAL_3,
+    CDI_HID_KEY_INTERNATIONAL_4,
+    CDI_HID_KEY_INTERNATIONAL_5,
+    CDI_HID_KEY_INTERNATIONAL_6,
+    CDI_HID_KEY_INTERNATIONAL_7,
+    CDI_HID_KEY_INTERNATIONAL_8,
+    CDI_HID_KEY_INTERNATIONAL_9,
+
+    CDI_HID_KEY_LANG_1              = 0x90, // Hangul/English toggle key
+    CDI_HID_KEY_LANG_2,                     // Hanja conversion key
+    CDI_HID_KEY_LANG_3,                     // Katakana key
+    CDI_HID_KEY_LANG_4,                     // Hiragana key
+    CDI_HID_KEY_LANG_5,                     // Zenkaku/Hankaku key
+    CDI_HID_KEY_LANG_6,
+    CDI_HID_KEY_LANG_7,
+    CDI_HID_KEY_LANG_8,
+    CDI_HID_KEY_LANG_9,
+
+    CDI_HID_KEY_ALTERNATE_ERASE     = 0x99,
+    CDI_HID_KEY_SYS_REQ             = 0x9a,
+    CDI_HID_KEY_CANCEL              = 0x9b,
+    CDI_HID_KEY_CLEAR               = 0x9c,
+    CDI_HID_KEY_PRIOR               = 0x9d,
+    CDI_HID_KEY_ALT_RETURN          = 0x9e, // Defined as "Return"
+                                            // (cf. CDI_KEY_RETURN)
+    CDI_HID_KEY_SEPARATOR           = 0x9f,
+    CDI_HID_KEY_OUT                 = 0xa0,
+    CDI_HID_KEY_OPER                = 0xa1,
+    CDI_HID_KEY_CLEAR_AGAIN         = 0xa2,
+    CDI_HID_KEY_CR_SEL_PROPS        = 0xa3,
+    CDI_HID_KEY_EX_SEL              = 0xa4,
+
+    CDI_HID_KEY_KEYPAD_00           = 0xb0,
+    CDI_HID_KEY_KEYPAD_000          = 0xb1,
+    CDI_HID_KEY_THOUSANDS_SEPARATOR = 0xb2,
+    CDI_HID_KEY_DECIMAL_SEPARATOR   = 0xb3,
+    CDI_HID_KEY_CURRENCY_UNIT       = 0xb4,
+    CDI_HID_KEY_CURRENCY_SUB_UNIT   = 0xb5,
+    CDI_HID_KEY_KEYPAD_LPAREN       = 0xb6,
+    CDI_HID_KEY_KEYPAD_RPAREN       = 0xb7,
+    CDI_HID_KEY_KEYPAD_LBRACE       = 0xb8,
+    CDI_HID_KEY_KEYPAD_RBRACE       = 0xb9,
+    CDI_HID_KEY_KEYPAD_TAB          = 0xba,
+    CDI_HID_KEY_KEYPAD_BACKSPACE    = 0xbb,
+
+    CDI_HID_KEY_KEYPAD_A            = 0xbc,
+    CDI_HID_KEY_KEYPAD_B,
+    CDI_HID_KEY_KEYPAD_C,
+    CDI_HID_KEY_KEYPAD_D,
+    CDI_HID_KEY_KEYPAD_E,
+    CDI_HID_KEY_KEYPAD_F,
+
+    CDI_HID_KEY_KEYPAD_XOR          = 0xc2,
+    CDI_HID_KEY_KEYPAD_HAT          = 0xc3,
+    CDI_HID_KEY_KEYPAD_PERCENTAGE   = 0xc4,
+    CDI_HID_KEY_KEYPAD_LESS_THAN    = 0xc5,
+    CDI_HID_KEY_KEYPAD_GREATER_THAN = 0xc6,
+    CDI_HID_KEY_KEYPAD_AMPERSAND    = 0xc7,
+    CDI_HID_KEY_KEYPAD_2_AMPERSANDS = 0xc8,
+    CDI_HID_KEY_KEYPAD_PIPE         = 0xc9,
+    CDI_HID_KEY_KEYPAD_2_PIPES      = 0xca,
+    CDI_HID_KEY_KEYPAD_COLON        = 0xcb,
+    CDI_HID_KEY_KEYPAD_HASH         = 0xcc,
+    CDI_HID_KEY_KEYPAD_SPACE        = 0xcd,
+    CDI_HID_KEY_KEYPAD_AT           = 0xce,
+    CDI_HID_KEY_KEYPAD_EXCLAMATION  = 0xcf,
+    CDI_HID_KEY_KEYPAD_MEM_STORE    = 0xd0,
+    CDI_HID_KEY_KEYPAD_MEM_RECALL   = 0xd1,
+    CDI_HID_KEY_KEYPAD_MEM_CLEAR    = 0xd2,
+    CDI_HID_KEY_KEYPAD_MEM_ADD      = 0xd3,
+    CDI_HID_KEY_KEYPAD_MEM_SUBTRACT = 0xd4,
+    CDI_HID_KEY_KEYPAD_MEM_MULTIPLY = 0xd5,
+    CDI_HID_KEY_KEYPAD_MEM_DIVIDE   = 0xd6,
+    CDI_HID_KEY_KEYPAD_SIGN         = 0xd7,
+    CDI_HID_KEY_KEYPAD_CLEAR        = 0xd8,
+    CDI_HID_KEY_KEYPAD_CLEAR_ENTRY  = 0xd9,
+    CDI_HID_KEY_KEYPAD_BINARY       = 0xda,
+    CDI_HID_KEY_KEYPAD_OCTAL        = 0xdb,
+    CDI_HID_KEY_KEYPAD_DECIMAL      = 0xdc,
+    CDI_HID_KEY_KEYPAD_HEXADECIMAL  = 0xdd,
+
+    CDI_HID_KEY_LCONTROL            = 0xe0,
+    CDI_HID_KEY_LSHIFT              = 0xe1,
+    CDI_HID_KEY_LALT                = 0xe2,
+    CDI_HID_KEY_LMETA               = 0xe3,
+
+    CDI_HID_KEY_RCONTROL            = 0xe4,
+    CDI_HID_KEY_RSHIFT              = 0xe5,
+    CDI_HID_KEY_RALT                = 0xe6,
+    CDI_HID_KEY_RMETA               = 0xe7,
+};
+
+#endif
diff --git a/include/cdi/hid-ledcodes.h b/include/cdi/hid-ledcodes.h
new file mode 100644
index 0000000..a4104ec
--- /dev/null
+++ b/include/cdi/hid-ledcodes.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2015 Max Reitz
+ *
+ * This program is free software. It comes without any warranty, to
+ * the extent permitted by applicable law. You can redistribute it
+ * and/or modify it under the terms of the Do What The Fuck You Want
+ * To Public License, Version 2, as published by Sam Hocevar. See
+ * http://sam.zoy.org/projects/COPYING.WTFPL for more details.
+ */
+
+#ifndef _CDI_HID_LEDCODES_H_
+#define _CDI_HID_LEDCODES_H_
+
+/**
+ * These codes are those defined by the USB HID class
+ * (see Universal Serial Bus HID Usage Tables, section 11 "LED Page (0x08)").
+ *
+ * Only OOC (on/off control) LEDs are defined here.
+ */
+enum cdi_hid_ledcodes {
+    CDI_HID_LED_NUM_LOCK            = 0x01,
+    CDI_HID_LED_CAPS_LOCK           = 0x02,
+    CDI_HID_LED_SCROLL_LOCK         = 0x03,
+    CDI_HID_LED_COMPOSE             = 0x04,
+    CDI_HID_LED_KANA                = 0x05,
+    CDI_HID_LED_POWER               = 0x06,
+    CDI_HID_LED_SHIFT               = 0x07,
+    CDI_HID_LED_DO_NOT_DISTURB      = 0x08,
+    CDI_HID_LED_MUTE                = 0x09,
+    CDI_HID_LED_TONE_ENABLE         = 0x0a,
+    CDI_HID_LED_HIGH_CUT_FILTER     = 0x0b,
+    CDI_HID_LED_LOW_CUT_FILTER      = 0x0c,
+    CDI_HID_LED_EQUALIZER_ENABLE    = 0x0d,
+    CDI_HID_LED_SOUND_FIELD_ON      = 0x0e,
+    CDI_HID_LED_SURROUND_ON         = 0x0f,
+    CDI_HID_LED_REPEAT              = 0x10,
+    CDI_HID_LED_STEREO              = 0x11,
+    CDI_HID_LED_SAMPL_RATE_DETECT   = 0x12,
+    CDI_HID_LED_SPINNING            = 0x13,
+    CDI_HID_LED_CAV                 = 0x14,
+    CDI_HID_LED_CLV                 = 0x15,
+    CDI_HID_LED_REC_FORMAT_DETECT   = 0x16,
+    CDI_HID_LED_OFF_HOOK            = 0x17,
+    CDI_HID_LED_RING                = 0x18,
+    CDI_HID_LED_MESSAGE_WAITING     = 0x19,
+    CDI_HID_LED_DATA_MODE           = 0x1a,
+    CDI_HID_LED_BATTERY_OPERATION   = 0x1b,
+    CDI_HID_LED_BATTERY_OK          = 0x1c,
+    CDI_HID_LED_BATTERY_LOW         = 0x1d,
+    CDI_HID_LED_SPEAKER             = 0x1e,
+    CDI_HID_LED_HEAD_SET            = 0x1f,
+    CDI_HID_LED_HOLD                = 0x20,
+    CDI_HID_LED_MICROPHONE          = 0x21,
+    CDI_HID_LED_COVERAGE            = 0x22,
+    CDI_HID_LED_NIGHT_MODE          = 0x23,
+    CDI_HID_LED_SEND_CALLS          = 0x24,
+    CDI_HID_LED_CALL_PICKUP         = 0x25,
+    CDI_HID_LED_CONFERENCE          = 0x26,
+    CDI_HID_LED_STAND_BY            = 0x27,
+    CDI_HID_LED_CAMERA_ON           = 0x28,
+    CDI_HID_LED_CAMERA_OFF          = 0x29,
+    CDI_HID_LED_ON_LINE             = 0x2a,
+    CDI_HID_LED_OFF_LINE            = 0x2b,
+    CDI_HID_LED_BUSY                = 0x2c,
+    CDI_HID_LED_READY               = 0x2d,
+    CDI_HID_LED_PAPER_OUT           = 0x2e,
+    CDI_HID_LED_PAPER_JAM           = 0x2f,
+    CDI_HID_LED_REMOTE              = 0x30,
+    CDI_HID_LED_FORWARD             = 0x31,
+    CDI_HID_LED_REVERSE             = 0x32,
+    CDI_HID_LED_STOP                = 0x33,
+    CDI_HID_LED_REWIND              = 0x34,
+    CDI_HID_LED_FAST_FORWARD        = 0x35,
+    CDI_HID_LED_PLAY                = 0x36,
+    CDI_HID_LED_PAUSE               = 0x37,
+    CDI_HID_LED_RECORD              = 0x38,
+    CDI_HID_LED_ERROR               = 0x39,
+
+    CDI_HID_LED_GENERIC_INDICATOR   = 0x4b,
+    CDI_HID_LED_SYSTEM_SUSPEND      = 0x4c,
+    CDI_HID_LED_EXT_POWER_CONNECTED = 0x4d,
+};
+
+#endif
+
diff --git a/include/cdi/hid.h b/include/cdi/hid.h
new file mode 100644
index 0000000..0196a62
--- /dev/null
+++ b/include/cdi/hid.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2015 Max Reitz
+ *
+ * This program is free software. It comes without any warranty, to
+ * the extent permitted by applicable law. You can redistribute it
+ * and/or modify it under the terms of the Do What The Fuck You Want
+ * To Public License, Version 2, as published by Sam Hocevar. See
+ * http://sam.zoy.org/projects/COPYING.WTFPL for more details.
+ */
+
+#ifndef _CDI_HID_H_
+#define _CDI_HID_H_
+
+#include <stdint.h>
+
+#include <cdi.h>
+#include <cdi-osdep.h>
+#include <cdi/hid-keycodes.h>
+#include <cdi/hid-ledcodes.h>
+
+
+/**
+ * Entry of the bitmaps used in this header. In each entry (i.e. each byte),
+ * the LSb is bit 0 and the MSb is bit 7.
+ */
+typedef uint8_t cdi_hid_bitmap_t;
+
+/**
+ * This array will be extended in the future. The CDI library should ignore
+ * unknown device types.
+ */
+enum cdi_hid_type {
+    CDI_HID_KEYBOARD,
+    CDI_HID_MOUSE,
+};
+
+struct cdi_hid {
+    struct cdi_device dev;
+
+    /**
+     * Type of the HID. If it is in a meaningful way possible to interpret a
+     * device as a keyboard or a mouse, this interpretation should be done by
+     * the HID driver and this field should be set to CDI_HID_KEYBOARD or
+     * CDI_HID_MOUSE accordingly. The operating system may safely assume that
+     * any HID that is not reported to be a keyboard or mouse actually to be
+     * unusable as keyboard or mouse.
+     *
+     * Note that a HID driver is free to provide multiple cdi_hid objects with
+     * differing types for a single physical device.
+     */
+    enum cdi_hid_type type;
+
+    /**
+     * Number of buttons, axes and LEDs offered by this HID.
+     */
+    size_t button_count, axes_count, led_count;
+
+    /**
+     * Bitmap representing the state of the buttons the HID provides. It has
+     * @button_count entries. The interpretation of a set or cleared bit is
+     * depending on the device (e.g. whether a set bit means a button is down or
+     * that its state changed).
+     *
+     * For keyboards and mice the button order is fixed (see cdi/hid-keycodes.h
+     * for keyboards), and a set bit indicates the respective button is down.
+     */
+    cdi_hid_bitmap_t* button_states;
+
+    /**
+     * Array containing the state of the axes the HID provides, with @axes_count
+     * entries. The interpretation of these values is completely depending on
+     * the device (e.g. the range of values allowed; whether the value is
+     * relative or absolute, etc.).
+     *
+     * Keyboards do not have any axes.
+     *
+     * Mice have two or three axes:
+     * - Axis 1: Relative X movement, range [-1.0, 1.0] (positive is right)
+     * - Axis 2: Relative Y movement, range [-1.0, 1.0] (positive is up)
+     * - Axis 3: Relative wheel movement, 1.0 per tick (positive is forwards)
+     */
+    float* axes_states;
+
+    cdi_hid_osdep meta;
+};
+
+struct cdi_hid_driver {
+    struct cdi_driver drv;
+
+    /**
+     * Sets the state of the LEDs the HID provides.
+     *
+     * For the LEDs keyboards can provide (and all USB HIDs can provide), see
+     * cdi/hid-ledcodes.h.
+     */
+    void (*set_leds)(struct cdi_hid* device, const cdi_hid_bitmap_t* states);
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Invoked by a HID driver to report to the CDI library that the device's state
+ * may have changed (i.e. the values in @button_states and/or @axes_states).
+ */
+void cdi_hid_state_update(struct cdi_hid* device);
+
+#ifdef __cplusplus
+}; // extern "C"
+#endif
+
+#endif
-- 
2.6.4