mingw-w64-headers/include/
Merged from trunk:
	2010-02-01  Kai Tietz  <kai.tietz@onevision.com> (rev. 1825)
	Donated by S. Koehler
	* winusbio.h: New API.
	* winusb.h: New API.

mingw-w64-crt/
Merged from trunk rev. 1752:
	2010-01-16  Kai Tietz  <kai.tietz@onevision.com>
	* lib32/winusb.def: New.
	* lib64/winusb.def: New.
	* Makefile.am: Add both.
	* Makefile.in: Regenerate.


git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/branches/releases/v1.0@4164 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-crt/ChangeLog b/mingw-w64-crt/ChangeLog
index 8e07909..04880f9 100644
--- a/mingw-w64-crt/ChangeLog
+++ b/mingw-w64-crt/ChangeLog
@@ -1,3 +1,12 @@
+2011-05-05  Ozkan Sezer  <sezeroz@gmail.com>
+
+	Merged from trunk rev. 1752:
+	2010-01-16  Kai Tietz  <kai.tietz@onevision.com>
+	* lib32/winusb.def: New.
+	* lib64/winusb.def: New.
+	* Makefile.am: Add both.
+	* Makefile.in: Regenerate.
+
 2011-04-28  Ozkan Sezer  <sezeroz@gmail.com>
 
 	Merged from trunk rev. 4045:
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 8ff4ba1..ffdbfc5 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -374,7 +374,7 @@
 #These defs have no accompanying sources.  Look into using the rule below to run the dlltool command
 #for all libraries, including those with sources.
 lib32_DATA = \
-  lib32/libauthz.a     \
+  lib32/libwinusb.a    \
   lib32/libaclui.a     lib32/libadvapi32.a  lib32/libapcups.a    lib32/libavicap32.a  lib32/libavifil32.a \
   lib32/libcap.a       lib32/libcfgmgr32.a  lib32/libcomctl32.a  lib32/libcomdlg32.a  lib32/libcrypt32.a  \
   lib32/libctl3d32.a   \
@@ -407,6 +407,7 @@
   \
   lib32/libpdh.a       lib32/libpdhui.a     \
   lib32/libks.a        \
+  lib32/libauthz.a     \
   \
   lib32/libd3dcompiler_33.a lib32/libd3dcompiler_34.a lib32/libd3dcompiler_35.a \
   lib32/libd3dcompiler_36.a lib32/libd3dcompiler_37.a lib32/libd3dcompiler_38.a \
@@ -603,6 +604,7 @@
 
 
 lib64_DATA = \
+  lib64/libwinusb.a \
   lib64/lib6to4svc.a    lib64/libaaaamon.a    lib64/libacledit.a      lib64/libaclui.a      \
   lib64/libactiveds.a   lib64/libactxprxy.a   lib64/libadmparse.a     lib64/libadmwprox.a   lib64/libadptif.a        \
   lib64/libadrot.a      lib64/libadsiis.a     lib64/libadsiisex.a     lib64/libadsldpc.a    lib64/libadsldp.a        \
diff --git a/mingw-w64-crt/Makefile.in b/mingw-w64-crt/Makefile.in
index 5f46d4b..b5bb6d8 100644
--- a/mingw-w64-crt/Makefile.in
+++ b/mingw-w64-crt/Makefile.in
@@ -2549,7 +2549,7 @@
 #These defs have no accompanying sources.  Look into using the rule below to run the dlltool command
 #for all libraries, including those with sources.
 @LIB32_TRUE@lib32_DATA = \
-@LIB32_TRUE@  lib32/libauthz.a     \
+@LIB32_TRUE@  lib32/libwinusb.a    \
 @LIB32_TRUE@  lib32/libaclui.a     lib32/libadvapi32.a  lib32/libapcups.a    lib32/libavicap32.a  lib32/libavifil32.a \
 @LIB32_TRUE@  lib32/libcap.a       lib32/libcfgmgr32.a  lib32/libcomctl32.a  lib32/libcomdlg32.a  lib32/libcrypt32.a  \
 @LIB32_TRUE@  lib32/libctl3d32.a   \
@@ -2582,6 +2582,7 @@
 @LIB32_TRUE@  \
 @LIB32_TRUE@  lib32/libpdh.a       lib32/libpdhui.a     \
 @LIB32_TRUE@  lib32/libks.a        \
