source: mainline/uspace/lib/usbhid/include/usb/classes/hidpath.h@ a81a1d09

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since a81a1d09 was 3e4f2e0, checked in by Vojtech Horky <vojtechhorky@…>, 15 years ago

libusb divided into sublibraries

Also removed address keeper test from tester as it is useless.

Directory reorganization of the include/ will follow.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 * Copyright (c) 2011 Matej Klonfar
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup libusb
30 * @{
31 */
32/** @file
33 * USB HID report descriptor and report data parser
34 */
35#ifndef LIBUSB_HIDPATH_H_
36#define LIBUSB_HIDPATH_H_
37
38#include <usb/classes/hidparser.h>
39#include <stdint.h>
40#include <adt/list.h>
41
42/**
43 * Description of path of usage pages and usages in report descriptor
44 */
45/** Wanted usage path must be exactly the same as the searched one */
46#define USB_HID_PATH_COMPARE_STRICT 0
47/** Wanted usage path must be the suffix in the searched one */
48#define USB_HID_PATH_COMPARE_END 1
49/** */
50#define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY 2
51/** Searched usage page must be prefix of the other one */
52#define USB_HID_PATH_COMPARE_BEGIN 4
53/** Searched couple of usage page and usage can be anywhere in usage path */
54#define USB_HID_PATH_COMPARE_ANYWHERE 8
55
56
57/** Collection usage path structure */
58typedef struct {
59 /** */
60 uint32_t usage_page;
61 /** */
62 uint32_t usage;
63
64 uint8_t flags;
65 /** */
66 link_t link;
67} usb_hid_report_usage_path_t;
68
69/** */
70typedef struct {
71 /** */
72 int depth;
73 uint8_t report_id;
74
75 /** */
76 link_t link; /* list */
77
78 link_t head; /* head of list of usage paths */
79
80} usb_hid_report_path_t;
81
82/** */
83usb_hid_report_path_t *usb_hid_report_path(void);
84
85/** */
86void usb_hid_report_path_free(usb_hid_report_path_t *path);
87
88/** */
89int usb_hid_report_path_set_report_id(usb_hid_report_path_t *usage_path,
90 uint8_t report_id);
91
92/** */
93int usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path,
94 int32_t usage_page, int32_t usage);
95
96/** */
97void usb_hid_report_remove_last_item(usb_hid_report_path_t *usage_path);
98
99/** */
100void usb_hid_report_null_last_item(usb_hid_report_path_t *usage_path);
101
102/** */
103void usb_hid_report_set_last_item(usb_hid_report_path_t *usage_path,
104 int32_t tag, int32_t data);
105
106/** */
107int usb_hid_report_compare_usage_path(usb_hid_report_path_t *report_path,
108 usb_hid_report_path_t *path, int flags);
109
110/** */
111usb_hid_report_path_t *usb_hid_report_path_clone(usb_hid_report_path_t *usage_path);
112
113void usb_hid_print_usage_path(usb_hid_report_path_t *path);
114
115#endif
116/**
117 * @}
118 */
Note: See TracBrowser for help on using the repository browser.