usbhid.h revision 1.19 1 1.19 christos /* $NetBSD: usbhid.h,v 1.19 2020/03/04 01:23:08 christos Exp $ */
2 1.6 augustss /* $FreeBSD: src/sys/dev/usb/usbhid.h,v 1.7 1999/11/17 22:33:51 n_hibma Exp $ */
3 1.1 augustss
4 1.1 augustss /*
5 1.1 augustss * Copyright (c) 1998 The NetBSD Foundation, Inc.
6 1.1 augustss * All rights reserved.
7 1.1 augustss *
8 1.2 augustss * This code is derived from software contributed to The NetBSD Foundation
9 1.7 augustss * by Lennart Augustsson (lennart (at) augustsson.net) at
10 1.2 augustss * Carlstedt Research & Technology.
11 1.1 augustss *
12 1.1 augustss * Redistribution and use in source and binary forms, with or without
13 1.1 augustss * modification, are permitted provided that the following conditions
14 1.1 augustss * are met:
15 1.1 augustss * 1. Redistributions of source code must retain the above copyright
16 1.1 augustss * notice, this list of conditions and the following disclaimer.
17 1.1 augustss * 2. Redistributions in binary form must reproduce the above copyright
18 1.1 augustss * notice, this list of conditions and the following disclaimer in the
19 1.1 augustss * documentation and/or other materials provided with the distribution.
20 1.1 augustss *
21 1.1 augustss * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 1.1 augustss * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 1.1 augustss * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 1.1 augustss * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 1.1 augustss * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 1.1 augustss * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 1.1 augustss * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 1.1 augustss * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 1.1 augustss * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 1.1 augustss * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 1.1 augustss * POSSIBILITY OF SUCH DAMAGE.
32 1.1 augustss */
33 1.1 augustss
34 1.1 augustss
35 1.15 dholland #ifndef _DEV_USB_USBHID_H_
36 1.15 dholland #define _DEV_USB_USBHID_H_
37 1.1 augustss
38 1.18 maya #include <dev/hid/hid.h>
39 1.19 christos #include <sys/ioccom.h>
40 1.18 maya
41 1.1 augustss #define UR_GET_HID_DESCRIPTOR 0x06
42 1.1 augustss #define UDESC_HID 0x21
43 1.1 augustss #define UDESC_REPORT 0x22
44 1.1 augustss #define UDESC_PHYSICAL 0x23
45 1.1 augustss #define UR_SET_HID_DESCRIPTOR 0x07
46 1.1 augustss #define UR_GET_REPORT 0x01
47 1.1 augustss #define UR_SET_REPORT 0x09
48 1.1 augustss #define UR_GET_IDLE 0x02
49 1.1 augustss #define UR_SET_IDLE 0x0a
50 1.1 augustss #define UR_GET_PROTOCOL 0x03
51 1.1 augustss #define UR_SET_PROTOCOL 0x0b
52 1.1 augustss
53 1.1 augustss typedef struct usb_hid_descriptor {
54 1.1 augustss uByte bLength;
55 1.1 augustss uByte bDescriptorType;
56 1.1 augustss uWord bcdHID;
57 1.1 augustss uByte bCountryCode;
58 1.1 augustss uByte bNumDescriptors;
59 1.1 augustss struct {
60 1.1 augustss uByte bDescriptorType;
61 1.1 augustss uWord wDescriptorLength;
62 1.1 augustss } descrs[1];
63 1.8 augustss } UPACKED usb_hid_descriptor_t;
64 1.1 augustss #define USB_HID_DESCRIPTOR_SIZE(n) (9+(n)*3)
65 1.1 augustss
66 1.1 augustss #define UHID_INPUT_REPORT 0x01
67 1.1 augustss #define UHID_OUTPUT_REPORT 0x02
68 1.1 augustss #define UHID_FEATURE_REPORT 0x03
69 1.10 augustss
70 1.19 christos #define USB_HID_GET_RAW _IOR('h', 1, int)
71 1.19 christos #define USB_HID_SET_RAW _IOW('h', 2, int)
72 1.19 christos
73 1.15 dholland #endif /* _DEV_USB_USBHID_H_ */
74