hidpath.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2011 Matej Klonfar
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef LIBUSB_HIDPATH_H_
00036 #define LIBUSB_HIDPATH_H_
00037 
00038 #include <usb/hid/hidparser.h>
00039 #include <stdint.h>
00040 #include <adt/list.h>
00041 
00042 
00043 /*---------------------------------------------------------------------------*/
00044 /*
00045  * Flags of usage paths comparison modes.
00046  *
00047  */
00051 #define USB_HID_PATH_COMPARE_STRICT             0
00052 
00056 #define USB_HID_PATH_COMPARE_END                1
00057 
00062 #define USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY    2
00063 
00067 #define USB_HID_PATH_COMPARE_BEGIN              4
00068 
00073 #define USB_HID_PATH_COMPARE_ANYWHERE           8
00074 
00075 /*----------------------------------------------------------------------------*/
00081 typedef struct {
00083         uint32_t usage_page;
00085         uint32_t usage;
00086 
00088         uint8_t flags;
00089 
00091         link_t link;
00092 } usb_hid_report_usage_path_t;
00093 
00094 
00095 /*---------------------------------------------------------------------------*/
00099 typedef struct {
00101         int depth;      
00102 
00105         uint8_t report_id;
00106         
00108         link_t link; /* list */
00109 
00111         link_t head;
00112 
00113 } usb_hid_report_path_t;
00114 
00115 /*---------------------------------------------------------------------------*/
00116 usb_hid_report_path_t *usb_hid_report_path(void);
00117 
00118 void usb_hid_report_path_free(usb_hid_report_path_t *path);
00119 
00120 int usb_hid_report_path_set_report_id(usb_hid_report_path_t *usage_path,
00121                 uint8_t report_id);
00122 
00123 int usb_hid_report_path_append_item(usb_hid_report_path_t *usage_path, 
00124                 int32_t usage_page, int32_t usage);
00125 
00126 void usb_hid_report_remove_last_item(usb_hid_report_path_t *usage_path);
00127 
00128 void usb_hid_report_null_last_item(usb_hid_report_path_t *usage_path);
00129 
00130 void usb_hid_report_set_last_item(usb_hid_report_path_t *usage_path, 
00131                 int32_t tag, int32_t data);
00132 
00133 int usb_hid_report_compare_usage_path(usb_hid_report_path_t *report_path,
00134                 usb_hid_report_path_t *path, int flags);
00135 
00136 usb_hid_report_path_t *usb_hid_report_path_clone(
00137                 usb_hid_report_path_t *usage_path);
00138 
00139 void usb_hid_print_usage_path(usb_hid_report_path_t *path);
00140 
00141 #endif
00142 

Generated on Thu Jun 2 07:45:48 2011 for HelenOS/USB by  doxygen 1.4.7