Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
92ae93d7
Commit
92ae93d7
authored
Jul 05, 2022
by
Zebediah Figura
Committed by
Alexandre Julliard
Jul 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineusb.sys: Move the event handling loop to the Unix library.
parent
b3a47cf1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
12 deletions
+33
-12
unixlib.c
dlls/wineusb.sys/unixlib.c
+29
-0
unixlib.h
dlls/wineusb.sys/unixlib.h
+2
-0
wineusb.c
dlls/wineusb.sys/wineusb.c
+2
-12
No files found.
dlls/wineusb.sys/unixlib.c
View file @
92ae93d7
...
...
@@ -22,6 +22,7 @@
#pragma makedep unix
#endif
#include <stdbool.h>
#include <libusb.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
...
...
@@ -32,6 +33,32 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
wineusb
);
static
bool
thread_shutdown
;
static
NTSTATUS
usb_main_loop
(
void
*
args
)
{
int
ret
;
TRACE
(
"Starting libusb event thread.
\n
"
);
while
(
!
thread_shutdown
)
{
if
((
ret
=
libusb_handle_events
(
NULL
)))
ERR
(
"Error handling events: %s
\n
"
,
libusb_strerror
(
ret
));
}
TRACE
(
"Shutting down libusb event thread.
\n
"
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
usb_exit
(
void
*
args
)
{
thread_shutdown
=
true
;
libusb_interrupt_event_handler
(
NULL
);
return
STATUS_SUCCESS
;
}
static
NTSTATUS
usb_cancel_transfer
(
void
*
args
)
{
const
struct
usb_cancel_transfer_params
*
params
=
args
;
...
...
@@ -46,5 +73,7 @@ static NTSTATUS usb_cancel_transfer(void *args)
const
unixlib_entry_t
__wine_unix_call_funcs
[]
=
{
#define X(name) [unix_ ## name] = name
X
(
usb_main_loop
),
X
(
usb_exit
),
X
(
usb_cancel_transfer
),
};
dlls/wineusb.sys/unixlib.h
View file @
92ae93d7
...
...
@@ -32,6 +32,8 @@ struct usb_cancel_transfer_params
enum
unix_funcs
{
unix_usb_main_loop
,
unix_usb_exit
,
unix_usb_cancel_transfer
,
};
...
...
dlls/wineusb.sys/wineusb.c
View file @
92ae93d7
...
...
@@ -376,7 +376,6 @@ static void remove_usb_device(libusb_device *libusb_device)
}
}
static
BOOL
thread_shutdown
;
static
HANDLE
libusb_event_thread
,
event_thread
;
static
int
LIBUSB_CALL
hotplug_cb
(
libusb_context
*
context
,
libusb_device
*
device
,
...
...
@@ -393,19 +392,11 @@ static int LIBUSB_CALL hotplug_cb(libusb_context *context, libusb_device *device
static
DWORD
CALLBACK
libusb_event_thread_proc
(
void
*
arg
)
{
static
const
struct
usb_event
shutdown_event
=
{.
type
=
USB_EVENT_SHUTDOWN
};
int
ret
;
TRACE
(
"Starting libusb event thread.
\n
"
);
while
(
!
thread_shutdown
)
{
if
((
ret
=
libusb_handle_events
(
NULL
)))
ERR
(
"Error handling events: %s
\n
"
,
libusb_strerror
(
ret
));
}
__wine_unix_call
(
unix_handle
,
unix_usb_main_loop
,
NULL
);
queue_event
(
&
shutdown_event
);
TRACE
(
"Shutting down libusb event thread.
\n
"
);
return
0
;
}
...
...
@@ -517,8 +508,7 @@ static NTSTATUS fdo_pnp(IRP *irp)
struct
usb_device
*
device
,
*
cursor
;
libusb_hotplug_deregister_callback
(
NULL
,
hotplug_cb_handle
);
thread_shutdown
=
TRUE
;
libusb_interrupt_event_handler
(
NULL
);
__wine_unix_call
(
unix_handle
,
unix_usb_exit
,
NULL
);
WaitForSingleObject
(
libusb_event_thread
,
INFINITE
);
CloseHandle
(
libusb_event_thread
);
WaitForSingleObject
(
event_thread
,
INFINITE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment