[1046] | 1 | /*
|
---|
| 2 | * usbscan.h
|
---|
| 3 | *
|
---|
| 4 | * USB scanner definitions
|
---|
| 5 | *
|
---|
| 6 | * This file is part of the w32api package.
|
---|
| 7 | *
|
---|
| 8 | * Contributors:
|
---|
| 9 | * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
---|
| 10 | *
|
---|
| 11 | * THIS SOFTWARE IS NOT COPYRIGHTED
|
---|
| 12 | *
|
---|
| 13 | * This source code is offered for use in the public domain. You may
|
---|
| 14 | * use, modify or distribute it freely.
|
---|
| 15 | *
|
---|
| 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.
|
---|
| 20 | *
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | #ifndef __USBSCAN_H
|
---|
| 24 | #define __USBSCAN_H
|
---|
| 25 |
|
---|
| 26 | #if __GNUC__ >=3
|
---|
| 27 | #pragma GCC system_header
|
---|
| 28 | #endif
|
---|
| 29 |
|
---|
| 30 | #ifdef __cplusplus
|
---|
| 31 | extern "C" {
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | #include "ntddk.h"
|
---|
| 35 |
|
---|
| 36 | #define FILE_DEVICE_USB_SCAN 0x8000
|
---|
| 37 | #define IOCTL_INDEX 0x0800
|
---|
| 38 |
|
---|
| 39 | #define IOCTL_CANCEL_IO \
|
---|
| 40 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 1, METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 41 |
|
---|
| 42 | #define IOCTL_GET_VERSION \
|
---|
| 43 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 0, METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 44 |
|
---|
| 45 | #define IOCTL_GET_CHANNEL_ALIGN_RQST \
|
---|
| 46 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 5, METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 47 |
|
---|
| 48 | #define IOCTL_GET_DEVICE_DESCRIPTOR \
|
---|
| 49 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 6, METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 50 |
|
---|
| 51 | #define IOCTL_GET_PIPE_CONFIGURATION \
|
---|
| 52 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 10,METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 53 |
|
---|
| 54 | #define IOCTL_GET_USB_DESCRIPTOR \
|
---|
| 55 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 8, METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 56 |
|
---|
| 57 | #define IOCTL_READ_REGISTERS \
|
---|
| 58 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 3, METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 59 |
|
---|
| 60 | #define IOCTL_RESET_PIPE \
|
---|
| 61 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 7, METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 62 |
|
---|
| 63 | #define IOCTL_SEND_USB_REQUEST \
|
---|
| 64 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 9, METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 65 |
|
---|
| 66 | #define IOCTL_SET_TIMEOUT \
|
---|
| 67 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 11,METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 68 |
|
---|
| 69 | #define IOCTL_WAIT_ON_DEVICE_EVENT \
|
---|
| 70 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 2, METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 71 |
|
---|
| 72 | #define IOCTL_WRITE_REGISTERS \
|
---|
| 73 | CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 | #define MAX_NUM_PIPES 8
|
---|
| 77 |
|
---|
| 78 | #define BULKIN_FLAG 0x80
|
---|
| 79 |
|
---|
| 80 | typedef struct _CHANNEL_INFO {
|
---|
| 81 | /*OUT*/ ULONG EventChannelSize;
|
---|
| 82 | /*OUT*/ ULONG uReadDataAlignment;
|
---|
| 83 | /*OUT*/ ULONG uWriteDataAlignment;
|
---|
| 84 | }CHANNEL_INFO, *PCHANNEL_INFO;
|
---|
| 85 |
|
---|
| 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;
|
---|
| 92 |
|
---|
| 93 | typedef struct _DRV_VERSION {
|
---|
| 94 | /*OUT*/ ULONG major;
|
---|
| 95 | /*OUT*/ ULONG minor;
|
---|
| 96 | /*OUT*/ ULONG internal;
|
---|
| 97 | } DRV_VERSION, *PDRV_VERSION;
|
---|
| 98 |
|
---|
| 99 | typedef struct _IO_BLOCK {
|
---|
| 100 | /*IN*/ ULONG uOffset;
|
---|
| 101 | /*IN*/ ULONG uLength;
|
---|
| 102 | /*IN OUT*/ PUCHAR pbyData;
|
---|
| 103 | /*IN*/ ULONG uIndex;
|
---|
| 104 | } IO_BLOCK, *PIO_BLOCK;
|
---|
| 105 |
|
---|
| 106 | typedef struct _IO_BLOCK_EX {
|
---|
| 107 | /*IN*/ ULONG uOffset;
|
---|
| 108 | /*IN*/ ULONG uLength;
|
---|
| 109 | /*IN OUT*/ PUCHAR pbyData;
|
---|
| 110 | /*IN*/ ULONG uIndex;
|
---|
| 111 | /*IN*/ UCHAR bRequest;
|
---|
| 112 | /*IN*/ UCHAR bmRequestType;
|
---|
| 113 | /*IN*/ UCHAR fTransferDirectionIn;
|
---|
| 114 | } IO_BLOCK_EX, *PIO_BLOCK_EX;
|
---|
| 115 |
|
---|
| 116 | typedef struct _USBSCAN_GET_DESCRIPTOR {
|
---|
| 117 | /*IN*/ UCHAR DescriptorType;
|
---|
| 118 | /*IN*/ UCHAR Index;
|
---|
| 119 | /*IN*/ USHORT LanguageId;
|
---|
| 120 | } USBSCAN_GET_DESCRIPTOR, *PUSBSCAN_GET_DESCRIPTOR;
|
---|
| 121 |
|
---|
| 122 | typedef enum _RAW_PIPE_TYPE {
|
---|
| 123 | USBSCAN_PIPE_CONTROL,
|
---|
| 124 | USBSCAN_PIPE_ISOCHRONOUS,
|
---|
| 125 | USBSCAN_PIPE_BULK,
|
---|
| 126 | USBSCAN_PIPE_INTERRUPT
|
---|
| 127 | } RAW_PIPE_TYPE;
|
---|
| 128 |
|
---|
| 129 | typedef struct _USBSCAN_PIPE_INFORMATION {
|
---|
| 130 | USHORT MaximumPacketSize;
|
---|
| 131 | UCHAR EndpointAddress;
|
---|
| 132 | UCHAR Interval;
|
---|
| 133 | RAW_PIPE_TYPE PipeType;
|
---|
| 134 | } USBSCAN_PIPE_INFORMATION, *PUSBSCAN_PIPE_INFORMATION;
|
---|
| 135 |
|
---|
| 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;
|
---|
| 140 |
|
---|
| 141 | typedef struct _USBSCAN_TIMEOUT {
|
---|
| 142 | /*IN*/ ULONG TimeoutRead;
|
---|
| 143 | /*IN*/ ULONG TimeoutWrite;
|
---|
| 144 | /*IN*/ ULONG TimeoutEvent;
|
---|
| 145 | } USBSCAN_TIMEOUT, *PUSBSCAN_TIMEOUT;
|
---|
| 146 |
|
---|
| 147 | typedef enum _PIPE_TYPE {
|
---|
| 148 | EVENT_PIPE,
|
---|
| 149 | READ_DATA_PIPE,
|
---|
| 150 | WRITE_DATA_PIPE,
|
---|
| 151 | ALL_PIPE
|
---|
| 152 | } PIPE_TYPE;
|
---|
| 153 |
|
---|
| 154 | #ifdef __cplusplus
|
---|
| 155 | }
|
---|
| 156 | #endif
|
---|
| 157 |
|
---|
| 158 | #endif /* __USBSCAN_H */
|
---|