xref: /freebsd/sys/dev/hid/hidquirk.h (revision 069ac184)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
5  * Copyright (c) 2020 Vladimir Kondratyev <wulf@FreeBSD.org>
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  */
28 
29 /*
30  * Screening of all content of this file except HID_QUIRK_LIST is a kind of
31  * hack that allows multiple HID_QUIRK_LIST inclusion with different HQ()
32  * wrappers. That save us splitting hidquirk.h on two header files.
33  */
34 #ifndef HQ
35 #ifndef _HID_QUIRK_H_
36 #define	_HID_QUIRK_H_
37 #endif
38 
39 /*
40  * Keep in sync with share/man/man4/hidquirk.4
41  */
42 #define	HID_QUIRK_LIST(...)						\
43 	HQ(NONE),		/* not a valid quirk */			\
44 									\
45 	HQ(MATCH_VENDOR_ONLY),	/* match quirk on vendor only */	\
46 									\
47 	/* Autoquirks */						\
48 	HQ(HAS_KBD_BOOTPROTO),	/* device supports keyboard boot protocol */ \
49 	HQ(HAS_MS_BOOTPROTO),	/* device supports mouse boot protocol */ \
50 	HQ(IS_XBOX360GP), 	/* device is XBox 360 GamePad */	\
51 	HQ(NOWRITE),		/* device does not support writes */	\
52 	HQ(IICHID_SAMPLING),	/* IIC backend runs in sampling mode */	\
53 									\
54 	/* Various quirks */						\
55 	HQ(HID_IGNORE),		/* device should be ignored by hid class */ \
56 	HQ(KBD_BOOTPROTO),	/* device should set the boot protocol */ \
57 	HQ(MS_BOOTPROTO),	/* device should set the boot protocol */ \
58 	HQ(MS_BAD_CLASS),	/* doesn't identify properly */		\
59 	HQ(MS_LEADING_BYTE),	/* mouse sends an unknown leading byte */ \
60 	HQ(MS_REVZ),		/* mouse has Z-axis reversed */		\
61 	HQ(MS_VENDOR_BTN),	/* mouse has buttons in vendor usage page */ \
62 	HQ(SPUR_BUT_UP),	/* spurious mouse button up events */	\
63 	HQ(MT_TIMESTAMP)	/* Multitouch device exports HW timestamps */
64 
65 #ifndef	HQ
66 #define	HQ(x)	HQ_##x
67 enum {
68 	HID_QUIRK_LIST(),
69 	HID_QUIRK_MAX
70 };
71 #undef HQ
72 
73 #endif					/* _HID_QUIRK_H_ */
74 #endif					/* HQ */
75