1 | /* $NetBSD: usb.h,v 1.5 1999/07/02 15:46:53 simonb Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Copyright (c) 1999 Lennart Augustsson <[email protected]>
|
---|
5 | * All rights reserved.
|
---|
6 | *
|
---|
7 | * Redistribution and use in source and binary forms, with or without
|
---|
8 | * modification, are permitted provided that the following conditions
|
---|
9 | * are met:
|
---|
10 | * 1. Redistributions of source code must retain the above copyright
|
---|
11 | * notice, this list of conditions and the following disclaimer.
|
---|
12 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
13 | * notice, this list of conditions and the following disclaimer in the
|
---|
14 | * documentation and/or other materials provided with the distribution.
|
---|
15 | *
|
---|
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
---|
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
---|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
---|
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
---|
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
26 | * SUCH DAMAGE.
|
---|
27 | */
|
---|
28 | /* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/libusb/usb.h,v 1.1.2.2 1999/12/03 10:12:43 hohndel Exp $ */
|
---|
29 |
|
---|
30 | #define _DIAGASSERT(e) assert(e)
|
---|
31 |
|
---|
32 | typedef struct report_desc *report_desc_t;
|
---|
33 |
|
---|
34 | typedef struct hid_data *hid_data_t;
|
---|
35 |
|
---|
36 | typedef enum hid_kind {
|
---|
37 | hid_input, hid_output, hid_feature, hid_collection, hid_endcollection
|
---|
38 | }hid_kind_t;
|
---|
39 |
|
---|
40 | typedef struct hid_item {
|
---|
41 | /* Global */
|
---|
42 | int _usage_page;
|
---|
43 | int logical_minimum;
|
---|
44 | int logical_maximum;
|
---|
45 | int physical_minimum;
|
---|
46 | int physical_maximum;
|
---|
47 | int unit_exponent;
|
---|
48 | int unit;
|
---|
49 | int report_size;
|
---|
50 | int report_ID;
|
---|
51 | int report_count;
|
---|
52 | /* Local */
|
---|
53 | unsigned int usage;
|
---|
54 | int usage_minimum;
|
---|
55 | int usage_maximum;
|
---|
56 | int designator_index;
|
---|
57 | int designator_minimum;
|
---|
58 | int designator_maximum;
|
---|
59 | int string_index;
|
---|
60 | int string_minimum;
|
---|
61 | int string_maximum;
|
---|
62 | int set_delimiter;
|
---|
63 | /* Misc */
|
---|
64 | int collection;
|
---|
65 | int collevel;
|
---|
66 | enum hid_kind kind;
|
---|
67 | unsigned int flags;
|
---|
68 | /* Absolute data position (bits) */
|
---|
69 | unsigned int pos;
|
---|
70 | /* */
|
---|
71 | struct hid_item *next;
|
---|
72 | } hid_item_t;
|
---|
73 |
|
---|
74 | #define HID_PAGE(u) ((u) >> 16)
|
---|
75 | #define HID_USAGE(u) ((u) & 0xffff)
|
---|
76 |
|
---|
77 | /* Obtaining a report descriptor, descr.c: */
|
---|
78 | report_desc_t hid_get_report_desc __P((int file));
|
---|
79 | void hid_dispose_report_desc __P((report_desc_t));
|
---|
80 |
|
---|
81 | /* Parsing of a HID report descriptor, parse.c: */
|
---|
82 | hid_data_t hid_start_parse __P((report_desc_t d, int kindset));
|
---|
83 | void hid_end_parse __P((hid_data_t s));
|
---|
84 | int hid_get_item __P((hid_data_t s, hid_item_t *h));
|
---|
85 | int hid_report_size __P((report_desc_t d, enum hid_kind k, int *idp));
|
---|
86 | int hid_locate __P((report_desc_t d, unsigned int usage, enum hid_kind k, hid_item_t *h));
|
---|
87 |
|
---|
88 | /* Conversion to/from usage names, usage.c: */
|
---|
89 | char *hid_usage_page __P((int i));
|
---|
90 | char *hid_usage_in_page __P((unsigned int u));
|
---|
91 | void hid_init __P((char *file));
|
---|
92 |
|
---|
93 | /* Extracting/insertion of data, data.c: */
|
---|
94 | int hid_get_data __P((void *p, hid_item_t *h));
|
---|
95 | void hid_set_data __P((void *p, hid_item_t *h, int data));
|
---|