• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright (c) 2016, Oracle and/or its affiliates.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef	LIBUSB_SUNOS_H
21 #define	LIBUSB_SUNOS_H
22 
23 #include <libdevinfo.h>
24 #include <pthread.h>
25 #include "libusbi.h"
26 
27 #define	READ	0
28 #define	WRITE	1
29 
30 typedef struct sunos_device_priv {
31 	uint8_t	cfgvalue;		/* active config value */
32 	uint8_t	*raw_cfgdescr;		/* active config descriptor */
33 	struct libusb_device_descriptor	dev_descr;	/* usb device descriptor */
34 	char	*ugenpath;		/* name of the ugen(4) node */
35 	char	*phypath;		/* physical path */
36 } sunos_dev_priv_t;
37 
38 typedef	struct endpoint {
39 	int datafd;	/* data file */
40 	int statfd;	/* state file */
41 } sunos_ep_priv_t;
42 
43 typedef struct sunos_device_handle_priv {
44 	uint8_t			altsetting[USB_MAXINTERFACES];	/* a interface's alt */
45 	uint8_t			config_index;
46 	sunos_ep_priv_t		eps[USB_MAXENDPOINTS];
47 	sunos_dev_priv_t	*dpriv; /* device private */
48 } sunos_dev_handle_priv_t;
49 
50 typedef	struct sunos_transfer_priv {
51 	struct aiocb		aiocb;
52 	struct libusb_transfer	*transfer;
53 } sunos_xfer_priv_t;
54 
55 struct node_args {
56 	struct libusb_context	*ctx;
57 	struct discovered_devs	**discdevs;
58 	const char		*last_ugenpath;
59 	di_devlink_handle_t	dlink_hdl;
60 };
61 
62 struct devlink_cbarg {
63 	struct node_args	*nargs;	/* di node walk arguments */
64 	di_node_t		myself;	/* the di node */
65 	di_minor_t		minor;
66 };
67 
68 /* AIO callback args */
69 struct aio_callback_args{
70 	struct libusb_transfer *transfer;
71 	struct aiocb aiocb;
72 };
73 
74 #endif /* LIBUSB_SUNOS_H */
75