summaryrefslogtreecommitdiff
path: root/libusb
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-01-25 21:55:46 +0000
committerPete Batard <pbatard@gmail.com>2010-01-25 21:55:46 +0000
commitf581c91677797e22876684d639f3cf5190a5ab51 (patch)
tree96de4050b7befffb3df352ad1de6a1f0e0bd5763 /libusb
parent95eccbda1fe6e9b95af3a1b998d52f44721aaf19 (diff)
downloadlibusb-f581c91677797e22876684d639f3cf5190a5ab51.tar.gz
r114: sources update and build script (Orin Eman)
OACR 28719 warning removal (Orin Eman) minor code cleanup
Diffstat (limited to 'libusb')
-rw-r--r--libusb/os/sources5
-rw-r--r--libusb/os/windows_compat.c4
-rw-r--r--libusb/os/windows_usb.c28
3 files changed, 19 insertions, 18 deletions
diff --git a/libusb/os/sources b/libusb/os/sources
index 86e0abe..c4d0163 100644
--- a/libusb/os/sources
+++ b/libusb/os/sources
@@ -1,4 +1,4 @@
-TARGETNAME=libusb
+TARGETNAME=libusb-1.0
TARGETTYPE=DYNLINK
DLLDEF=..\libusb-1.0.def
@@ -30,5 +30,6 @@ SOURCES=..\core.c \
..\io.c \
..\sync.c \
windows_compat.c \
- windows_usb.c
+ windows_usb.c \
+ libusb-1.0.rc
diff --git a/libusb/os/windows_compat.c b/libusb/os/windows_compat.c
index 677d2ba..180ff0c 100644
--- a/libusb/os/windows_compat.c
+++ b/libusb/os/windows_compat.c
@@ -90,6 +90,10 @@
#endif
#endif
+#if defined(_PREFAST_)
+#pragma warning(disable:28719)
+#endif
+
#if defined(__CYGWIN__ )
// cygwin produces a warning unless these prototypes are defined
extern int _close(int fd);
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c
index b9bf9f2..42d88da 100644
--- a/libusb/os/windows_usb.c
+++ b/libusb/os/windows_usb.c
@@ -43,6 +43,10 @@
#include "windows_compat.h"
#include "windows_usb.h"
+#if defined(_PREFAST_)
+#pragma warning(disable:28719)
+#endif
+
// These GUIDs appear undefined on MinGW32
#if !defined(GUID_DEVINTERFACE_USB_HOST_CONTROLLER)
// http://msdn.microsoft.com/en-us/library/bb663109.aspx
@@ -59,7 +63,6 @@ const GUID GUID_NULL = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00,
const GUID GUID_HID = { 0x745A17A0, 0x74D3, 0x11D0, {0xB6, 0xFE, 0x00, 0xA0, 0xC9, 0x0F, 0x57, 0xDA} };
const GUID GUID_LIBUSB_WINUSB = { 0x78a1c341, 0x4539, 0x11d3, {0xb8, 0x8d, 0x00, 0xc0, 0x4f, 0xad, 0x51, 0x71} };
const GUID GUID_COMPOSITE = { 0x36fc9e60, 0xc465, 0x11cf, {0x80, 0x56, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} };
-const GUID GUID_MEDIA_IF = { 0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96} };
// The 2 macros below are used in conjunction with safe loops.
#define LOOP_CHECK(fcall) { r=fcall; if (r != LIBUSB_SUCCESS) continue; }
@@ -861,10 +864,12 @@ static int usb_enumerate_hub(struct libusb_context *ctx, struct discovered_devs
*/
static int set_composite_device(struct libusb_context *ctx, DEVINST devinst, struct windows_device_priv *priv)
{
+// indexes for additional interface GUIDs, not available from "USB"
+// SetupDiGetClassDevs enumeration should go here. Typically, these are
+// device interfaces that begin with something else than "\\?\usb\"
enum libusb_hid_report_type {
HID_DEVICE_INTERFACE_GUID_INDEX = 0,
- MEDIA_DEVICE_INTERFACE_GUID_INDEX = 1,
- MAX_DEVICE_INTERFACE_GUID_INDEX = 2
+ MAX_DEVICE_INTERFACE_GUID_INDEX = 1
};
DEVINST child_devinst, parent_devinst;
@@ -893,10 +898,10 @@ enum libusb_hid_report_type {
}
// Manually add the HID GUID as it cannot be read with DeviceInterfaceGUIDs reg key)
- // NB the value returned by HidD_GetHidGuid, which is for interface class is different from GUID_HID
+ // NB the value returned by HidD_GetHidGuid, which is for interface class is different
+ // from GUID_HID, which is the device class GUID
HidD_GetHidGuid(&guid_table[HID_DEVICE_INTERFACE_GUID_INDEX]);
- guid_table[MEDIA_DEVICE_INTERFACE_GUID_INDEX] = GUID_MEDIA_IF;
- // TODO: use SetupDiClassGuidsFromName?
+ // NB: for other interface guids, SetupDiClassGuidsFromName can be used
max_guids = MAX_DEVICE_INTERFACE_GUID_INDEX;
// First, retrieve all the device interface GUIDs
@@ -906,18 +911,10 @@ enum libusb_hid_report_type {
if (!SetupDiEnumDeviceInfo(dev_info, i, &dev_info_data)) {
break;
}
-/*
- if(!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_CLASSGUID,
- NULL, (BYTE*)driver, MAX_KEY_LENGTH, &size)) {
- usbi_warn(ctx, "could not read class GUID: %s", windows_error_str(0));
- continue;
- }
- usbi_dbg("class GUID: %s", driver);
-*/
key = SetupDiOpenDevRegKey(dev_info, &dev_info_data, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ);
if (key == INVALID_HANDLE_VALUE) {
- usbi_dbg("invalid handle");
+ usbi_dbg("could not open registry key");
continue;
}
@@ -954,7 +951,6 @@ enum libusb_hid_report_type {
for (j=0; j<max_guids; j++)
{
guid = guid_table[j];
-// usbi_dbg("GUID %d: %s", j, guid_to_string(guid_table[j]));
for (i = 0; ; i++)
{