xref: /plan9-contrib/sys/src/cmd/usb/kb/hid.h (revision 3468a4915d661daa200976acc4f80f51aae144b2)
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 	Getproto	= 0x03,
14 	Setproto	= 0x0b,
15 
16 	/* protocols for SET_PROTO request */
17 	Bootproto	= 0,
18 	Reportproto	= 1,
19 };
20 
21 enum {
22 	/* keyboard modifier bits */
23 	Mlctrl		= 0,
24 	Mlshift		= 1,
25 	Mlalt		= 2,
26 	Mlgui		= 3,
27 	Mrctrl		= 4,
28 	Mrshift		= 5,
29 	Mralt		= 6,
30 	Mrgui		= 7,
31 
32 	/* masks for byte[0] */
33 	Mctrl		= 1<<Mlctrl | 1<<Mrctrl,
34 	Mshift		= 1<<Mlshift | 1<<Mrshift,
35 	Malt		= 1<<Mlalt | 1<<Mralt,
36 	Mcompose	= 1<<Mlalt,
37 	Maltgr		= 1<<Mralt,
38 	Mgui		= 1<<Mlgui | 1<<Mrgui,
39 
40 	MaxAcc = 3,			/* max. ptr acceleration */
41 	PtrMask= 0xf,			/* 4 buttons: should allow for more. */
42 
43 };
44 
45 /*
46  * Plan 9 keyboard driver constants.
47  */
48 enum {
49 	/* Scan codes (see kbd.c) */
50 	SCesc1		= 0xe0,		/* first of a 2-character sequence */
51 	SCesc2		= 0xe1,
52 	SClshift		= 0x2a,
53 	SCrshift		= 0x36,
54 	SCctrl		= 0x1d,
55 	SCcompose	= 0x38,
56 	Keyup		= 0x80,		/* flag bit */
57 	Keymask		= 0x7f,		/* regular scan code bits */
58 };
59 
60 int kbmain(Dev *d, int argc, char*argv[]);
61