~ubuntu-branches/ubuntu/trusty/argyll/trusty-proposed

« back to all changes in this revision

Viewing changes to libusb1/libusb/os/driver/libusb_driver.h

  • Committer: Package Import Robot
  • Author(s): Artur Rona
  • Date: 2014-02-12 00:35:39 UTC
  • mfrom: (13.1.24 sid)
  • Revision ID: package-import@ubuntu.com-20140212003539-24tautzlitsiz61w
Tags: 1.5.1-5ubuntu1
* Merge from Debian unstable. (LP: #1275572) Remaining changes:
  - debian/control:
    + Build-depend on libtiff-dev rather than libtiff4-dev.
  - debian/control, debian/patches/06_fix_udev_rule.patch:
    + Fix udev rules to actually work; ENV{ACL_MANAGE} has
      stopped working ages ago, and with logind it's now the
      "uaccess" tag. Dropping also consolekit from Recommends.
  - debian/patches/drop-usb-db.patch:
    + Use hwdb builtin, instead of the obsolete usb-db
      in the udev rules.
* debian/patches/05_ftbfs-underlinkage.diff:
  - Dropped change, no needed anymore.
* Refresh the patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* LIBUSB-WIN32, Generic Windows USB Library
2
 
 * Copyright (c) 2002-2005 Stephan Meyer <ste_meyer@web.de>
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or modify
5
 
 * it under the terms of the GNU General Public License as published by
6
 
 * the Free Software Foundation; either version 2 of the License, or
7
 
 * (at your option) any later version.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful,
10
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
 * GNU General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
 
 */
18
 
 
19
 
 
20
 
#ifndef __LIBUSB_DRIVER_H__
21
 
#define __LIBUSB_DRIVER_H__
22
 
 
23
 
#ifdef __GNUC__
24
 
#include <ddk/usb100.h>
25
 
#include <ddk/usbdi.h>
26
 
#include <ddk/winddk.h>
27
 
#include "usbdlib_gcc.h"
28
 
#else
29
 
#include <wdm.h>
30
 
#include "usbdi.h"
31
 
#include "usbdlib.h"
32
 
#endif
33
 
 
34
 
#include <wchar.h>
35
 
#include <initguid.h>
36
 
 
37
 
#undef interface
38
 
 
39
 
#include "driver_debug.h"
40
 
#include "driver_api.h"
41
 
 
42
 
/* some missing defines */
43
 
#ifdef __GNUC__
44
 
 
45
 
#define USBD_TRANSFER_DIRECTION_OUT       0   
46
 
#define USBD_TRANSFER_DIRECTION_BIT       0
47
 
#define USBD_TRANSFER_DIRECTION_IN        (1 << USBD_TRANSFER_DIRECTION_BIT)
48
 
#define USBD_SHORT_TRANSFER_OK_BIT        1
49
 
#define USBD_SHORT_TRANSFER_OK            (1 << USBD_SHORT_TRANSFER_OK_BIT)
50
 
#define USBD_START_ISO_TRANSFER_ASAP_BIT  2
51
 
#define USBD_START_ISO_TRANSFER_ASAP   (1 << USBD_START_ISO_TRANSFER_ASAP_BIT)
52
 
 
53
 
#endif
54
 
 
55
 
 
56
 
#define USB_RECIP_DEVICE    0x00
57
 
#define USB_RECIP_INTERFACE 0x01
58
 
#define USB_RECIP_ENDPOINT  0x02
59
 
#define USB_RECIP_OTHER     0x03
60
 
 
61
 
#define USB_TYPE_STANDARD   0x00
62
 
#define USB_TYPE_CLASS      0x01
63
 
#define USB_TYPE_VENDOR     0x02
64
 
 
65
 
 
66
 
#define LIBUSB0_NT_DEVICE_NAME L"\\Device\\libusb0"
67
 
#define LIBUSB0_SYMBOLIC_LINK_NAME L"\\DosDevices\\libusb0-"
68
 
 
69
 
#define LIBUSB0_MAX_NUMBER_OF_ENDPOINTS  32
70
 
#define LIBUSB0_MAX_NUMBER_OF_INTERFACES 32
71
 
 
72
 
 
73
 
#define LIBUSB0_DEFAULT_TIMEOUT 5000
74
 
#define LIBUSB0_MAX_CONTROL_TRANSFER_TIMEOUT 240000
75
 
 
76
 
 
77
 
#ifndef __GNUC__
78
 
#define DDKAPI
79
 
#endif
80
 
 
81
 
#ifndef FALSE
82
 
#define FALSE 0
83
 
#endif
84
 
 
85
 
#ifndef TRUE
86
 
#define TRUE (!(FALSE))
87
 
#endif
88
 
 
89
 
typedef int bool_t;
90
 
 
91
 
#include <pshpack1.h>
92
 
 
93
 
typedef struct 
94
 
95
 
  unsigned char length;
96
 
  unsigned char type;
97
 
} usb_descriptor_header_t;
98
 
 
99
 
