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