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