| 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 |
char *ugenpath; /* name of the ugen(4) node */ |
| 34 |
char *phypath; /* physical path */ |
| 35 |
} sunos_dev_priv_t; |
| 36 |
|
| 37 |
typedef struct endpoint { |
| 38 |
int datafd; /* data file */ |
| 39 |
int statfd; /* state file */ |
| 40 |
} sunos_ep_priv_t; |
| 41 |
|
| 42 |
typedef struct sunos_device_handle_priv { |
| 43 |
uint8_t altsetting[USB_MAXINTERFACES]; /* a interface's alt */ |
| 44 |
uint8_t config_index; |
| 45 |
sunos_ep_priv_t eps[USB_MAXENDPOINTS]; |
| 46 |
sunos_dev_priv_t *dpriv; /* device private */ |
| 47 |
} sunos_dev_handle_priv_t; |
| 48 |
|
| 49 |
typedef struct sunos_transfer_priv { |
| 50 |
struct aiocb aiocb; |
| 51 |
struct libusb_transfer *transfer; |
| 52 |
} sunos_xfer_priv_t; |
| 53 |
|
| 54 |
struct node_args { |
| 55 |
struct libusb_context *ctx; |
| 56 |
struct discovered_devs **discdevs; |
| 57 |
const char *last_ugenpath; |
| 58 |
di_devlink_handle_t dlink_hdl; |
| 59 |
}; |
| 60 |
|
| 61 |
struct devlink_cbarg { |
| 62 |
struct node_args *nargs; /* di node walk arguments */ |
| 63 |
di_node_t myself; /* the di node */ |
| 64 |
di_minor_t minor; |
| 65 |
}; |
| 66 |
|
| 67 |
typedef struct walk_link { |
| 68 |
char *path; |
| 69 |
int len; |
| 70 |
char **linkpp; |
| 71 |
} walk_link_t; |
| 72 |
|
| 73 |
/* AIO callback args */ |
| 74 |
struct aio_callback_args{ |
| 75 |
struct libusb_transfer *transfer; |
| 76 |
struct aiocb aiocb; |
| 77 |
}; |
| 78 |
|
| 79 |
#endif /* LIBUSB_SUNOS_H */ |