#include <poppack.h>
100
 
 
101
 
 
102
 
typedef struct
103
 
{
104
 
  long usage_count;
105
 
  int remove_pending;
106
 
  KEVENT event;
107
 
} libusb_remove_lock_t;
108
 
 
109
 
typedef struct
110
 
{
111
 
  int address;
112
 
  USBD_PIPE_HANDLE handle;
113
 
} libusb_endpoint_t;
114
 
 
115
 
typedef struct
116
 
{
117
 
  int valid;
118
 
  int claimed;
119
 
  libusb_endpoint_t endpoints[LIBUSB0_MAX_NUMBER_OF_ENDPOINTS];
120
 
} libusb_interface_t;
121
 
 
122
 
 
123
 
typedef struct
124
 
{
125
 
  DEVICE_OBJECT *self;
126
 
  DEVICE_OBJECT *physical_device_object;
127
 
  DEVICE_OBJECT *next_stack_device;
128
 
  DEVICE_OBJECT *target_device;
129
 
  libusb_remove_lock_t remove_lock; 
130
 
  LONG ref_count;
131
 
  bool_t is_filter;
132
 
  bool_t is_started;
133
 
  bool_t surprise_removal_ok;
134
 
  int id;
135
 
  struct {
136
 
    USBD_CONFIGURATION_HANDLE handle;
137
 
    int value;
138
 
    libusb_interface_t interfaces[LIBUSB0_MAX_NUMBER_OF_INTERFACES];
139
 
  } config;
140
 
  POWER_STATE power_state;
141
 
  DEVICE_POWER_STATE device_power_states[PowerSystemMaximum];
142
 
} libusb_device_t;
143
 
 
144
 
 
145
 
 
146
 
NTSTATUS DDKAPI add_device(DRIVER_OBJECT *driver_object, 
147
 
                           DEVICE_OBJECT *physical_device_object);
148
 
 
149
 
NTSTATUS DDKAPI dispatch(DEVICE_OBJECT *device_object, IRP *irp);
150
 
NTSTATUS dispatch_pnp(libusb_device_t *dev, IRP *irp);
151
 
NTSTATUS dispatch_power(libusb_device_t *dev, IRP *irp);
152
 
NTSTATUS dispatch_ioctl(libusb_device_t *dev, IRP *irp);
153
 
 
154
 
NTSTATUS complete_irp(IRP *irp, NTSTATUS status, ULONG info);
155
 
 
156
 
NTSTATUS call_usbd(libusb_device_t *dev, void *urb,
157
 
                   ULONG control_code, int timeout);
158
 
NTSTATUS pass_irp_down(libusb_device_t *dev, IRP *irp, 
159
 
                       PIO_COMPLETION_ROUTINE completion_routine, 
160
 
                       void *context);
161
 
 
162
 
bool_t accept_irp(libusb_device_t *dev, IRP *irp);
163
 
 
164
 
