Home | History | Annotate | Line # | Download | only in usb
usbhid.h revision 1.1
      1 /*	$NetBSD: usbhid.h,v 1.1 1998/07/12 19:52:01 augustss Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * Author: Lennart Augustsson <augustss (at) carlstedt.se>
      8  *         Carlstedt Research & Technology
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 
     40 #ifndef _USBHID_H_
     41 #define _USBHID_H_
     42 
     43 #define UR_GET_HID_DESCRIPTOR	0x06
     44 #define  UDESC_HID		0x21
     45 #define  UDESC_REPORT		0x22
     46 #define  UDESC_PHYSICAL		0x23
     47 #define UR_SET_HID_DESCRIPTOR	0x07
     48 #define UR_GET_REPORT		0x01
     49 #define UR_SET_REPORT		0x09
     50 #define UR_GET_IDLE		0x02
     51 #define UR_SET_IDLE		0x0a
     52 #define UR_GET_PROTOCOL		0x03
     53 #define UR_SET_PROTOCOL		0x0b
     54 
     55 typedef struct usb_hid_descriptor {
     56 	uByte		bLength;
     57 	uByte		bDescriptorType;
     58 	uWord		bcdHID;
     59 	uByte		bCountryCode;
     60 	uByte		bNumDescriptors;
     61 	struct {
     62 		uByte		bDescriptorType;
     63 		uWord		wDescriptorLength;
     64 	} descrs[1];
     65 } usb_hid_descriptor_t;
     66 #define USB_HID_DESCRIPTOR_SIZE(n) (9+(n)*3)
     67 
     68 /* Usage pages */
     69 #define HUP_GENERIC_DESKTOP	0x0001
     70 #define HUP_SIMULATION		0x0002
     71 #define HUP_LEDS		0x0008
     72 #define HUP_BUTTON		0x0009
     73 
     74 /* Usages, generic desktop */
     75 #define HUG_MOUSE		0x0002
     76 #define HUG_X			0x0030
     77 #define HUG_Y			0x0031
     78 #define HUG_Z			0x0032
     79 #define HUG_WHEEL		0x0038
     80 
     81 #define HID_USAGE2(p,u) (((p) << 16) | u)
     82 
     83 #define UHID_INPUT_REPORT 0x01
     84 #define UHID_OUTPUT_REPORT 0x02
     85 #define UHID_FEATURE_REPORT 0x03
     86 
     87 /* Bits in the input/output/feature items */
     88 #define HIO_CONST	0x001
     89 #define HIO_VARIABLE	0x002
     90 #define HIO_RELATIVE	0x004
     91 #define HIO_WRAP	0x008
     92 #define HIO_NONLINEAR	0x010
     93 #define HIO_NOPREF	0x020
     94 #define HIO_NULLSTATE	0x040
     95 #define HIO_VOLATILE	0x080
     96 #define HIO_BUFBYTES	0x100
     97 
     98 #endif /* _USBHID_H_ */
     99