Document MAKEOBJDIRPREFIX.
[dragonfly.git] / sys / bus / usb / hid.h
1 /*
2  * $NetBSD: hid.h,v 1.6 2000/06/01 14:28:57 augustss Exp $
3  * $FreeBSD: src/sys/dev/usb/hid.h,v 1.12 2003/07/04 01:50:38 jmg Exp $
4  * $DragonFly: src/sys/bus/usb/hid.h,v 1.3 2003/12/30 01:01:44 dillon Exp $
5  */
6
7 /*
8  * Copyright (c) 1998 The NetBSD Foundation, Inc.
9  * All rights reserved.
10  *
11  * This code is derived from software contributed to The NetBSD Foundation
12  * by Lennart Augustsson (lennart@augustsson.net) at
13  * Carlstedt Research & Technology.
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions
17  * are met:
18  * 1. Redistributions of source code must retain the above copyright
19  *    notice, this list of conditions and the following disclaimer.
20  * 2. Redistributions in binary form must reproduce the above copyright
21  *    notice, this list of conditions and the following disclaimer in the
22  *    documentation and/or other materials provided with the distribution.
23  * 3. All advertising materials mentioning features or use of this software
24  *    must display the following acknowledgement:
25  *        This product includes software developed by the NetBSD
26  *        Foundation, Inc. and its contributors.
27  * 4. Neither the name of The NetBSD Foundation nor the names of its
28  *    contributors may be used to endorse or promote products derived
29  *    from this software without specific prior written permission.
30  *
31  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
32  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
33  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
35  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGE.
42  */
43
44 enum hid_kind {
45         hid_input, hid_output, hid_feature, hid_collection, hid_endcollection
46 };
47
48 struct hid_location {
49         u_int32_t size;
50         u_int32_t count;
51         u_int32_t pos;
52 };
53
54 struct hid_item {
55         /* Global */
56         int32_t _usage_page;
57         int32_t logical_minimum;
58         int32_t logical_maximum;
59         int32_t physical_minimum;
60         int32_t physical_maximum;
61         int32_t unit_exponent;
62         int32_t unit;
63         int32_t report_ID;
64         /* Local */
65         int32_t usage;
66         int32_t usage_minimum;
67         int32_t usage_maximum;
68         int32_t designator_index;
69         int32_t designator_minimum;
70         int32_t designator_maximum;
71         int32_t string_index;
72         int32_t string_minimum;
73         int32_t string_maximum;
74         int32_t set_delimiter;
75         /* Misc */
76         int32_t collection;
77         int collevel;
78         enum hid_kind kind;
79         u_int32_t flags;
80         /* Location */
81         struct hid_location loc;
82         /* */
83         struct hid_item *next;
84 };
85
86 struct hid_data *hid_start_parse(void *d, int len, int kindset);
87 void hid_end_parse(struct hid_data *s);
88 int hid_get_item(struct hid_data *s, struct hid_item *h);
89 int hid_report_size(void *buf, int len, enum hid_kind k, u_int8_t *id);
90 int hid_locate(void *desc, int size, u_int32_t usage,
91                     enum hid_kind kind, struct hid_location *loc,
92                     u_int32_t *flags);
93 u_long hid_get_data(u_char *buf, struct hid_location *loc);
94 int hid_is_collection(void *desc, int size, u_int32_t usage);