From 96c4dd4e7fda606ad9f5473db8ff3f91a5392b63 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Mon, 4 Oct 2010 20:14:19 +0100 Subject: switched to using CM_Get_Device_IDA always * also removed unused HCD specific entries --- libusb/os/windows_usb.c | 7 +++---- libusb/os/windows_usb.h | 23 ----------------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index 910edec..c44fa0a 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -264,7 +264,6 @@ static int Cfgmgr32_init(void) DLL_LOAD(Cfgmgr32.dll, CM_Get_Child, TRUE); DLL_LOAD(Cfgmgr32.dll, CM_Get_Sibling, TRUE); DLL_LOAD(Cfgmgr32.dll, CM_Get_Device_IDA, TRUE); - DLL_LOAD(Cfgmgr32.dll, CM_Get_Device_IDW, TRUE); return LIBUSB_SUCCESS; } @@ -413,7 +412,7 @@ static unsigned long get_parent_session_id(DWORD devinst) if (CM_Get_Parent(&parent_devinst, devinst, 0) != CR_SUCCESS) { return 0; } - if (CM_Get_Device_ID(parent_devinst, path, MAX_PATH_LENGTH, 0) != CR_SUCCESS) { + if (CM_Get_Device_IDA(parent_devinst, path, MAX_PATH_LENGTH, 0) != CR_SUCCESS) { return 0; } sanitized_path = sanitize_path(path); @@ -442,7 +441,7 @@ static unsigned long get_grandparent_session_id(DWORD devinst) if (CM_Get_Parent(&grandparent_devinst, parent_devinst, 0) != CR_SUCCESS) { return 0; } - if (CM_Get_Device_ID(grandparent_devinst, path, MAX_PATH_LENGTH, 0) != CR_SUCCESS) { + if (CM_Get_Device_IDA(grandparent_devinst, path, MAX_PATH_LENGTH, 0) != CR_SUCCESS) { return 0; } // TODO: try without sanitizing @@ -1213,7 +1212,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered // Read the Device ID path. This is what we'll use as UID // Note that if the device is plugged in a different port or hub, the Device ID changes - if (CM_Get_Device_ID(dev_info_data.DevInst, path, sizeof(path), 0) != CR_SUCCESS) { + if (CM_Get_Device_IDA(dev_info_data.DevInst, path, sizeof(path), 0) != CR_SUCCESS) { usbi_warn(ctx, "could not read the device id path for device '%s', skipping", dev_interface_details->DevicePath); continue; diff --git a/libusb/os/windows_usb.h b/libusb/os/windows_usb.h index 05ebe79..b2cb160 100644 --- a/libusb/os/windows_usb.h +++ b/libusb/os/windows_usb.h @@ -159,21 +159,6 @@ extern const struct windows_usb_api_backend usb_api_backend[USB_API_MAX]; * with inline pseudo constructors/destructors */ -// HCDs -struct windows_hcd_priv { - char *path; - struct windows_hcd_priv *next; -}; - -static inline void windows_hcd_priv_init(struct windows_hcd_priv* p) { - p->path = NULL; - p->next = NULL; -} - -static inline void windows_hcd_priv_release(struct windows_hcd_priv* p) { - safe_free(p->path); -} - // TODO (v2+): move hid desc to libusb.h? struct libusb_hid_descriptor { uint8_t bLength; @@ -394,7 +379,6 @@ typedef RETURN_TYPE CONFIGRET; #define USB_REQUEST_SET_INTERFACE LIBUSB_REQUEST_SET_INTERFACE #define USB_REQUEST_SYNC_FRAME LIBUSB_REQUEST_SYNCH_FRAME -#define HCD_GET_ROOT_HUB_NAME 258 #define USB_GET_NODE_INFORMATION 258 #define USB_GET_NODE_CONNECTION_INFORMATION 259 #define USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION 260 @@ -444,13 +428,6 @@ DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Parent, (PDEVINST, DEVINST, ULONG)); DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Child, (PDEVINST, DEVINST, ULONG)); DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Sibling, (PDEVINST, DEVINST, ULONG)); DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Device_IDA, (DEVINST, PCHAR, ULONG, ULONG)); -DLL_DECLARE(WINAPI, CONFIGRET, CM_Get_Device_IDW, (DEVINST, PWCHAR, ULONG, ULONG)); - -#ifdef UNICODE -#define CM_Get_Device_ID CM_Get_Device_IDW -#else -#define CM_Get_Device_ID CM_Get_Device_IDA -#endif /* UNICODE */ #define IOCTL_USB_GET_HUB_CAPABILITIES_EX \ CTL_CODE( FILE_DEVICE_USB, USB_GET_HUB_CAPABILITIES_EX, METHOD_BUFFERED, FILE_ANY_ACCESS) -- cgit v1.2.1