linux/include/uapi/linux/hiddev.h

/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
 *  Copyright (c) 1999-2000 Vojtech Pavlik
 *
 *  Sponsored by SuSE
 */
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 * 
 * Should you need to contact me, the author, you can do so either by
 * e-mail - mail your message to <[email protected]>, or by paper mail:
 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
 */
#ifndef _UAPI_HIDDEV_H
#define _UAPI_HIDDEV_H



#include <linux/types.h>

/*
 * The event structure itself
 */

struct hiddev_event {};

struct hiddev_devinfo {};

struct hiddev_collection_info {};

#define HID_STRING_SIZE
struct hiddev_string_descriptor {};

struct hiddev_report_info {};

/* To do a GUSAGE/SUSAGE, fill in at least usage_code,  report_type and 
 * report_id.  Set report_id to REPORT_ID_UNKNOWN if the rest of the fields 
 * are unknown.  Otherwise use a usage_ref struct filled in from a previous 
 * successful GUSAGE call to save time.  To actually send a value to the
 * device, perform a SUSAGE first, followed by a SREPORT.  An INITREPORT or a
 * GREPORT isn't necessary for a GUSAGE to return valid data.
 */
#define HID_REPORT_ID_UNKNOWN
#define HID_REPORT_ID_FIRST
#define HID_REPORT_ID_NEXT
#define HID_REPORT_ID_MASK
#define HID_REPORT_ID_MAX

#define HID_REPORT_TYPE_INPUT
#define HID_REPORT_TYPE_OUTPUT
#define HID_REPORT_TYPE_FEATURE
#define HID_REPORT_TYPE_MIN
#define HID_REPORT_TYPE_MAX

struct hiddev_field_info {};

/* Fill in report_type, report_id and field_index to get the information on a
 * field.
 */
#define HID_FIELD_CONSTANT
#define HID_FIELD_VARIABLE
#define HID_FIELD_RELATIVE
#define HID_FIELD_WRAP	
#define HID_FIELD_NONLINEAR
#define HID_FIELD_NO_PREFERRED
#define HID_FIELD_NULL_STATE
#define HID_FIELD_VOLATILE
#define HID_FIELD_BUFFERED_BYTE

struct hiddev_usage_ref {};

/* hiddev_usage_ref_multi is used for sending multiple bytes to a control.
 * It really manifests itself as setting the value of consecutive usages */
#define HID_MAX_MULTI_USAGES
struct hiddev_usage_ref_multi {};

/* FIELD_INDEX_NONE is returned in read() data from the kernel when flags
 * is set to (HIDDEV_FLAG_UREF | HIDDEV_FLAG_REPORT) and a new report has
 * been sent by the device 
 */
#define HID_FIELD_INDEX_NONE

/*
 * Protocol version.
 */

#define HID_VERSION

/*
 * IOCTLs (0x00 - 0x7f)
 */

#define HIDIOCGVERSION
#define HIDIOCAPPLICATION
#define HIDIOCGDEVINFO
#define HIDIOCGSTRING
#define HIDIOCINITREPORT
#define HIDIOCGNAME(len)
#define HIDIOCGREPORT
#define HIDIOCSREPORT
#define HIDIOCGREPORTINFO
#define HIDIOCGFIELDINFO
#define HIDIOCGUSAGE
#define HIDIOCSUSAGE
#define HIDIOCGUCODE
#define HIDIOCGFLAG
#define HIDIOCSFLAG
#define HIDIOCGCOLLECTIONINDEX
#define HIDIOCGCOLLECTIONINFO
#define HIDIOCGPHYS(len)

/* For writing/reading to multiple/consecutive usages */
#define HIDIOCGUSAGES
#define HIDIOCSUSAGES

/* 
 * Flags to be used in HIDIOCSFLAG
 */
#define HIDDEV_FLAG_UREF
#define HIDDEV_FLAG_REPORT
#define HIDDEV_FLAGS

/* To traverse the input report descriptor info for a HID device, perform the 
 * following:
 *
 * rinfo.report_type = HID_REPORT_TYPE_INPUT;
 * rinfo.report_id = HID_REPORT_ID_FIRST;
 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
 *
 * while (ret >= 0) {
 * 	for (i = 0; i < rinfo.num_fields; i++) {
 * 		finfo.report_type = rinfo.report_type;
 * 		finfo.report_id = rinfo.report_id;
 * 		finfo.field_index = i;
 * 		ioctl(fd, HIDIOCGFIELDINFO, &finfo);
 * 		for (j = 0; j < finfo.maxusage; j++) {
 * 			uref.report_type = rinfo.report_type;
 * 			uref.report_id = rinfo.report_id;
 * 			uref.field_index = i;
 * 			uref.usage_index = j;
 * 			ioctl(fd, HIDIOCGUCODE, &uref);
 * 			ioctl(fd, HIDIOCGUSAGE, &uref);
 * 		}
 * 	}
 * 	rinfo.report_id |= HID_REPORT_ID_NEXT;
 * 	ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
 * }
 */


#endif /* _UAPI_HIDDEV_H */