xref: /freebsd/sys/dev/hid/hidquirk.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
119758786SVladimir Kondratyev /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
319758786SVladimir Kondratyev  *
419758786SVladimir Kondratyev  * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
519758786SVladimir Kondratyev  * Copyright (c) 2020 Vladimir Kondratyev <wulf@FreeBSD.org>
619758786SVladimir Kondratyev  *
719758786SVladimir Kondratyev  * Redistribution and use in source and binary forms, with or without
819758786SVladimir Kondratyev  * modification, are permitted provided that the following conditions
919758786SVladimir Kondratyev  * are met:
1019758786SVladimir Kondratyev  * 1. Redistributions of source code must retain the above copyright
1119758786SVladimir Kondratyev  *    notice, this list of conditions and the following disclaimer.
1219758786SVladimir Kondratyev  * 2. Redistributions in binary form must reproduce the above copyright
1319758786SVladimir Kondratyev  *    notice, this list of conditions and the following disclaimer in the
1419758786SVladimir Kondratyev  *    documentation and/or other materials provided with the distribution.
1519758786SVladimir Kondratyev  *
1619758786SVladimir Kondratyev  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1719758786SVladimir Kondratyev  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1819758786SVladimir Kondratyev  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1919758786SVladimir Kondratyev  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2019758786SVladimir Kondratyev  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2119758786SVladimir Kondratyev  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2219758786SVladimir Kondratyev  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2319758786SVladimir Kondratyev  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2419758786SVladimir Kondratyev  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2519758786SVladimir Kondratyev  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2619758786SVladimir Kondratyev  * SUCH DAMAGE.
2719758786SVladimir Kondratyev  */
2819758786SVladimir Kondratyev 
2919758786SVladimir Kondratyev /*
3019758786SVladimir Kondratyev  * Screening of all content of this file except HID_QUIRK_LIST is a kind of
3119758786SVladimir Kondratyev  * hack that allows multiple HID_QUIRK_LIST inclusion with different HQ()
3219758786SVladimir Kondratyev  * wrappers. That save us splitting hidquirk.h on two header files.
3319758786SVladimir Kondratyev  */
3419758786SVladimir Kondratyev #ifndef HQ
3519758786SVladimir Kondratyev #ifndef _HID_QUIRK_H_
3619758786SVladimir Kondratyev #define	_HID_QUIRK_H_
3719758786SVladimir Kondratyev #endif
3819758786SVladimir Kondratyev 
3919758786SVladimir Kondratyev /*
4019758786SVladimir Kondratyev  * Keep in sync with share/man/man4/hidquirk.4
4119758786SVladimir Kondratyev  */
4219758786SVladimir Kondratyev #define	HID_QUIRK_LIST(...)						\
4319758786SVladimir Kondratyev 	HQ(NONE),		/* not a valid quirk */			\
4419758786SVladimir Kondratyev 									\
4519758786SVladimir Kondratyev 	HQ(MATCH_VENDOR_ONLY),	/* match quirk on vendor only */	\
4619758786SVladimir Kondratyev 									\
4719758786SVladimir Kondratyev 	/* Autoquirks */						\
4819758786SVladimir Kondratyev 	HQ(HAS_KBD_BOOTPROTO),	/* device supports keyboard boot protocol */ \
4919758786SVladimir Kondratyev 	HQ(HAS_MS_BOOTPROTO),	/* device supports mouse boot protocol */ \
5019758786SVladimir Kondratyev 	HQ(IS_XBOX360GP), 	/* device is XBox 360 GamePad */	\
5119758786SVladimir Kondratyev 	HQ(NOWRITE),		/* device does not support writes */	\
5219758786SVladimir Kondratyev 	HQ(IICHID_SAMPLING),	/* IIC backend runs in sampling mode */	\
5319758786SVladimir Kondratyev 									\
5419758786SVladimir Kondratyev 	/* Various quirks */						\
5519758786SVladimir Kondratyev 	HQ(HID_IGNORE),		/* device should be ignored by hid class */ \
5619758786SVladimir Kondratyev 	HQ(KBD_BOOTPROTO),	/* device should set the boot protocol */ \
5719758786SVladimir Kondratyev 	HQ(MS_BOOTPROTO),	/* device should set the boot protocol */ \
5819758786SVladimir Kondratyev 	HQ(MS_BAD_CLASS),	/* doesn't identify properly */		\
5919758786SVladimir Kondratyev 	HQ(MS_LEADING_BYTE),	/* mouse sends an unknown leading byte */ \
6019758786SVladimir Kondratyev 	HQ(MS_REVZ),		/* mouse has Z-axis reversed */		\
610661cf74SVladimir Kondratyev 	HQ(MS_VENDOR_BTN),	/* mouse has buttons in vendor usage page */ \
6219758786SVladimir Kondratyev 	HQ(SPUR_BUT_UP),	/* spurious mouse button up events */	\
6319758786SVladimir Kondratyev 	HQ(MT_TIMESTAMP)	/* Multitouch device exports HW timestamps */
6419758786SVladimir Kondratyev 
6519758786SVladimir Kondratyev #ifndef	HQ
6619758786SVladimir Kondratyev #define	HQ(x)	HQ_##x
6719758786SVladimir Kondratyev enum {
6819758786SVladimir Kondratyev 	HID_QUIRK_LIST(),
6919758786SVladimir Kondratyev 	HID_QUIRK_MAX
7019758786SVladimir Kondratyev };
7119758786SVladimir Kondratyev #undef HQ
7219758786SVladimir Kondratyev 
7319758786SVladimir Kondratyev #endif					/* _HID_QUIRK_H_ */
7419758786SVladimir Kondratyev #endif					/* HQ */
75