root/dev/usb/hid.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


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

/* [<][>][^][v][top][bottom][index][help] */