Line data Source code
1 : #ifndef _HIDRAW_H
2 : #define _HIDRAW_H
3 :
4 : /*
5 : * Copyright (c) 2007 Jiri Kosina
6 : */
7 :
8 : /*
9 : * This program is free software; you can redistribute it and/or modify it
10 : * under the terms and conditions of the GNU General Public License,
11 : * version 2, as published by the Free Software Foundation.
12 : *
13 : * You should have received a copy of the GNU General Public License along with
14 : * this program; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #include <linux/hid.h>
19 : #include <linux/types.h>
20 :
21 : struct hidraw_report_descriptor {
22 : __u32 size;
23 : __u8 value[HID_MAX_DESCRIPTOR_SIZE];
24 : };
25 :
26 : struct hidraw_devinfo {
27 : __u32 bustype;
28 : __s16 vendor;
29 : __s16 product;
30 : };
31 1 :
32 : /* ioctl interface */
33 : #define HIDIOCGRDESCSIZE _IOR('H', 0x01, int)
34 : #define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor)
35 : #define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo)
36 : #define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len)
37 : #define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len)
38 :
39 : #define HIDRAW_FIRST_MINOR 0
40 : #define HIDRAW_MAX_DEVICES 64
41 : /* number of reports to buffer */
42 : #define HIDRAW_BUFFER_SIZE 64
43 :
44 :
45 : /* kernel-only API declarations */
46 : #ifdef __KERNEL__
47 :
48 : struct hidraw {
49 : unsigned int minor;
50 : int exist;
51 : int open;
52 : wait_queue_head_t wait;
53 : struct hid_device *hid;
54 : struct device *dev;
55 : struct list_head list;
56 : };
57 :
58 : struct hidraw_report {
59 : __u8 *value;
60 : int len;
61 : };
62 :
63 : struct hidraw_list {
64 : struct hidraw_report buffer[HIDRAW_BUFFER_SIZE];
65 : int head;
66 : int tail;
67 : struct fasync_struct *fasync;
68 : struct hidraw *hidraw;
69 : struct list_head node;
70 : struct mutex read_mutex;
71 : };
72 :
73 : #ifdef CONFIG_HIDRAW
74 : int hidraw_init(void);
75 : void hidraw_exit(void);
76 : void hidraw_report_event(struct hid_device *, u8 *, int);
77 : int hidraw_connect(struct hid_device *);
78 : void hidraw_disconnect(struct hid_device *);
79 : #else
80 1 : static inline int hidraw_init(void) { return 0; }
81 : static inline void hidraw_exit(void) { }
82 : static inline void hidraw_report_event(struct hid_device *hid, u8 *data, int len) { }
83 2 : static inline int hidraw_connect(struct hid_device *hid) { return -1; }
84 0 : static inline void hidraw_disconnect(struct hid_device *hid) { }
85 : #endif
86 0 :
87 : #endif
88 :
89 : #endif
|