4 * USB scanner definitions
6 * This file is part of the w32api package.
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 #pragma GCC system_header
36 #define FILE_DEVICE_USB_SCAN 0x8000
37 #define IOCTL_INDEX 0x0800
39 #define IOCTL_CANCEL_IO \
40 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 1, METHOD_BUFFERED,FILE_ANY_ACCESS)
42 #define IOCTL_GET_VERSION \
43 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 0, METHOD_BUFFERED,FILE_ANY_ACCESS)
45 #define IOCTL_GET_CHANNEL_ALIGN_RQST \
46 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 5, METHOD_BUFFERED,FILE_ANY_ACCESS)
48 #define IOCTL_GET_DEVICE_DESCRIPTOR \
49 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 6, METHOD_BUFFERED,FILE_ANY_ACCESS)
51 #define IOCTL_GET_PIPE_CONFIGURATION \
52 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 10,METHOD_BUFFERED,FILE_ANY_ACCESS)
54 #define IOCTL_GET_USB_DESCRIPTOR \
55 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 8, METHOD_BUFFERED,FILE_ANY_ACCESS)
57 #define IOCTL_READ_REGISTERS \
58 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 3, METHOD_BUFFERED,FILE_ANY_ACCESS)
60 #define IOCTL_RESET_PIPE \
61 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 7, METHOD_BUFFERED,FILE_ANY_ACCESS)
63 #define IOCTL_SEND_USB_REQUEST \
64 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 9, METHOD_BUFFERED,FILE_ANY_ACCESS)
66 #define IOCTL_SET_TIMEOUT \
67 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 11,METHOD_BUFFERED,FILE_ANY_ACCESS)
69 #define IOCTL_WAIT_ON_DEVICE_EVENT \
70 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 2, METHOD_BUFFERED,FILE_ANY_ACCESS)
72 #define IOCTL_WRITE_REGISTERS \
73 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
76 #define MAX_NUM_PIPES 8
78 #define BULKIN_FLAG 0x80
80 typedef struct _CHANNEL_INFO
{
81 /*OUT*/ ULONG EventChannelSize
;
82 /*OUT*/ ULONG uReadDataAlignment
;
83 /*OUT*/ ULONG uWriteDataAlignment
;
84 }CHANNEL_INFO
, *PCHANNEL_INFO
;
86 typedef struct _DEVICE_DESCRIPTOR
{
87 /*OUT*/ USHORT usVendorId
;
88 /*OUT*/ USHORT usProductId
;
89 /*OUT*/ USHORT usBcdDevice
;
90 /*OUT*/ USHORT usLanguageId
;
91 } DEVICE_DESCRIPTOR
, *PDEVICE_DESCRIPTOR
;
93 typedef struct _DRV_VERSION
{
96 /*OUT*/ ULONG internal
;
97 } DRV_VERSION
, *PDRV_VERSION
;
99 typedef struct _IO_BLOCK
{
100 /*IN*/ ULONG uOffset
;
101 /*IN*/ ULONG uLength
;
102 /*IN OUT*/ PUCHAR pbyData
;
104 } IO_BLOCK
, *PIO_BLOCK
;
106 typedef struct _IO_BLOCK_EX
{
107 /*IN*/ ULONG uOffset
;
108 /*IN*/ ULONG uLength
;
109 /*IN OUT*/ PUCHAR pbyData
;
111 /*IN*/ UCHAR bRequest
;
112 /*IN*/ UCHAR bmRequestType
;
113 /*IN*/ UCHAR fTransferDirectionIn
;
114 } IO_BLOCK_EX
, *PIO_BLOCK_EX
;
116 typedef struct _USBSCAN_GET_DESCRIPTOR
{
117 /*IN*/ UCHAR DescriptorType
;
119 /*IN*/ USHORT LanguageId
;
120 } USBSCAN_GET_DESCRIPTOR
, *PUSBSCAN_GET_DESCRIPTOR
;
122 typedef enum _RAW_PIPE_TYPE
{
123 USBSCAN_PIPE_CONTROL
,
124 USBSCAN_PIPE_ISOCHRONOUS
,
126 USBSCAN_PIPE_INTERRUPT
129 typedef struct _USBSCAN_PIPE_INFORMATION
{
130 USHORT MaximumPacketSize
;
131 UCHAR EndpointAddress
;
133 RAW_PIPE_TYPE PipeType
;
134 } USBSCAN_PIPE_INFORMATION
, *PUSBSCAN_PIPE_INFORMATION
;
136 typedef struct _USBSCAN_PIPE_CONFIGURATION
{
137 /*OUT*/ ULONG NumberOfPipes
;
138 /*OUT*/ USBSCAN_PIPE_INFORMATION PipeInfo
[MAX_NUM_PIPES
];
139 } USBSCAN_PIPE_CONFIGURATION
, *PUSBSCAN_PIPE_CONFIGURATION
;
141 typedef struct _USBSCAN_TIMEOUT
{
142 /*IN*/ ULONG TimeoutRead
;
143 /*IN*/ ULONG TimeoutWrite
;
144 /*IN*/ ULONG TimeoutEvent
;
145 } USBSCAN_TIMEOUT
, *PUSBSCAN_TIMEOUT
;
147 typedef enum _PIPE_TYPE
{
158 #endif /* __USBSCAN_H */