Skip to content

Commit

Permalink
address @tormodvolden comments related to trailing whitespaces. TO BE…
Browse files Browse the repository at this point in the history
… SQUASHED WITH PREVIOUS COMMIT
  • Loading branch information
sonatique committed Feb 13, 2024
1 parent 26b9eca commit 19f7631
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion libusb/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libusb/os/windows_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions libusb/os/windows_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
28 changes: 14 additions & 14 deletions libusb/os/windows_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down Expand Up @@ -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);
}
Expand All @@ -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;
}

Expand All @@ -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);
}
}

Expand Down Expand Up @@ -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;
Expand All @@ -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),
Expand Down Expand Up @@ -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,
&notificationFilter,
DEVICE_NOTIFY_WINDOW_HANDLE
);
Expand All @@ -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);
Expand All @@ -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;
}
Expand Down
16 changes: 8 additions & 8 deletions libusb/os/windows_hotplug.h
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion libusb/os/windows_usbdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions libusb/os/windows_winusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 19f7631

Please sign in to comment.