diff --git a/libusb/Makefile.am b/libusb/Makefile.am index 2b21e652b..ada300361 100644 --- a/libusb/Makefile.am +++ b/libusb/Makefile.am @@ -30,7 +30,7 @@ OS_WINDOWS_SRC = libusb-1.0.def libusb-1.0.rc \ os/windows_hotplug.h os/windows_hotplug.c \ os/windows_usbdk.h os/windows_usbdk.c \ os/windows_winusb.h os/windows_winusb.c - + if OS_DARWIN OS_SRC = $(OS_DARWIN_SRC) endif diff --git a/libusb/os/windows_common.c b/libusb/os/windows_common.c index f3c63bbc4..4aabd2a3f 100644 --- a/libusb/os/windows_common.c +++ b/libusb/os/windows_common.c @@ -573,7 +573,7 @@ static int windows_init(struct libusb_context *ctx) goto init_exit; } } - + windows_initial_scan_devices(ctx); init_exit: // Holds semaphore here diff --git a/libusb/os/windows_common.h b/libusb/os/windows_common.h index 2efc98389..cf297c3b1 100644 --- a/libusb/os/windows_common.h +++ b/libusb/os/windows_common.h @@ -240,12 +240,12 @@ typedef struct USB_DK_TRANSFER_REQUEST { UNCHANGED, /* device is newly added to the list, meaning it just appeared in system enumeration. - * A hotplug "device arrived" event shall be triggered */ + * A hotplug "device arrived" event shall be triggered */ ARRIVED, - /* device is no longer present in system enumeration. + /* device is no longer present in system enumeration. * A hotplug "device left" event shall be triggered and the device removed from the list */ - LEFT + LEFT }; struct usbdk_device_priv { diff --git a/libusb/os/windows_hotplug.c b/libusb/os/windows_hotplug.c index 0a5c00022..e1de9fd42 100644 --- a/libusb/os/windows_hotplug.c +++ b/libusb/os/windows_hotplug.c @@ -27,10 +27,10 @@ int windows_start_event_monitor(void) { windows_event_thread_handle = CreateThread( NULL, // Default security descriptor - 0, // Default stack size + 0, // Default stack size windows_event_thread_main, NULL, // No parameters to pass to the thread - 0, // Start immediately + 0, // Start immediately NULL // No need to keep track of thread ID ); @@ -96,7 +96,7 @@ void windows_initial_scan_devices(struct libusb_context *ctx) const int ret = windows_get_device_list(ctx); if (ret != LIBUSB_SUCCESS) { - usbi_err(ctx, "hotplug failed to retrieve initial list with error: %s", libusb_error_name(ret)); + usbi_err(ctx, "hotplug failed to retrieve initial list with error: %s", libusb_error_name(ret)); } usbi_mutex_static_unlock(&active_contexts_lock); } @@ -106,7 +106,7 @@ static void windows_refresh_device_list(struct libusb_context *ctx) const int ret = windows_get_device_list(ctx); if (ret != LIBUSB_SUCCESS) { - usbi_err(ctx, "hotplug failed to retrieve current list with error: %s", libusb_error_name(ret)); + usbi_err(ctx, "hotplug failed to retrieve current list with error: %s", libusb_error_name(ret)); return; } @@ -123,11 +123,11 @@ static void windows_refresh_device_list(struct libusb_context *ctx) if (priv->initialized) { - usbi_disconnect_device(dev); + usbi_disconnect_device(dev); } else { - usbi_detach_device(dev); + usbi_detach_device(dev); } } @@ -166,7 +166,7 @@ static bool init_wnd_class(void) wndClass.hInstance = GetModuleHandle(NULL); wndClass.lpszClassName = WND_CLASS_NAME; - if (!RegisterClass(&wndClass)) + if (!RegisterClass(&wndClass)) { log_error("event thread: RegisterClass"); return false; @@ -189,7 +189,7 @@ static DWORD WINAPI windows_event_thread_main(LPVOID lpParam) windows_event_hwnd = CreateWindow( WND_CLASS_NAME, TEXT(""), - 0, + 0, 0, 0, 0, 0, NULL, NULL, GetModuleHandle(NULL), @@ -236,10 +236,10 @@ static bool register_device_interface_to_window_handle( DEV_BROADCAST_DEVICEINTERFACE notificationFilter = { 0 }; notificationFilter.dbcc_size = sizeof(notificationFilter); notificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; - notificationFilter.dbcc_classguid = interface_class_guid; + notificationFilter.dbcc_classguid = interface_class_guid; *device_notify_handle = RegisterDeviceNotification( - hwnd, + hwnd, ¬ificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE ); @@ -254,9 +254,9 @@ static bool register_device_interface_to_window_handle( } static LRESULT CALLBACK windows_proc_callback( - HWND hwnd, - UINT message, - WPARAM wParam, + HWND hwnd, + UINT message, + WPARAM wParam, LPARAM lParam) { UNUSED(lParam); @@ -269,7 +269,7 @@ static LRESULT CALLBACK windows_proc_callback( if (!register_device_interface_to_window_handle( GUID_DEVINTERFACE_USB_DEVICE, hwnd, - &device_notify_handle)) + &device_notify_handle)) { return -1; } diff --git a/libusb/os/windows_hotplug.h b/libusb/os/windows_hotplug.h index 5e93285e2..1be1e1a65 100644 --- a/libusb/os/windows_hotplug.h +++ b/libusb/os/windows_hotplug.h @@ -1,9 +1,9 @@ -#ifndef WINDOWS_HOTPLUG_H -#define WINDOWS_HOTPLUG_H - -int windows_start_event_monitor(void); -int windows_stop_event_monitor(void); - -void windows_initial_scan_devices(struct libusb_context *ctx); - +#ifndef WINDOWS_HOTPLUG_H +#define WINDOWS_HOTPLUG_H + +int windows_start_event_monitor(void); +int windows_stop_event_monitor(void); + +void windows_initial_scan_devices(struct libusb_context *ctx); + #endif \ No newline at end of file diff --git a/libusb/os/windows_usbdk.c b/libusb/os/windows_usbdk.c index 027e3ddd0..f85fe532d 100644 --- a/libusb/os/windows_usbdk.c +++ b/libusb/os/windows_usbdk.c @@ -336,7 +336,7 @@ static int usbdk_get_device_list(struct libusb_context *ctx) } ((struct winusb_device_priv *)usbi_get_device_priv(dev))->hotplug_status = ARRIVED; - + usbdk_device_init(dev, &devices[i]); if (usbdk_device_priv_init(ctx, dev, &devices[i]) != LIBUSB_SUCCESS) { libusb_unref_device(dev); diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c index a0de92d99..6bffc8dbf 100644 --- a/libusb/os/windows_winusb.c +++ b/libusb/os/windows_winusb.c @@ -1968,11 +1968,11 @@ static int winusb_get_device_list(struct libusb_context *ctx) // but we skip it (don't add to list of discovered devices) usbi_warn(ctx, "failed to initialize device '%s'", priv->dev_id); r = LIBUSB_SUCCESS; - + usbi_detach_device(dev); libusb_unref_device(dev); } - + break; case HID_PASS: case EXT_PASS: