components/libusb/wrapper/src/wr_libusb.h
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Fri, 15 Jan 2016 13:34:30 -0800
changeset 5289 255be830c2e5
parent 229 1fd565334dfc
permissions -rw-r--r--
Close of build 91.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
229
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     1
/*
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     2
 * CDDL HEADER START
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     3
 *
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     7
 *
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    11
 * and limitations under the License.
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    12
 *
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    18
 *
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    19
 * CDDL HEADER END
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    20
 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    21
/*
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    22
 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    23
 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    24
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    25
#ifndef	_WR_LIBUSB_H
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    26
#define	_WR_LIBUSB_H
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    27
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    28
#ifdef	__cplusplus
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    29
extern "C" {
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    30
#endif
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    31
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    32
/* debug levels */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    33
#define	DEBUG_NONE		0
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    34
#define	DEBUG_ERRORS		1
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    35
#define	DEBUG_RECOVERABLE	2
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    36
#define	DEBUG_FUNCTIONS		3
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    37
#define	DEBUG_DETAILED		4
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    38
#define	DEBUG_DATA_DUMP		5
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    39
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    40
#define	MOD_SUFFIX	".so"
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    41
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    42
/* consistent with the Makefile VER and mapfiles */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    43
#define	LIBUSB_WRAPPER_VERSION	"1.1"
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    44
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    45
#define	PLUGIN_EXCLUSIVE 2
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    46
#define	MAX_PLUGINS 10
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    47
#define	MAX_VERSION_LEN	512
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    48
#define	SUCCESS 0
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    49
#define	FAILURE -1
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    50
#define	DSYM (dlsym((handle), (symbol)))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    51
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    52
/* default plugin dir */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    53
#define	PLUGIN_DIR	"/usr/lib/libusb_plugins"
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    54
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    55
#define	USB_OPEN			0
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    56
#define	USB_CLOSE			1
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    57
#define	USB_GET_STRING			2
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    58
#define	USB_GET_STRING_SIMPLE		3
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    59
#define	USB_GET_DESCRIPTOR_BY_ENDPOINT	4
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    60
#define	USB_GET_DESCRIPTOR		5
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    61
#define	USB_BULK_WRITE			6
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    62
#define	USB_BULK_READ			7
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    63
#define	USB_INTERRUPT_WRITE		8
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    64
#define	USB_INTERRUPT_READ		9
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    65
#define	USB_CONTROL_MSG			10
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    66
#define	USB_SET_CONFIGURATION		11
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    67
#define	USB_CLAIM_INTERFACE		12
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    68
#define	USB_RELEASE_INTERFACE		13
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    69
#define	USB_SET_ALTINTERFACE		14
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    70
#define	USB_RESETEP			15
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    71
#define	USB_CLEAR_HALT			16
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    72
#define	USB_RESET			17
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    73
#define	USB_INIT			18
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    74
#define	USB_SET_DEBUG			19
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    75
#define	USB_FIND_BUSSES			20
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    76
#define	USB_FIND_DEVICES		21
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    77
#define	USB_DEVICE			22
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    78
#define	USB_GET_BUSSES			23
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    79
#define	USB_STRERROR			24
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    80
#define	USB_BUSSES			25
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    81
#define	LIBUSB_INIT			26
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    82
#define	LIBUSB_FINI			27
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    83
#define	LIBUSB_VERSION			28
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    84
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    85
char *sym_names[] = {
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    86
	"usb_open",				/* 0 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    87
	"usb_close",				/* 1 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    88
	"usb_get_string",			/* 2 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    89
	"usb_get_string_simple",		/* 3 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    90
	"usb_get_descriptor_by_endpoint",	/* 4 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    91
	"usb_get_descriptor",			/* 5 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    92
	"usb_bulk_write",			/* 6 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    93
	"usb_bulk_read",			/* 7 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    94
	"usb_interrupt_write",			/* 8 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    95
	"usb_interrupt_read",			/* 9 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    96
	"usb_control_msg",			/* 10 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    97
	"usb_set_configuration",  		/* 11 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    98
	"usb_claim_interface",			/* 12 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    99
	"usb_release_interface",		/* 13 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   100
	"usb_set_altinterface",			/* 14 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   101
	"usb_resetep",				/* 15 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   102
	"usb_clear_halt",			/* 16 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   103
	"usb_reset",				/* 17 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   104
	"usb_init",				/* 18 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   105
	"usb_set_debug",			/* 19 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   106
	"usb_find_busses",			/* 20 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   107
	"usb_find_devices",			/* 21 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   108
	"usb_device",				/* 22 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   109
	"usb_get_busses",			/* 23 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   110
	"usb_strerror",				/* 24 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   111
	"usb_busses", 				/* 25 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   112
	"libusb_init", 				/* 26 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   113
	"libusb_fini", 				/* 27 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   114
	"libusb_version" 			/* 28 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   115
};
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   116
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   117
#define	USB_OPEN_CAST			(struct usb_dev_handle *(*) \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   118
					    (struct usb_device *))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   119
#define	USB_CLOSE_CAST			(int (*)(usb_dev_handle *))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   120
#define	USB_GET_STRING_CAST		(int (*) (usb_dev_handle *, int, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   121
					    int, char *, size_t))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   122
#define	USB_GET_STRING_SIMPLE_CAST	(int (*) (usb_dev_handle *, int, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   123
					    char *, size_t))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   124
#define	USB_GET_DESCRIPTOR_BY_ENDPOINT_CAST (int (*) (usb_dev_handle *, int, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   125
					    unsigned char, unsigned char, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   126
					    void *, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   127
#define	USB_GET_DESCRIPTOR_CAST		(int (*)(usb_dev_handle *, unsigned \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   128
					    char, unsigned char, void *, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   129
#define	USB_BULK_WRITE_CAST 		(int (*) (usb_dev_handle *, int, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   130
					    char *, int, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   131
#define	USB_BULK_READ_CAST		(int (*) (usb_dev_handle *, int, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   132
					    char *, int, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   133
#define	USB_INTERRUPT_READ_CAST		(int (*) (usb_dev_handle *, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   134
					    int, char *, int, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   135
#define	USB_INTERRUPT_WRITE_CAST	(int (*) (usb_dev_handle *, int, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   136
					    char *, int, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   137
#define	USB_CONTROL_MSG_CAST		(int (*)(usb_dev_handle *, int, int, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   138
					    int, int, char *, int, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   139
#define	USB_SET_CONFIGURATION_CAST	(int (*)(usb_dev_handle *, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   140
#define	USB_CLAIM_INTERFACE_CAST	(int (*)(usb_dev_handle *, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   141
#define	USB_RELEASE_INTERFACE_CAST	(int (*)(usb_dev_handle *, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   142
#define	USB_SET_ALTINTERFACE_CAST	(int (*)(usb_dev_handle *, int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   143
#define	USB_RESETEP_CAST		(int (*)(usb_dev_handle *, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   144
					    unsigned int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   145
#define	USB_CLEAR_HALT_CAST		(int (*)(usb_dev_handle *, \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   146
					    unsigned int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   147
#define	USB_RESET_CAST			(int (*)(usb_dev_handle *))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   148
#define	USB_INIT_CAST			(void (*)(void))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   149
#define	USB_SET_DEBUG_CAST		(void (*)(int))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   150
#define	USB_FIND_BUSSES_CAST		(int (*)(void))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   151
#define	USB_FIND_DEVICES_CAST		(int (*) (void))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   152
#define	USB_DEVICE_CAST			(struct usb_device *(*) \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   153
					    (usb_dev_handle *))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   154
#define	USB_STRERROR_CAST		(char *(*)(void))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   155
#define	USB_BUSSES_CAST			(struct usb_bus **)
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   156
#define	LIBUSB_INIT_CAST		(int (*)(void))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   157
#define	LIBUSB_FINI_CAST		(int (*)(void))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   158
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   159
#define	NUM_SYMS			(unsigned int)(sizeof (sym_names) / \
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   160
					sizeof (char *))
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   161
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   162
/*
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   163
 * wrapper info structure - maintains wrapper state
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   164
 * and plugins data
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   165
 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   166
typedef struct wrapper_info {
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   167
	int 	ploaded;		/* highest plugin index */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   168
	int 	last_pindex;		/* last plugin index used by app */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   169
	int 	active_index;		/* used to indicate single plugin */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   170
	int 	exclusive_index;	/* if set then this plugin is excl */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   171
	struct 	usb_bus *head_busp;	/* wrapper combined usb_busses ptr */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   172
} wrapper_info_t;
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   173
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   174
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   175
/*
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   176
 * this is the dev_handles struct that each plugin
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   177
 * maintains a linked list of
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   178
 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   179
typedef struct dev_handles {
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   180
	struct usb_dev_handle 	*dev; 		/* usb.h dev handle */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   181
	struct usb_device 	*device;	/* usb.h device pointer */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   182
	struct dev_handles 	*next;		/* for linked list */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   183
	struct dev_handles 	*prev;
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   184
} dev_handles_t;
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   185
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   186
/*
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   187
 * plugin state info
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   188
 */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   189
typedef struct plugin_info {
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   190
	char 		*p_name;		/* module name */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   191
	char 		*p_path;		/* module path */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   192
	void 		*p_handle;		/* handle to plugin */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   193
	int 		exclusive_flag;		/* plugin exclusivity */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   194
	int 		active_flag;		/* is plugin single */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   195
	char 		*prefix;		/* libusb_prefix symbol val */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   196
	dev_handles_t	*dev_handles;		/* list of open dev hdls */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   197
	struct usb_bus 	*busp;			/* plugin bus pointer */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   198
	void 		*sym_hdl[NUM_SYMS];	/* plugin symbols */
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   199
} plugin_info_t;
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   200
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   201
#ifdef	__cplusplus
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   202
}
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   203
#endif
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   204
1fd565334dfc 7043696 libusb should move to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   205
#endif /* _WR_LIBUSB_H */