Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
b4d8cd38
Commit
b4d8cd38
authored
Aug 23, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Aug 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Create the IOHID bus thread in main.c.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9d7f1eef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
35 deletions
+46
-35
bus.h
dlls/winebus.sys/bus.h
+4
-3
bus_iohid.c
dlls/winebus.sys/bus_iohid.c
+28
-31
main.c
dlls/winebus.sys/main.c
+14
-1
No files found.
dlls/winebus.sys/bus.h
View file @
b4d8cd38
...
...
@@ -28,9 +28,6 @@
typedef
int
(
*
enum_func
)(
DEVICE_OBJECT
*
device
,
void
*
context
);
/* Buses */
NTSTATUS
iohid_driver_init
(
void
)
DECLSPEC_HIDDEN
;
void
iohid_driver_unload
(
void
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
sdl_bus_init
(
void
*
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
sdl_bus_wait
(
void
*
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
sdl_bus_stop
(
void
*
)
DECLSPEC_HIDDEN
;
...
...
@@ -39,6 +36,10 @@ extern NTSTATUS udev_bus_init(void *) DECLSPEC_HIDDEN;
extern
NTSTATUS
udev_bus_wait
(
void
*
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
udev_bus_stop
(
void
*
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
iohid_bus_init
(
void
*
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
iohid_bus_wait
(
void
*
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
iohid_bus_stop
(
void
*
)
DECLSPEC_HIDDEN
;
/* Native device function table */
typedef
struct
{
...
...
dlls/winebus.sys/bus_iohid.c
View file @
b4d8cd38
...
...
@@ -96,7 +96,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay);
static
IOHIDManagerRef
hid_manager
;
static
CFRunLoopRef
run_loop
;
static
HANDLE
run_loop_handle
;
static
const
WCHAR
busidW
[]
=
{
'I'
,
'O'
,
'H'
,
'I'
,
'D'
,
0
};
...
...
@@ -385,63 +384,61 @@ static void handle_RemovalCallback(void *context, IOReturn result, void *sender,
}
}
/* This puts the relevant run loop for event handling into a WINE thread */
static
DWORD
CALLBACK
runloop_thread
(
void
*
args
)
NTSTATUS
iohid_bus_init
(
void
*
args
)
{
if
(
!
(
hid_manager
=
IOHIDManagerCreate
(
kCFAllocatorDefault
,
0L
)))
{
ERR
(
"IOHID manager creation failed
\n
"
);
return
STATUS_UNSUCCESSFUL
;
}
run_loop
=
CFRunLoopGetCurrent
();
IOHIDManagerSetDeviceMatching
(
hid_manager
,
NULL
);
IOHIDManagerRegisterDeviceMatchingCallback
(
hid_manager
,
handle_DeviceMatchingCallback
,
NULL
);
IOHIDManagerRegisterDeviceRemovalCallback
(
hid_manager
,
handle_RemovalCallback
,
NULL
);
IOHIDManagerScheduleWithRunLoop
(
hid_manager
,
run_loop
,
kCFRunLoopDefaultMode
);
CFRunLoopRun
();
TRACE
(
"Run Loop exiting
\n
"
);
return
1
;
return
STATUS_SUCCESS
;
}
NTSTATUS
iohid_
driver_init
(
void
)
NTSTATUS
iohid_
bus_wait
(
void
*
args
)
{
hid_manager
=
IOHIDManagerCreate
(
kCFAllocatorDefault
,
0L
);
if
(
!
(
run_loop_handle
=
CreateThread
(
NULL
,
0
,
runloop_thread
,
NULL
,
0
,
NULL
)))
{
ERR
(
"Failed to initialize IOHID Manager thread
\n
"
);
CFRelease
(
hid_manager
);
return
STATUS_UNSUCCESSFUL
;
}
CFRunLoopRun
();
TRACE
(
"Initialization successful
\n
"
);
TRACE
(
"IOHID main loop exiting
\n
"
);
IOHIDManagerRegisterDeviceMatchingCallback
(
hid_manager
,
NULL
,
NULL
);
IOHIDManagerRegisterDeviceRemovalCallback
(
hid_manager
,
NULL
,
NULL
);
CFRelease
(
hid_manager
);
return
STATUS_SUCCESS
;
}
void
iohid_driver_unload
(
void
)
NTSTATUS
iohid_bus_stop
(
void
*
args
)
{
TRACE
(
"Unloading Driver
\n
"
);
if
(
!
run_loop_handle
)
return
;
if
(
!
run_loop
)
return
STATUS_SUCCESS
;
IOHIDManagerUnscheduleFromRunLoop
(
hid_manager
,
run_loop
,
kCFRunLoopDefaultMode
);
CFRunLoopStop
(
run_loop
);
WaitForSingleObject
(
run_loop_handle
,
INFINITE
);
CloseHandle
(
run_loop_handle
);
IOHIDManagerRegisterDeviceMatchingCallback
(
hid_manager
,
NULL
,
NULL
);
IOHIDManagerRegisterDeviceRemovalCallback
(
hid_manager
,
NULL
,
NULL
);
CFRelease
(
hid_manager
);
TRACE
(
"Driver Unloaded
\n
"
);
return
STATUS_SUCCESS
;
}
#else
NTSTATUS
iohid_driver_init
(
void
)
NTSTATUS
iohid_bus_init
(
void
*
args
)
{
WARN
(
"IOHID support not compiled in!
\n
"
);
return
STATUS_NOT_IMPLEMENTED
;
}
NTSTATUS
iohid_bus_wait
(
void
*
args
)
{
WARN
(
"IOHID support not compiled in!
\n
"
);
return
STATUS_NOT_IMPLEMENTED
;
}
void
iohid_driver_unload
(
void
)
NTSTATUS
iohid_bus_stop
(
void
*
args
)
{
TRACE
(
"Stub: Unload Driver
\n
"
);
WARN
(
"IOHID support not compiled in!
\n
"
);
return
STATUS_NOT_IMPLEMENTED
;
}
#endif
/* HAVE_IOHIDMANAGERCREATE */
dlls/winebus.sys/main.c
View file @
b4d8cd38
...
...
@@ -699,6 +699,19 @@ static NTSTATUS udev_driver_init(void)
return
bus_main_thread_start
(
&
bus
);
}
static
NTSTATUS
iohid_driver_init
(
void
)
{
static
const
WCHAR
bus_name
[]
=
{
'I'
,
'O'
,
'H'
,
'I'
,
'D'
};
struct
bus_main_params
bus
=
{
.
name
=
bus_name
,
.
init_func
=
iohid_bus_init
,
.
wait_func
=
iohid_bus_wait
,
};
return
bus_main_thread_start
(
&
bus
);
}
static
NTSTATUS
fdo_pnp_dispatch
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
static
const
WCHAR
SDL_enabledW
[]
=
{
'E'
,
'n'
,
'a'
,
'b'
,
'l'
,
'e'
,
' '
,
'S'
,
'D'
,
'L'
,
0
};
...
...
@@ -727,9 +740,9 @@ static NTSTATUS fdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp)
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
break
;
case
IRP_MN_REMOVE_DEVICE
:
iohid_driver_unload
();
sdl_bus_stop
(
NULL
);
udev_bus_stop
(
NULL
);
iohid_bus_stop
(
NULL
);
WaitForMultipleObjects
(
bus_count
,
bus_thread
,
TRUE
,
INFINITE
);
while
(
bus_count
--
)
CloseHandle
(
bus_thread
[
bus_count
]);
...
...
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