Modules/USB - A little work on HID code
authorJohn Hodge <[email protected]>
Thu, 1 Dec 2011 03:08:26 +0000 (11:08 +0800)
committerJohn Hodge <[email protected]>
Thu, 1 Dec 2011 03:08:26 +0000 (11:08 +0800)
- TODO: Figure out how to register a HID keyboard with the VTerm cleanly
 - Maybe have a method to tell the VTerm it's avaliable, instead of the other
   way around as it is currently.

Modules/USB/HID/keysyms.h [new file with mode: 0644]
Modules/USB/HID/main.c [new file with mode: 0644]

diff --git a/Modules/USB/HID/keysyms.h b/Modules/USB/HID/keysyms.h
new file mode 100644 (file)
index 0000000..558464e
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Acess2 USB Stack HID Driver
+ * - By John Hodge (thePowersGang)
+ *
+ * usb_keysyms.h
+ * - USB HID Keyboard Symbols
+ */
+#ifndef _USB_KEYSYMS_H_
+#define _USB_KEYSYMS_H_
+
+enum eUSB_Keysyms
+{
+       KEYSYM_NONE,
+       KEYSYM_ERRORROLLOVER,
+       KEYSYM_POSTFAIL,
+       KEYSYM_ERRORUNDEFINED,
+       // 0x04 / 4
+       KEYSYM_a, KEYSYM_b, KEYSYM_c,
+       KEYSYM_d, KEYSYM_e, KEYSYM_f,
+       KEYSYM_g, KEYSYM_h, KEYSYM_i,
+       KEYSYM_j, KEYSYM_k, KEYSYM_l,
+       KEYSYM_m, KEYSYM_n, KEYSYM_o,
+       KEYSYM_p, KEYSYM_q, KEYSYM_r,
+       KEYSYM_s, KEYSYM_t, KEYSYM_u,
+       KEYSYM_v, KEYSYM_w, KEYSYM_x,
+       KEYSYM_y, KEYSYM_z,
+       
+       // 0x1E / 30
+       KEYSYM_1, KEYSYM_2,
+       KEYSYM_3, KEYSYM_4,
+       KEYSYM_5, KEYSYM_6,
+       KEYSYM_7, KEYSYM_8,
+       KEYSYM_9, KEYSYM_0,
+       
+       KEYSYM_RETURN,  // Enter
+       KEYSYM_ESC,     // Esc.
+       KEYSYM_BACKSP,  // Backspace
+       KEYSYM_TAB,     // Tab
+       KEYSYM_SPACE,   // Spacebar
+       KEYSYM_MINUS,   // - _
+       KEYSYM_EQUALS,  // = +
+       KEYSYM_SQUARE_OPEN,     // [ {
+       KEYSYM_SQUARE_CLOSE,    // ] }
+       KEYSYM_BACKSLASH,       // \ |
+       KEYSYM_HASH_TILDE,      // # ~ (Non-US)
+       KEYSYM_SEMICOLON,       // ; :
+       KEYSYM_QUOTE,   // ' "
+       KEYSYM_GRAVE_TILDE,     // Grave Accent, Tilde
+       KEYSYM_COMMA,   // , <
+       KEYSYM_PERIOD,  // . >
+       KEYSYM_SLASH,   // / ?
+       KEYSYM_CAPS,    // Caps Lock
+       KEYSYM_F1, KEYSYM_F2,
+       KEYSYM_F3, KEYSYM_F4,
+       KEYSYM_F5, KEYSYM_F6,
+       KEYSYM_F7, KEYSYM_F8,
+       KEYSYM_F9, KEYSYM_F10,
+       KEYSYM_F11, KEYSYM_F12,
+       KEYSYM_PRINTSCREEN,
+       KEYSYM_SCROLLLOCK,
+       KEYSYM_PAUSE,
+       KEYSYM_INSERT,
+       KEYSYM_HOME,
+       KEYSYM_PGUP,
+       KEYSYM_DELETE,
+       KEYSYM_END,
+       KEYSYM_PGDN,
+       KEYSYM_RIGHTARROW,
+       KEYSYM_LEFTARROW,
+       KEYSYM_DOWNARROW,
+       KEYSYM_UPARROW,
+       
+       KEYSYM_NUMLOCK,
+       KEYSYM_KPSLASH,
+       KEYSYM_KPSTAR,
+       KEYSYM_KPMINUS,
+       KEYSYM_KPPLUS,
+       KEYSYM_KPENTER,
+       KEYSYM_KP1,
+       KEYSYM_KP2,
+       KEYSYM_KP3,
+       KEYSYM_KP4,
+       KEYSYM_KP5,
+       KEYSYM_KP7,
+       KEYSYM_KP8,
+       KEYSYM_KP9
+       KEYSYM_KP0,
+       KEYSYM_KPPERIOD,
+       
+       KEYSYM_NONUS_BACKSLASH,
+       KEYSYM_APPLICATION,     // Windows Key
+       KEYSYM_POWER,
+       KEYSYM_KPEQUALS,
+       
+       KEYSYM_F13, KEYSYM_F14,
+       KEYSYM_F15, KEYSYM_F16,
+       KEYSYM_F17, KEYSYM_F18,
+       KEYSYM_F19, KEYSYM_F20,
+       KEYSYM_F21, KEYSYM_F22,
+       KEYSYM_F23, KEYSYM_F24,
+       KEYSYM_EXECUTE,
+       KEYSYM_HELP,
+       KEYSYM_MENU,
+       KEYSYM_SELECT,
+       KEYSYM_STOP,
+       KEYSYM_AGAIN,
+       KEYSYM_UNDO,
+       KEYSYM_CUT,
+       KEYSYM_COPY,
+       KEYSYM_PASTE,
+       KEYSYM_FIND,
+       KEYSYM_MUTE,
+       KEYSYM_VOLUP,
+       KEYSYM_VOLDN,
+       KEYSYM_LOCKING_CAPS,    // Physically toggles
+       KEYSYM_LOGKING_NUM,
+       KEYSYM_LOGKING_SCROLL,
+       KEYSYM_KPCOMMA
+       
+       // TODO: Define the rest
+};
+
+#endif
+
diff --git a/Modules/USB/HID/main.c b/Modules/USB/HID/main.c
new file mode 100644 (file)
index 0000000..31375b0
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Acess2 USB Stack HID Driver
+ * - By John Hodge (thePowersGang)
+ *
+ * main.c
+ * - Driver Core
+ */
+#define DEBUG  0
+#define VERSION        VER2(0,1)
+#include <acess.h>
+#include <usb_core.h>
+
+// === PROTOTYPES ===
+ int   HID_Initialise(const char **Arguments);
+void   HID_DeviceConnected(tUSBInterface *Dev);
+
+// === GLOBALS ===
+MODULE_DEFINE(0, VERSION, USB_HID, HID_Initialise, NULL, "USB_Core", NULL);
+tUSBDriver     gHID_Driver = {
+       .Name = "HID",
+       .Match = {.Class = {0x030000, 0xFF0000}},
+       .Connected = HID_DeviceConnected,
+};
+
+// === CODE ===
+int HID_Initialise(const char **Arguments)
+{
+       USB_RegisterDriver( &gHID_Driver );
+       return 0;
+}
+
+void HID_DeviceConnected(tUSBInterface *Dev)
+{
+       
+}
+

UCC git Repository :: git.ucc.asn.au