bool_t get_pipe_handle(libusb_device_t *dev, int endpoint_address, 
165
 
                       USBD_PIPE_HANDLE *pipe_handle);
166
 
void clear_pipe_info(libusb_device_t *dev);
167
 
bool_t update_pipe_info(libusb_device_t *dev,
168
 
                        USBD_INTERFACE_INFORMATION *interface_info);
169
 
 
170
 
void remove_lock_initialize(libusb_device_t *dev);
171
 
NTSTATUS remove_lock_acquire(libusb_device_t *dev);
172
 
void remove_lock_release(libusb_device_t *dev);
173
 
void remove_lock_release_and_wait(libusb_device_t *dev);
174
 
 
175
 
NTSTATUS set_configuration(libusb_device_t *dev,
176
 
                           int configuration, int timeout);
177
 
NTSTATUS get_configuration(libusb_device_t *dev,
178
 
                           unsigned char *configuration, int *ret, 
179
 
                           int timeout);
180
 
NTSTATUS set_interface(libusb_device_t *dev,
181
 
                       int interface, int altsetting, int timeout);
182
 
NTSTATUS get_interface(libusb_device_t *dev,
183
 
                       int interface, unsigned char *altsetting, 
184
 
                       int *ret, int timeout);
185
 
NTSTATUS set_feature(libusb_device_t *dev,
186
 
                     int recipient, int index, int feature, int timeout);
187
 
NTSTATUS clear_feature(libusb_device_t *dev,
188
 
                       int recipient, int index, int feature, int timeout);
189
 
NTSTATUS get_status(libusb_device_t *dev, int recipient,
190
 
                    int index, char *status, int *ret, int timeout);
191
 
NTSTATUS set_descriptor(libusb_device_t *dev,
192
 
                        void *buffer, int size, 
193
 
                        int type, int recipient, int index, int language_id, 
194
 
                        int *sent, int timeout);
195
 
NTSTATUS get_descriptor(libusb_device_t *dev, void *buffer, int size, 
196
 
                        int type, int recipient, int index, int language_id,
197
 
                        int *received, int timeout);
198
 
USB_CONFIGURATION_DESCRIPTOR *
199
 
get_config_descriptor(libusb_device_t *dev, int value, int *size);
200
 
 
201
 
NTSTATUS transfer(libusb_device_t *dev, IRP *irp, 
202
 
                  int direction, int urb_function, int endpoint, 
203
 
                  int packet_size, MDL *buffer, int size);
204
 
 
205
 
NTSTATUS vendor_class_request(libusb_device_t *dev,
206
 
                              int type, int recipient,
207
 
                              int request, int value, int index,
208
 
                              void *buffer, int size, int direction,
209
 
                              int *ret, int timeout);
210
 
 
211
 
NTSTATUS abort_endpoint(libusb_device_t *dev, int endpoint, int timeout);
212
 
NTSTATUS reset_endpoint(libusb_device_t *dev, int endpoint, int timeout);
213
 
NTSTATUS reset_device(libusb_device_t *dev, int timeout);
214
 
 
215
 
NTSTATUS claim_interface(libusb_device_t *dev, int interface);
216
 
NTSTATUS release_interface(libusb_device_t *dev, int interface);
217
 
NTSTATUS release_all_interfaces(libusb_device_t *dev);
218
 
 
219
 
 
220
 
bool_t reg_get_hardware_id(DEVICE_OBJECT *physical_device_object, 
221
 
                           char *data, int size);
222
 
bool_t reg_get_properties(libusb_device_t *dev);
223
 
 
224
 
 
225
 
void power_set_device_state(libusb_device_t *dev, 
226
 
                            DEVICE_POWER_STATE device_state, bool_t block);
227
 
 
228
 
USB_INTERFACE_DESCRIPTOR *
229
 
find_interface_desc(USB_CONFIGURATION_DESCRIPTOR *config_desc, 
230
 
                    unsigned int size, int interface_number, int altsetting);
231
 
 
232
 
 
233
 
 
234
 
#endif