+@LIB32_TRUE@  lib32/libauthz.a     \
 @LIB32_TRUE@  \
 @LIB32_TRUE@  lib32/libd3dcompiler_33.a lib32/libd3dcompiler_34.a lib32/libd3dcompiler_35.a \
 @LIB32_TRUE@  lib32/libd3dcompiler_36.a lib32/libd3dcompiler_37.a lib32/libd3dcompiler_38.a \
@@ -2691,6 +2692,7 @@
 @LIB64_TRUE@lib64_libws2_32_a_CPPFLAGS = $(CPPFLAGS64)
 @LIB64_TRUE@lib64_libws2_32_a_AR = $(DTLIB64) && $(AR) $(ARFLAGS)
 @LIB64_TRUE@lib64_DATA = \
+@LIB64_TRUE@  lib64/libwinusb.a \
 @LIB64_TRUE@  lib64/lib6to4svc.a    lib64/libaaaamon.a    lib64/libacledit.a      lib64/libaclui.a      \
 @LIB64_TRUE@  lib64/libactiveds.a   lib64/libactxprxy.a   lib64/libadmparse.a     lib64/libadmwprox.a   lib64/libadptif.a        \
 @LIB64_TRUE@  lib64/libadrot.a      lib64/libadsiis.a     lib64/libadsiisex.a     lib64/libadsldpc.a    lib64/libadsldp.a        \
diff --git a/mingw-w64-crt/lib32/winusb.def b/mingw-w64-crt/lib32/winusb.def
new file mode 100644
index 0000000..0033d4c
--- /dev/null
+++ b/mingw-w64-crt/lib32/winusb.def
@@ -0,0 +1,29 @@
+;
+; Definition file of WINUSB.DLL
+; Automatic generated by gendef
+; written by Kai Tietz 2008
+;
+LIBRARY "WINUSB.DLL"
+EXPORTS
+WinUsb_AbortPipe@8
+WinUsb_ControlTransfer@28
+WinUsb_FlushPipe@8
+WinUsb_Free@4
+WinUsb_GetAssociatedInterface@12
+WinUsb_GetCurrentAlternateSetting@8
+WinUsb_GetDescriptor@28
+WinUsb_GetOverlappedResult@16
+WinUsb_GetPipePolicy@20
+WinUsb_GetPowerPolicy@16
+WinUsb_Initialize@8
+WinUsb_ParseConfigurationDescriptor@28
+WinUsb_ParseDescriptors@16
+WinUsb_QueryDeviceInformation@16
+WinUsb_QueryInterfaceSettings@12
+WinUsb_QueryPipe@16
+WinUsb_ReadPipe@24
+WinUsb_ResetPipe@8
+WinUsb_SetCurrentAlternateSetting@8
+WinUsb_SetPipePolicy@20
+WinUsb_SetPowerPolicy@16
+WinUsb_WritePipe@24
diff --git a/mingw-w64-crt/lib64/winusb.def b/mingw-w64-crt/lib64/winusb.def
new file mode 100644
index 0000000..ddfe87f
--- /dev/null
+++ b/mingw-w64-crt/lib64/winusb.def
@@ -0,0 +1,29 @@
+;
+; Definition file of WINUSB.DLL
+; Automatic generated by gendef
+; written by Kai Tietz 2008
+;
+LIBRARY "WINUSB.DLL"
+EXPORTS
+WinUsb_AbortPipe
+WinUsb_ControlTransfer
+WinUsb_FlushPipe
+WinUsb_Free
+WinUsb_GetAssociatedInterface
+WinUsb_GetCurrentAlternateSetting
+WinUsb_GetDescriptor
+WinUsb_GetOverlappedResult
+WinUsb_GetPipePolicy
+WinUsb_GetPowerPolicy
+WinUsb_Initialize
+WinUsb_ParseConfigurationDescriptor
+WinUsb_ParseDescriptors
+WinUsb_QueryDeviceInformation
+WinUsb_QueryInterfaceSettings
+WinUsb_QueryPipe
+WinUsb_ReadPipe
+WinUsb_ResetPipe
+WinUsb_SetCurrentAlternateSetting
+WinUsb_SetPipePolicy
+WinUsb_SetPowerPolicy
+WinUsb_WritePipe
diff --git a/mingw-w64-headers/include/ChangeLog b/mingw-w64-headers/include/ChangeLog
index b933702..8a4810a 100644
--- a/mingw-w64-headers/include/ChangeLog
+++ b/mingw-w64-headers/include/ChangeLog
@@ -1,6 +1,14 @@
 2011-05-05  Ozkan Sezer  <sezeroz@gmail.com>
 
 	Merged from trunk:
