Annotation of sys/dev/usb/uhidev.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: uhidev.h,v 1.9 2007/06/14 08:08:21 mbalmer Exp $ */
2: /* $NetBSD: uhidev.h,v 1.3 2002/10/08 09:56:17 dan Exp $ */
3:
4: /*
5: * Copyright (c) 2001 The NetBSD Foundation, Inc.
6: * All rights reserved.
7: *
8: * This code is derived from software contributed to The NetBSD Foundation
9: * by Lennart Augustsson (lennart@augustsson.net) at
10: * Carlstedt Research & Technology.
11: *
12: * Redistribution and use in source and binary forms, with or without
13: * modification, are permitted provided that the following conditions
14: * are met:
15: * 1. Redistributions of source code must retain the above copyright
16: * notice, this list of conditions and the following disclaimer.
17: * 2. Redistributions in binary form must reproduce the above copyright
18: * notice, this list of conditions and the following disclaimer in the
19: * documentation and/or other materials provided with the distribution.
20: * 3. All advertising materials mentioning features or use of this software
21: * must display the following acknowledgement:
22: * This product includes software developed by the NetBSD
23: * Foundation, Inc. and its contributors.
24: * 4. Neither the name of The NetBSD Foundation nor the names of its
25: * contributors may be used to endorse or promote products derived
26: * from this software without specific prior written permission.
27: *
28: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38: * POSSIBILITY OF SUCH DAMAGE.
39: */
40:
41: #define UHIDBUSCF_REPORTID 0
42: #define UHIDBUSCF_REPORTID_DEFAULT -1
43:
44: #define uhidevcf_reportid cf_loc[UHIDBUSCF_REPORTID]
45: #define UHIDEV_UNK_REPORTID UHIDBUSCF_REPORTID_DEFAULT
46:
47: struct uhidev_softc {
48: struct device sc_dev; /* base device */
49: usbd_device_handle sc_udev;
50: usbd_interface_handle sc_iface; /* interface */
51: usbd_pipe_handle sc_ipipe; /* input interrupt pipe */
52: usbd_xfer_handle sc_ixfer; /* read request */
53: int sc_iep_addr;
54:
55: u_char *sc_ibuf;
56: u_int sc_isize;
57:
58: usbd_pipe_handle sc_opipe; /* output interrupt pipe */
59: usbd_xfer_handle sc_oxfer; /* write request */
60: usbd_xfer_handle sc_owxfer; /* internal write request */
61: int sc_oep_addr;
62:
63: void *sc_repdesc;
64: int sc_repdesc_size;
65:
66: u_int sc_nrepid;
67: struct uhidev **sc_subdevs;
68:
69: int sc_refcnt;
70: u_char sc_dying;
71: };
72:
73: struct uhidev {
74: struct device sc_dev; /* base device */
75: struct uhidev_softc *sc_parent;
76: uByte sc_report_id;
77: u_int8_t sc_state;
78: int sc_in_rep_size;
79: #define UHIDEV_OPEN 0x01 /* device is open */
80: void (*sc_intr)(struct uhidev *, void *, u_int);
81: };
82:
83: struct uhidev_attach_arg {
84: struct usb_attach_arg *uaa;
85: struct uhidev_softc *parent;
86: int reportid;
87: int reportsize;
88: int matchlvl;
89: };
90:
91: void uhidev_get_report_desc(struct uhidev_softc *, void **, int *);
92: int uhidev_open(struct uhidev *);
93: void uhidev_close(struct uhidev *);
94: usbd_status uhidev_set_report(struct uhidev *scd, int type, void *data,int len);
95: void uhidev_set_report_async(struct uhidev *scd, int type, void *data, int len);
96: usbd_status uhidev_get_report(struct uhidev *scd, int type, void *data,int len);
97: usbd_status uhidev_write(struct uhidev_softc *, void *, int);
CVSweb