| Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 1 | /* | 
 | 2 |  *  Copyright (c) 2007 Jiri Kosina | 
 | 3 |  */ | 
| Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 4 | /* | 
 | 5 |  * This program is free software; you can redistribute it and/or modify it | 
 | 6 |  * under the terms and conditions of the GNU General Public License, | 
 | 7 |  * version 2, as published by the Free Software Foundation. | 
 | 8 |  * | 
 | 9 |  * You should have received a copy of the GNU General Public License along with | 
 | 10 |  * this program; if not, write to the Free Software Foundation, Inc., | 
 | 11 |  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | 
 | 12 |  */ | 
| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 13 | #ifndef _HIDRAW_H | 
 | 14 | #define _HIDRAW_H | 
| Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 15 |  | 
| David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 16 | #include <uapi/linux/hidraw.h> | 
| Jiri Kosina | 57d292b | 2007-10-15 15:17:41 +0200 | [diff] [blame] | 17 |  | 
| Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 18 |  | 
| Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 19 | struct hidraw { | 
 | 20 | 	unsigned int minor; | 
 | 21 | 	int exist; | 
 | 22 | 	int open; | 
 | 23 | 	wait_queue_head_t wait; | 
 | 24 | 	struct hid_device *hid; | 
 | 25 | 	struct device *dev; | 
 | 26 | 	struct list_head list; | 
 | 27 | }; | 
 | 28 |  | 
 | 29 | struct hidraw_report { | 
 | 30 | 	__u8 *value; | 
 | 31 | 	int len; | 
 | 32 | }; | 
 | 33 |  | 
 | 34 | struct hidraw_list { | 
 | 35 | 	struct hidraw_report buffer[HIDRAW_BUFFER_SIZE]; | 
 | 36 | 	int head; | 
 | 37 | 	int tail; | 
 | 38 | 	struct fasync_struct *fasync; | 
 | 39 | 	struct hidraw *hidraw; | 
 | 40 | 	struct list_head node; | 
 | 41 | 	struct mutex read_mutex; | 
 | 42 | }; | 
 | 43 |  | 
 | 44 | #ifdef CONFIG_HIDRAW | 
 | 45 | int hidraw_init(void); | 
 | 46 | void hidraw_exit(void); | 
| Jiri Kosina | b678724 | 2012-04-27 00:56:08 +0200 | [diff] [blame] | 47 | int hidraw_report_event(struct hid_device *, u8 *, int); | 
| Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 48 | int hidraw_connect(struct hid_device *); | 
 | 49 | void hidraw_disconnect(struct hid_device *); | 
 | 50 | #else | 
 | 51 | static inline int hidraw_init(void) { return 0; } | 
 | 52 | static inline void hidraw_exit(void) { } | 
| Jiri Kosina | d6d7c87 | 2012-04-30 10:39:17 +0200 | [diff] [blame] | 53 | static inline int hidraw_report_event(struct hid_device *hid, u8 *data, int len) { return 0; } | 
| Jiri Kosina | 86166b7 | 2007-05-14 09:57:40 +0200 | [diff] [blame] | 54 | static inline int hidraw_connect(struct hid_device *hid) { return -1; } | 
 | 55 | static inline void hidraw_disconnect(struct hid_device *hid) { } | 
 | 56 | #endif | 
 | 57 |  | 
 | 58 | #endif |