usbhid.h revision 1.18 1 1.18 maya /* $NetBSD: usbhid.h,v 1.18 2018/07/15 18:36:51 maya 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.18 maya
40 1.1 augustss #define UR_GET_HID_DESCRIPTOR 0x06
41 1.1 augustss #define UDESC_HID 0x21
42 1.1 augustss #define UDESC_REPORT 0x22
43 1.1 augustss #define UDESC_PHYSICAL 0x23
44 1.1 augustss #define UR_SET_HID_DESCRIPTOR 0x07
45 1.1 augustss #define UR_GET_REPORT 0x01
46 1.1 augustss #define UR_SET_REPORT 0x09
47 1.1 augustss #define UR_GET_IDLE 0x02
48 1.1 augustss #define UR_SET_IDLE 0x0a
49 1.1 augustss #define UR_GET_PROTOCOL 0x03
50 1.1 augustss #define UR_SET_PROTOCOL 0x0b
51 1.1 augustss
52 1.1 augustss typedef struct usb_hid_descriptor {
53 1.1 augustss uByte bLength;
54 1.1 augustss uByte bDescriptorType;
55 1.1 augustss uWord bcdHID;
56 1.1 augustss uByte bCountryCode;
57 1.1 augustss uByte bNumDescriptors;
58 1.1 augustss struct {
59 1.1 augustss uByte bDescriptorType;
60 1.1 augustss uWord wDescriptorLength;
61 1.1 augustss } descrs[1];
62 1.8 augustss } UPACKED usb_hid_descriptor_t;
63 1.1 augustss #define USB_HID_DESCRIPTOR_SIZE(n) (9+(n)*3)
64 1.1 augustss
65 1.1 augustss #define UHID_INPUT_REPORT 0x01
66 1.1 augustss #define UHID_OUTPUT_REPORT 0x02
67 1.1 augustss #define UHID_FEATURE_REPORT 0x03
68 1.10 augustss
69 1.15 dholland #endif /* _DEV_USB_USBHID_H_ */
70