]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/nusb/kb/hid.h
nusb/kb: use report protocol for mouse
[plan9front.git] / sys / src / cmd / nusb / kb / hid.h
1 /*
2  * USB keyboard/mouse constants
3  */
4 enum {
5
6         Stack = 32 * 1024,
7
8         /* HID class subclass protocol ids */
9         PtrCSP          = 0x020103,     /* mouse.boot.hid */
10         KbdCSP          = 0x010103,     /* keyboard.boot.hid */
11
12         /* Requests */
13         Getreport = 0x01,
14         Setreport = 0x09,
15         Getproto        = 0x03,
16         Setproto        = 0x0b,
17
18         /* protocols for SET_PROTO request */
19         Bootproto       = 0,
20         Reportproto     = 1,
21
22         /* protocols for SET_REPORT request */
23         Reportout = 0x0200,
24 };
25
26 /*
27  * USB HID report descriptor item tags
28  */ 
29 enum {
30         /* main items */
31         Input   = 8,
32         Output,
33         Collection,
34         Feature,
35
36         CollectionEnd,
37
38         /* global items */
39         UsagPg = 0,
40         LogiMin,
41         LogiMax,
42         PhysMin,
43         PhysMax,
44         UnitExp,
45         UnitTyp,
46         RepSize,
47         RepId,
48         RepCnt,
49
50         Push,
51         Pop,
52
53         /* local items */
54         Usage   = 0,
55         UsagMin,
56         UsagMax,
57         DesgIdx,
58         DesgMin,
59         DesgMax,
60         StrgIdx,
61         StrgMin,
62         StrgMax,
63
64         Delim,
65 };
66
67 /* main item flags */
68 enum {
69         Fdata   = 0<<0, Fconst  = 1<<0,
70         Farray  = 0<<1, Fvar    = 1<<1,
71         Fabs    = 0<<2, Frel    = 1<<2,
72         Fnowrap = 0<<3, Fwrap   = 1<<3,
73         Flinear = 0<<4, Fnonlin = 1<<4,
74         Fpref   = 0<<5, Fnopref = 1<<5,
75         Fnonull = 0<<6, Fnullst = 1<<6,
76 };
77
78 enum {
79         /* keyboard modifier bits */
80         Mlctrl          = 0,
81         Mlshift         = 1,
82         Mlalt           = 2,
83         Mlgui           = 3,
84         Mrctrl          = 4,
85         Mrshift         = 5,
86         Mralt           = 6,
87         Mrgui           = 7,
88
89         /* masks for byte[0] */
90         Mctrl           = 1<<Mlctrl | 1<<Mrctrl,
91         Mshift          = 1<<Mlshift | 1<<Mrshift,
92         Malt            = 1<<Mlalt | 1<<Mralt,
93         Mcompose        = 1<<Mlalt,
94         Maltgr          = 1<<Mralt,
95         Mgui            = 1<<Mlgui | 1<<Mrgui,
96
97         MaxAcc = 3,                     /* max. ptr acceleration */
98         PtrMask= 0xf,                   /* 4 buttons: should allow for more. */
99
100 };
101
102 /*
103  * Plan 9 keyboard driver constants.
104  */
105 enum {
106         /* Scan codes (see kbd.c) */
107         SCesc1          = 0xe0,         /* first of a 2-character sequence */
108         SCesc2          = 0xe1,
109         SClshift                = 0x2a,
110         SCrshift                = 0x36,
111         SCctrl          = 0x1d,
112         SCcompose       = 0x38,
113         Keyup           = 0x80,         /* flag bit */
114         Keymask         = 0x7f,         /* regular scan code bits */
115 };