+	2010-02-01  Kai Tietz  <kai.tietz@onevision.com> (rev. 1825)
+	Donated by S. Koehler
+	* winusbio.h: New API.
+	* winusb.h: New API.
+
+2011-05-05  Ozkan Sezer  <sezeroz@gmail.com>
+
+	Merged from trunk:
 	2011-05-05  Jonathan Yong  <jon_y@users.sourceforge.net> (rev. 4162)
 	* stdlib.h (swab): Use define guards.
 	* unistd.h (swab): Copy from stdlib.h as per POSIX spec.
diff --git a/mingw-w64-headers/include/winusb.h b/mingw-w64-headers/include/winusb.h
new file mode 100644
index 0000000..6ec9fd4
--- /dev/null
+++ b/mingw-w64-headers/include/winusb.h
@@ -0,0 +1,93 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions in source code must retain the accompanying copyright
+      notice, this list of conditions, and the following disclaimer.
+   2. Redistributions in binary form must reproduce the accompanying
+      copyright notice, this list of conditions, and the following disclaimer
+      in the documentation and/or other materials provided with the
+      distribution.
+   3. Names of the copyright holders must not be used to endorse or promote
+      products derived from this software without prior written permission
+      from the copyright holders.
+   4. The right to distribute this software or to use it for any purpose does
+      not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+      the copyright holders.  Use of them is covered by separate agreement
+      with the copyright holders.
+   5. If any files are modified, you must cause the modified files to carry
+      prominent notices stating that you changed the files and the date of
+      any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef __WINUSB_H
+#define __WINUSB_H
+
+
+#include <windows.h>
+#include <winusbio.h>	/* for PWINUSB_PIPE_INFORMATION  */
+#include <usb100.h>	/* for PUSB_INTERFACE_DESCRIPTOR */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef HANDLE WINUSB_INTERFACE_HANDLE, *PWINUSB_INTERFACE_HANDLE;
+
+typedef struct _WINUSB_SETUP_PACKET {
+  UCHAR RequestType;
+  UCHAR Request;
+  USHORT Value;
+  USHORT Index;
+  USHORT Length;
+} WINUSB_SETUP_PACKET, *PWINUSB_SETUP_PACKET;
+
+WINBOOL WINAPI WinUsb_AbortPipe (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID);
+WINBOOL WINAPI WinUsb_ControlTransfer (WINUSB_INTERFACE_HANDLE InterfaceHandle, WINUSB_SETUP_PACKET SetupPacket, PUCHAR Buffer, ULONG BufferLength, PULONG LengthTransferred, LPOVERLAPPED Overlapped);
+WINBOOL WINAPI WinUsb_FlushPipe (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID);
+WINBOOL WINAPI WinUsb_Free (WINUSB_INTERFACE_HANDLE InterfaceHandle);
+WINBOOL WINAPI WinUsb_GetAssociatedInterface (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR AssociatedInterfaceIndex, PWINUSB_INTERFACE_HANDLE AssociatedInterfaceHandle);
+WINBOOL WINAPI WinUsb_GetCurrentAlternateSetting (WINUSB_INTERFACE_HANDLE InterfaceHandle, PUCHAR AlternateSetting);
+WINBOOL WINAPI WinUsb_GetDescriptor (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR DescriptorType, UCHAR Index, USHORT LanguageID, PUCHAR Buffer, ULONG BufferLength, PULONG LengthTransferred);
+WINBOOL WINAPI WinUsb_GetPowerPolicy (WINUSB_INTERFACE_HANDLE InterfaceHandle, ULONG PolicyType, PULONG ValueLength, PVOID Value);
+WINBOOL WINAPI WinUsb_GetOverlappedResult(WINUSB_INTERFACE_HANDLE InterfaceHandle, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, WINBOOL  bWait);
+WINBOOL WINAPI WinUsb_GetPipePolicy (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID, ULONG PolicyType, PULONG ValueLength, PVOID Value);
+WINBOOL WINAPI WinUsb_Initialize (HANDLE DeviceHandle, PWINUSB_INTERFACE_HANDLE InterfaceHandle);
+WINBOOL WINAPI WinUsb_QueryDeviceInformation (WINUSB_INTERFACE_HANDLE InterfaceHandle, ULONG InformationType, PULONG BufferLength, PVOID Buffer);
+WINBOOL WINAPI WinUsb_QueryInterfaceSettings (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR AlternateSettingNumber, PUSB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor);
+WINBOOL WINAPI WinUsb_QueryPipe (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR AlternateInterfaceNumber, UCHAR PipeIndex, PWINUSB_PIPE_INFORMATION PipeInformation);
+WINBOOL WINAPI WinUsb_ReadPipe (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID, PUCHAR Buffer, ULONG BufferLength, PULONG LengthTransferred, LPOVERLAPPED Overlapped);
+WINBOOL WINAPI WinUsb_ResetPipe (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID);
+WINBOOL WINAPI WinUsb_SetCurrentAlternateInterface (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR AlternateSetting);
+WINBOOL WINAPI WinUsb_SetPowerPolicy (WINUSB_INTERFACE_HANDLE InterfaceHandle, ULONG PolicyType, ULONG ValueLength, PVOID Value);
+WINBOOL WINAPI WinUsb_SetPipePolicy (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID, ULONG PolicyType, ULONG ValueLength, PVOID Value);
+WINBOOL WINAPI WinUsb_WritePipe (WINUSB_INTERFACE_HANDLE InterfaceHandle, UCHAR PipeID, PUCHAR Buffer, ULONG BufferLength, PULONG LengthTransferred, LPOVERLAPPED Overlapped);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINUSB_H */
diff --git a/mingw-w64-headers/include/winusbio.h b/mingw-w64-headers/include/winusbio.h
new file mode 100644
index 0000000..f91d24f
--- /dev/null
+++ b/mingw-w64-headers/include/winusbio.h
@@ -0,0 +1,90 @@
+/*
+ This Software is provided under the Zope Public License (ZPL) Version 2.1.
+
+ Copyright (c) 2009, 2010 by the mingw-w64 project
+
+ See the AUTHORS file for the list of contributors to the mingw-w64 project.
+
+ This license has been certified as open source. It has also been designated
+ as GPL compatible by the Free Software Foundation (FSF).
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions in source code must retain the accompanying copyright
+      notice, this list of conditions, and the following disclaimer.
+   2. Redistributions in binary form must reproduce the accompanying
+      copyright notice, this list of conditions, and the following disclaimer
+      in the documentation and/or other materials provided with the
+      distribution.
+   3. Names of the copyright holders must not be used to endorse or promote
+      products derived from this software without prior written permission
+      from the copyright holders.
+   4. The right to distribute this software or to use it for any purpose does
+      not give you the right to use Servicemarks (sm) or Trademarks (tm) of
+      the copyright holders.  Use of them is covered by separate agreement
+      with the copyright holders.
+   5. If any files are modified, you must cause the modified files to carry
+      prominent notices stating that you changed the files and the date of
+      any change.
+
+ Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+ OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef __WINUSBIO_H
+#define __WINUSBIO_H
+
+
+#include <windows.h>
+#include <usb.h>	/* for USBD_PIPE_TYPE */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _WINUSB_PIPE_INFORMATION {
+  USBD_PIPE_TYPE PipeType;
+  UCHAR PipeId;
+  USHORT MaximumPacketSize;
+  UCHAR Interval;
+} WINUSB_PIPE_INFORMATION, *PWINUSB_PIPE_INFORMATION;
+
+/* constants for WinUsb_Get/SetPipePolicy.  */
+#define SHORT_PACKET_TERMINATE 0x01
+#define AUTO_CLEAR_STALL       0x02
+#define PIPE_TRANSFER_TIMEOUT  0x03
+#define IGNORE_SHORT_PACKETS   0x04
+#define ALLOW_PARTIAL_READS    0x05
+#define AUTO_FLUSH             0x06
+#define RAW_IO                 0x07
+
+/* constants for WinUsb_Get/SetPowerPolicy.  */
+#define AUTO_SUSPEND  0x01
+#define ENABLE_WAKE   0x02
+#define SUSPEND_DELAY 0x03
+
+/* constants for WinUsb_QueryDeviceInformation.  */
+#define DEVICE_SPEED 0x01
+#define LowSpeed     0x01
+#define FullSpeed    0x02
+#define HighSpeed    0x03
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINUSBIO_H */
+