aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hidp/hidp.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /net/bluetooth/hidp/hidp.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'net/bluetooth/hidp/hidp.h')
-rw-r--r--net/bluetooth/hidp/hidp.h167
1 files changed, 167 insertions, 0 deletions
diff --git a/net/bluetooth/hidp/hidp.h b/net/bluetooth/hidp/hidp.h
new file mode 100644
index 000000000000..c2775f587d2e
--- /dev/null
+++ b/net/bluetooth/hidp/hidp.h
@@ -0,0 +1,167 @@
1/*
2 HIDP implementation for Linux Bluetooth stack (BlueZ).
3 Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 as
7 published by the Free Software Foundation;
8
9 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
12 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
13 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
19 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
20 SOFTWARE IS DISCLAIMED.
21*/
22
23#ifndef __HIDP_H
24#define __HIDP_H
25
26#include <linux/types.h>
27#include <net/bluetooth/bluetooth.h>
28
29/* HIDP header masks */
30#define HIDP_HEADER_TRANS_MASK 0xf0
31#define HIDP_HEADER_PARAM_MASK 0x0f
32
33/* HIDP transaction types */
34#define HIDP_TRANS_HANDSHAKE 0x00
35#define HIDP_TRANS_HID_CONTROL 0x10
36#define HIDP_TRANS_GET_REPORT 0x40
37#define HIDP_TRANS_SET_REPORT 0x50
38#define HIDP_TRANS_GET_PROTOCOL 0x60
39#define HIDP_TRANS_SET_PROTOCOL 0x70
40#define HIDP_TRANS_GET_IDLE 0x80
41#define HIDP_TRANS_SET_IDLE 0x90
42#define HIDP_TRANS_DATA 0xa0
43#define HIDP_TRANS_DATC 0xb0
44
45/* HIDP handshake results */
46#define HIDP_HSHK_SUCCESSFUL 0x00
47#define HIDP_HSHK_NOT_READY 0x01
48#define HIDP_HSHK_ERR_INVALID_REPORT_ID 0x02
49#define HIDP_HSHK_ERR_UNSUPPORTED_REQUEST 0x03
50#define HIDP_HSHK_ERR_INVALID_PARAMETER 0x04
51#define HIDP_HSHK_ERR_UNKNOWN 0x0e
52#define HIDP_HSHK_ERR_FATAL 0x0f
53
54/* HIDP control operation parameters */
55#define HIDP_CTRL_NOP 0x00
56#define HIDP_CTRL_HARD_RESET 0x01
57#define HIDP_CTRL_SOFT_RESET 0x02
58#define HIDP_CTRL_SUSPEND 0x03
59#define HIDP_CTRL_EXIT_SUSPEND 0x04
60#define HIDP_CTRL_VIRTUAL_CABLE_UNPLUG 0x05
61
62/* HIDP data transaction headers */
63#define HIDP_DATA_RTYPE_MASK 0x03
64#define HIDP_DATA_RSRVD_MASK 0x0c
65#define HIDP_DATA_RTYPE_OTHER 0x00
66#define HIDP_DATA_RTYPE_INPUT 0x01
67#define HIDP_DATA_RTYPE_OUPUT 0x02
68#define HIDP_DATA_RTYPE_FEATURE 0x03
69
70/* HIDP protocol header parameters */
71#define HIDP_PROTO_BOOT 0x00
72#define HIDP_PROTO_REPORT 0x01
73
74/* HIDP ioctl defines */
75#define HIDPCONNADD _IOW('H', 200, int)
76#define HIDPCONNDEL _IOW('H', 201, int)
77#define HIDPGETCONNLIST _IOR('H', 210, int)
78#define HIDPGETCONNINFO _IOR('H', 211, int)
79
80#define HIDP_VIRTUAL_CABLE_UNPLUG 0
81#define HIDP_BOOT_PROTOCOL_MODE 1
82#define HIDP_BLUETOOTH_VENDOR_ID 9
83
84struct hidp_connadd_req {
85 int ctrl_sock; // Connected control socket
86 int intr_sock; // Connteted interrupt socket
87 __u16 parser;
88 __u16 rd_size;
89 __u8 *rd_data;
90 __u8 country;
91 __u8 subclass;
92 __u16 vendor;
93 __u16 product;
94 __u16 version;
95 __u32 flags;
96 __u32 idle_to;
97 char name[128];
98};
99
100struct hidp_conndel_req {
101 bdaddr_t bdaddr;
102 __u32 flags;
103};
104
105struct hidp_conninfo {
106 bdaddr_t bdaddr;
107 __u32 flags;
108 __u16 state;
109 __u16 vendor;
110 __u16 product;
111 __u16 version;
112 char name[128];
113};
114
115struct hidp_connlist_req {
116 __u32 cnum;
117 struct hidp_conninfo __user *ci;
118};
119
120int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock);
121int hidp_del_connection(struct hidp_conndel_req *req);
122int hidp_get_connlist(struct hidp_connlist_req *req);
123int hidp_get_conninfo(struct hidp_conninfo *ci);
124
125/* HIDP session defines */
126struct hidp_session {
127 struct list_head list;
128
129 struct socket *ctrl_sock;
130 struct socket *intr_sock;
131
132 bdaddr_t bdaddr;
133
134 unsigned long state;
135 unsigned long flags;
136 unsigned long idle_to;
137
138 uint ctrl_mtu;
139 uint intr_mtu;
140
141 atomic_t terminate;
142
143 unsigned char keys[8];
144 unsigned char leds;
145
146 struct input_dev *input;
147
148 struct timer_list timer;
149
150 struct sk_buff_head ctrl_transmit;
151 struct sk_buff_head intr_transmit;
152};
153
154static inline void hidp_schedule(struct hidp_session *session)
155{
156 struct sock *ctrl_sk = session->ctrl_sock->sk;
157 struct sock *intr_sk = session->intr_sock->sk;
158
159 wake_up_interruptible(ctrl_sk->sk_sleep);
160 wake_up_interruptible(intr_sk->sk_sleep);
161}
162
163/* HIDP init defines */
164extern int __init hidp_init_sockets(void);
165extern void __exit hidp_cleanup_sockets(void);
166
167#endif /* __HIDP_H */