xref: /linux/include/uapi/linux/hidraw.h (revision cdd38c5f1ce4398ec58fec95904b75824daab7b5)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2607ca46eSDavid Howells /*
3607ca46eSDavid Howells  *  Copyright (c) 2007 Jiri Kosina
4607ca46eSDavid Howells  */
5607ca46eSDavid Howells /*
6607ca46eSDavid Howells  * This program is free software; you can redistribute it and/or modify it
7607ca46eSDavid Howells  * under the terms and conditions of the GNU General Public License,
8607ca46eSDavid Howells  * version 2, as published by the Free Software Foundation.
9607ca46eSDavid Howells  *
10607ca46eSDavid Howells  * You should have received a copy of the GNU General Public License along with
11607ca46eSDavid Howells  * this program; if not, write to the Free Software Foundation, Inc.,
12607ca46eSDavid Howells  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
13607ca46eSDavid Howells  */
14607ca46eSDavid Howells #ifndef _UAPI_HIDRAW_H
15607ca46eSDavid Howells #define _UAPI_HIDRAW_H
16607ca46eSDavid Howells 
17607ca46eSDavid Howells 
18607ca46eSDavid Howells 
19607ca46eSDavid Howells #include <linux/hid.h>
20607ca46eSDavid Howells #include <linux/types.h>
21607ca46eSDavid Howells 
22607ca46eSDavid Howells struct hidraw_report_descriptor {
23607ca46eSDavid Howells 	__u32 size;
24607ca46eSDavid Howells 	__u8 value[HID_MAX_DESCRIPTOR_SIZE];
25607ca46eSDavid Howells };
26607ca46eSDavid Howells 
27607ca46eSDavid Howells struct hidraw_devinfo {
28607ca46eSDavid Howells 	__u32 bustype;
29607ca46eSDavid Howells 	__s16 vendor;
30607ca46eSDavid Howells 	__s16 product;
31607ca46eSDavid Howells };
32607ca46eSDavid Howells 
33607ca46eSDavid Howells /* ioctl interface */
34607ca46eSDavid Howells #define HIDIOCGRDESCSIZE	_IOR('H', 0x01, int)
35607ca46eSDavid Howells #define HIDIOCGRDESC		_IOR('H', 0x02, struct hidraw_report_descriptor)
36607ca46eSDavid Howells #define HIDIOCGRAWINFO		_IOR('H', 0x03, struct hidraw_devinfo)
37607ca46eSDavid Howells #define HIDIOCGRAWNAME(len)     _IOC(_IOC_READ, 'H', 0x04, len)
38607ca46eSDavid Howells #define HIDIOCGRAWPHYS(len)     _IOC(_IOC_READ, 'H', 0x05, len)
39607ca46eSDavid Howells /* The first byte of SFEATURE and GFEATURE is the report number */
40607ca46eSDavid Howells #define HIDIOCSFEATURE(len)    _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
41607ca46eSDavid Howells #define HIDIOCGFEATURE(len)    _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
422f48865dSMarcel Holtmann #define HIDIOCGRAWUNIQ(len)     _IOC(_IOC_READ, 'H', 0x08, len)
43*f43d3870SDean Camera /* The first byte of SINPUT and GINPUT is the report number */
44*f43d3870SDean Camera #define HIDIOCSINPUT(len)    _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x09, len)
45*f43d3870SDean Camera #define HIDIOCGINPUT(len)    _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x0A, len)
46*f43d3870SDean Camera /* The first byte of SOUTPUT and GOUTPUT is the report number */
47*f43d3870SDean Camera #define HIDIOCSOUTPUT(len)    _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x0B, len)
48*f43d3870SDean Camera #define HIDIOCGOUTPUT(len)    _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x0C, len)
49607ca46eSDavid Howells 
50607ca46eSDavid Howells #define HIDRAW_FIRST_MINOR 0
51607ca46eSDavid Howells #define HIDRAW_MAX_DEVICES 64
52607ca46eSDavid Howells /* number of reports to buffer */
53607ca46eSDavid Howells #define HIDRAW_BUFFER_SIZE 64
54607ca46eSDavid Howells 
55607ca46eSDavid Howells 
56607ca46eSDavid Howells /* kernel-only API declarations */
57607ca46eSDavid Howells 
58607ca46eSDavid Howells #endif /* _UAPI_HIDRAW_H */
59