xref: /plan9-contrib/sys/src/cmd/usb/kb/hid.h (revision 60014d6756a98ad10929607ca84a1b7488a16cfc)
1 /*
2  * USB keyboard/mouse constants
3  */
4 enum {
5 	/* HID class subclass protocol ids */
6 	PtrCSP		= 0x020103,	/* mouse.boot.hid */
7 	KbdCSP		= 0x010103,	/* keyboard.boot.hid */
8 
9 	/* Requests */
10 	SET_PROTO	= 0x0b,
11 
12 	/* protocols for SET_PROTO request */
13 	BOOT_PROTO	= 0,
14 	REPORT_PROTO	= 1,
15 };
16 
17 enum {
18 	/* keyboard modifier bits */
19 	Mlctrl=		0,
20 	Mlshift=	1,
21 	Mlalt=		2,
22 	Mlgui=		3,
23 	Mrctrl=		4,
24 	Mrshift=	5,
25 	Mralt=		6,
26 	Mrgui=		7,
27 
28 	/* masks for byte[0] */
29 	Mctrl=		1<<Mlctrl | 1<<Mrctrl,
30 	Mshift=		1<<Mlshift | 1<<Mrshift,
31 	Malt=		1<<Mlalt | 1<<Mralt,
32 	Mcompose=	1<<Mlalt,
33 	Maltgr=		1<<Mralt,
34 	Mgui=		1<<Mlgui | 1<<Mrgui,
35 
36 	MaxAcc = 3,			/* max. ptr acceleration */
37 	PtrMask= 0xf,			/* 4 buttons: should allow for more. */
38 
39 	Awakemsg=0xdeaddead,
40 };
41 
42 /*
43  * Plan 9 keyboard driver constants.
44  */
45 enum {
46 	/* Scan codes (see kbd.c) */
47 	SCesc1=		0xe0,		/* first of a 2-character sequence */
48 	SCesc2=		0xe1,
49 	SClshift=	0x2a,
50 	SCrshift=	0x36,
51 	SCctrl=		0x1d,
52 	SCcompose=	0x38,
53 	Keyup=		0x80,		/* flag bit */
54 	Keymask=	0x7f,		/* regular scan code bits */
55 };
56 
57 extern int hdebug;
58