aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/hid.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/hid.h')
-rw-r--r--include/linux/hid.h51
1 files changed, 8 insertions, 43 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h
index abce7eb4f258..7330a0fef0c0 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -1,12 +1,8 @@
1#ifndef __HID_H
2#define __HID_H
3
4/* 1/*
5 * Copyright (c) 1999 Andreas Gal 2 * Copyright (c) 1999 Andreas Gal
6 * Copyright (c) 2000-2001 Vojtech Pavlik 3 * Copyright (c) 2000-2001 Vojtech Pavlik
7 * Copyright (c) 2006-2007 Jiri Kosina 4 * Copyright (c) 2006-2007 Jiri Kosina
8 */ 5 */
9
10/* 6/*
11 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -26,43 +22,9 @@
26 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: 22 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
27 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 23 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
28 */ 24 */
25#ifndef __HID_H
26#define __HID_H
29 27
30/*
31 * USB HID (Human Interface Device) interface class code
32 */
33
34#define USB_INTERFACE_CLASS_HID 3
35
36/*
37 * USB HID interface subclass and protocol codes
38 */
39
40#define USB_INTERFACE_SUBCLASS_BOOT 1
41#define USB_INTERFACE_PROTOCOL_KEYBOARD 1
42#define USB_INTERFACE_PROTOCOL_MOUSE 2
43
44/*
45 * HID class requests
46 */
47
48#define HID_REQ_GET_REPORT 0x01
49#define HID_REQ_GET_IDLE 0x02
50#define HID_REQ_GET_PROTOCOL 0x03
51#define HID_REQ_SET_REPORT 0x09
52#define HID_REQ_SET_IDLE 0x0A
53#define HID_REQ_SET_PROTOCOL 0x0B
54
55/*
56 * HID class descriptor types
57 */
58
59#define HID_DT_HID (USB_TYPE_CLASS | 0x01)
60#define HID_DT_REPORT (USB_TYPE_CLASS | 0x02)
61#define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
62
63#define HID_MAX_DESCRIPTOR_SIZE 4096
64
65#ifdef __KERNEL__
66 28
67#include <linux/types.h> 29#include <linux/types.h>
68#include <linux/slab.h> 30#include <linux/slab.h>
@@ -73,6 +35,7 @@
73#include <linux/input.h> 35#include <linux/input.h>
74#include <linux/semaphore.h> 36#include <linux/semaphore.h>
75#include <linux/power_supply.h> 37#include <linux/power_supply.h>
38#include <uapi/linux/hid.h>
76 39
77/* 40/*
78 * We parse each description item into this structure. Short items data 41 * We parse each description item into this structure. Short items data
@@ -204,6 +167,7 @@ struct hid_item {
204#define HID_UP_MSVENDOR 0xff000000 167#define HID_UP_MSVENDOR 0xff000000
205#define HID_UP_CUSTOM 0x00ff0000 168#define HID_UP_CUSTOM 0x00ff0000
206#define HID_UP_LOGIVENDOR 0xffbc0000 169#define HID_UP_LOGIVENDOR 0xffbc0000
170#define HID_UP_SENSOR 0x00200000
207 171
208#define HID_USAGE 0x0000ffff 172#define HID_USAGE 0x0000ffff
209 173
@@ -329,6 +293,7 @@ struct hid_item {
329 */ 293 */
330#define HID_GROUP_GENERIC 0x0001 294#define HID_GROUP_GENERIC 0x0001
331#define HID_GROUP_MULTITOUCH 0x0002 295#define HID_GROUP_MULTITOUCH 0x0002
296#define HID_GROUP_SENSOR_HUB 0x0003
332 297
333/* 298/*
334 * This is the global environment of the parser. This information is 299 * This is the global environment of the parser. This information is
@@ -379,6 +344,7 @@ struct hid_collection {
379struct hid_usage { 344struct hid_usage {
380 unsigned hid; /* hid usage code */ 345 unsigned hid; /* hid usage code */
381 unsigned collection_index; /* index into collection array */ 346 unsigned collection_index; /* index into collection array */
347 unsigned usage_index; /* index into usage array */
382 /* hidinput data */ 348 /* hidinput data */
383 __u16 code; /* input driver code */ 349 __u16 code; /* input driver code */
384 __u8 type; /* input driver type */ 350 __u8 type; /* input driver type */
@@ -744,6 +710,7 @@ int hid_input_report(struct hid_device *, int type, u8 *, int, int);
744int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 710int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
745struct hid_field *hidinput_get_led_field(struct hid_device *hid); 711struct hid_field *hidinput_get_led_field(struct hid_device *hid);
746unsigned int hidinput_count_leds(struct hid_device *hid); 712unsigned int hidinput_count_leds(struct hid_device *hid);
713__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
747void hid_output_report(struct hid_report *report, __u8 *data); 714void hid_output_report(struct hid_report *report, __u8 *data);
748struct hid_device *hid_allocate_device(void); 715struct hid_device *hid_allocate_device(void);
749struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 716struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
@@ -754,6 +721,7 @@ int hid_connect(struct hid_device *hid, unsigned int connect_mask);
754void hid_disconnect(struct hid_device *hid); 721void hid_disconnect(struct hid_device *hid);
755const struct hid_device_id *hid_match_id(struct hid_device *hdev, 722const struct hid_device_id *hid_match_id(struct hid_device *hdev,
756 const struct hid_device_id *id); 723 const struct hid_device_id *id);
724s32 hid_snto32(__u32 value, unsigned n);
757 725
758/** 726/**
759 * hid_map_usage - map usage input bits 727 * hid_map_usage - map usage input bits
@@ -944,7 +912,4 @@ do { \
944#define hid_dbg(hid, fmt, arg...) \ 912#define hid_dbg(hid, fmt, arg...) \
945 dev_dbg(&(hid)->dev, fmt, ##arg) 913 dev_dbg(&(hid)->dev, fmt, ##arg)
946 914
947#endif /* __KERNEL__ */
948
949#endif 915#endif
950