/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ #ifndef __UHID_H_ #define __UHID_H_ /* * User-space I/O driver support for HID subsystem * Copyright (c) 2012 David Herrmann */ /* * 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. */ /* * Public header for user-space communication. We try to keep every structure * aligned but to be safe we also use __attribute__((__packed__)). Therefore, * the communication should be ABI compatible even between architectures. */ #include <linux/input.h> #include <linux/types.h> #include <linux/hid.h> enum uhid_event_type { … }; struct uhid_create2_req { … } __attribute__((packed)); enum uhid_dev_flag { … }; struct uhid_start_req { … }; #define UHID_DATA_MAX … enum uhid_report_type { … }; struct uhid_input2_req { … } __attribute__((packed)); struct uhid_output_req { … } __attribute__((packed)); struct uhid_get_report_req { … } __attribute__((packed)); struct uhid_get_report_reply_req { … } __attribute__((packed)); struct uhid_set_report_req { … } __attribute__((packed)); struct uhid_set_report_reply_req { … } __attribute__((packed)); /* * Compat Layer * All these commands and requests are obsolete. You should avoid using them in * new code. We support them for backwards-compatibility, but you might not get * access to new feature in case you use them. */ enum uhid_legacy_event_type { … }; /* Obsolete! Use UHID_CREATE2. */ struct uhid_create_req { … } __attribute__((packed)); /* Obsolete! Use UHID_INPUT2. */ struct uhid_input_req { … } __attribute__((packed)); /* Obsolete! Kernel uses UHID_OUTPUT exclusively now. */ struct uhid_output_ev_req { … } __attribute__((packed)); /* Obsolete! Kernel uses ABI compatible UHID_GET_REPORT. */ struct uhid_feature_req { … } __attribute__((packed)); /* Obsolete! Use ABI compatible UHID_GET_REPORT_REPLY. */ struct uhid_feature_answer_req { … } __attribute__((packed)); /* * UHID Events * All UHID events from and to the kernel are encoded as "struct uhid_event". * The "type" field contains a UHID_* type identifier. All payload depends on * that type and can be accessed via ev->u.XYZ accordingly. * If user-space writes short events, they're extended with 0s by the kernel. If * the kernel writes short events, user-space shall extend them with 0s. */ struct uhid_event { … } __attribute__((packed)); #endif /* __UHID_H_ */