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
7e1d1fac
Commit
7e1d1fac
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: Load bus options in main.c.
And pass them to bus_init function. Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
edbb3fac
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
44 deletions
+69
-44
bus.h
dlls/winebus.sys/bus.h
+0
-1
bus_iohid.c
dlls/winebus.sys/bus_iohid.c
+5
-0
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+5
-7
bus_udev.c
dlls/winebus.sys/bus_udev.c
+8
-20
main.c
dlls/winebus.sys/main.c
+36
-16
unixlib.h
dlls/winebus.sys/unixlib.h
+15
-0
No files found.
dlls/winebus.sys/bus.h
View file @
7e1d1fac
...
...
@@ -52,7 +52,6 @@ void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) DECLS
DEVICE_OBJECT
*
bus_enumerate_hid_devices
(
const
WCHAR
*
bus_id
,
enum_func
function
,
void
*
context
)
DECLSPEC_HIDDEN
;
/* General Bus Functions */
DWORD
check_bus_option
(
const
UNICODE_STRING
*
option
,
DWORD
default_value
)
DECLSPEC_HIDDEN
;
BOOL
is_xbox_gamepad
(
WORD
vid
,
WORD
pid
)
DECLSPEC_HIDDEN
;
extern
HANDLE
driver_key
DECLSPEC_HIDDEN
;
...
...
dlls/winebus.sys/bus_iohid.c
View file @
7e1d1fac
...
...
@@ -99,6 +99,7 @@ static IOHIDManagerRef hid_manager;
static
CFRunLoopRef
run_loop
;
static
const
WCHAR
busidW
[]
=
{
'I'
,
'O'
,
'H'
,
'I'
,
'D'
,
0
};
static
struct
iohid_bus_options
options
;
struct
platform_private
{
...
...
@@ -387,6 +388,10 @@ static void handle_RemovalCallback(void *context, IOReturn result, void *sender,
NTSTATUS
iohid_bus_init
(
void
*
args
)
{
TRACE
(
"args %p
\n
"
,
args
);
options
=
*
(
struct
iohid_bus_options
*
)
args
;
if
(
!
(
hid_manager
=
IOHIDManagerCreate
(
kCFAllocatorDefault
,
0L
)))
{
ERR
(
"IOHID manager creation failed
\n
"
);
...
...
dlls/winebus.sys/bus_sdl.c
View file @
7e1d1fac
...
...
@@ -60,8 +60,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(plugplay);
WINE_DECLARE_DEBUG_CHANNEL
(
hid_report
);
static
const
WCHAR
sdl_busidW
[]
=
{
'S'
,
'D'
,
'L'
,
'J'
,
'O'
,
'Y'
,
0
};
static
DWORD
map_controllers
=
0
;
static
struct
sdl_bus_options
options
;
static
void
*
sdl_handle
=
NULL
;
static
UINT
quit_event
=
-
1
;
...
...
@@ -748,7 +747,7 @@ static void try_add_device(unsigned int index)
return
;
}
if
(
map_controllers
&&
pSDL_IsGameController
(
index
))
if
(
options
.
map_controllers
&&
pSDL_IsGameController
(
index
))
controller
=
pSDL_GameControllerOpen
(
index
);
id
=
pSDL_JoystickInstanceID
(
joystick
);
...
...
@@ -891,8 +890,9 @@ static void sdl_load_mappings(void)
NTSTATUS
sdl_bus_init
(
void
*
args
)
{
static
const
WCHAR
controller_modeW
[]
=
{
'M'
,
'a'
,
'p'
,
' '
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'l'
,
'e'
,
'r'
,
's'
,
0
};
static
const
UNICODE_STRING
controller_mode
=
{
sizeof
(
controller_modeW
)
-
sizeof
(
WCHAR
),
sizeof
(
controller_modeW
),
(
WCHAR
*
)
controller_modeW
};
TRACE
(
"args %p
\n
"
,
args
);
options
=
*
(
struct
sdl_bus_options
*
)
args
;
if
(
!
(
sdl_handle
=
dlopen
(
SONAME_LIBSDL2
,
RTLD_NOW
)))
{
...
...
@@ -963,8 +963,6 @@ NTSTATUS sdl_bus_init(void *args)
pSDL_JoystickEventState
(
SDL_ENABLE
);
pSDL_GameControllerEventState
(
SDL_ENABLE
);
map_controllers
=
check_bus_option
(
&
controller_mode
,
1
);
/* Process mappings */
if
(
pSDL_GameControllerAddMapping
!=
NULL
)
sdl_load_mappings
();
...
...
dlls/winebus.sys/bus_udev.c
View file @
7e1d1fac
...
...
@@ -90,13 +90,12 @@ WINE_DECLARE_DEBUG_CHANNEL(hid_report);
static
struct
udev
*
udev_context
=
NULL
;
static
struct
udev_monitor
*
udev_monitor
;
static
DWORD
disable_hidraw
=
0
;
static
DWORD
disable_input
=
0
;
static
int
deviceloop_control
[
2
];
static
int
udev_monitor_fd
;
static
const
WCHAR
hidraw_busidW
[]
=
{
'H'
,
'I'
,
'D'
,
'R'
,
'A'
,
'W'
,
0
};
static
const
WCHAR
lnxev_busidW
[]
=
{
'L'
,
'N'
,
'X'
,
'E'
,
'V'
,
0
};
static
struct
udev_bus_options
options
;
struct
platform_private
{
...
...
@@ -1181,11 +1180,11 @@ static void build_initial_deviceset(void)
return
;
}
if
(
!
disable_hidraw
)
if
(
!
options
.
disable_hidraw
)
if
(
udev_enumerate_add_match_subsystem
(
enumerate
,
"hidraw"
)
<
0
)
WARN
(
"Failed to add subsystem 'hidraw' to enumeration
\n
"
);
#ifdef HAS_PROPER_INPUT_HEADER
if
(
!
disable_input
)
if
(
!
options
.
disable_input
)
{
if
(
udev_enumerate_add_match_subsystem
(
enumerate
,
"input"
)
<
0
)
WARN
(
"Failed to add subsystem 'input' to enumeration
\n
"
);
...
...
@@ -1224,7 +1223,7 @@ static struct udev_monitor *create_monitor(int *fd)
return
NULL
;
}
if
(
!
disable_hidraw
)
if
(
!
options
.
disable_hidraw
)
{
if
(
udev_monitor_filter_add_match_subsystem_devtype
(
monitor
,
"hidraw"
,
NULL
)
<
0
)
WARN
(
"Failed to add 'hidraw' subsystem to monitor
\n
"
);
...
...
@@ -1232,7 +1231,7 @@ static struct udev_monitor *create_monitor(int *fd)
systems
++
;
}
#ifdef HAS_PROPER_INPUT_HEADER
if
(
!
disable_input
)
if
(
!
options
.
disable_input
)
{
if
(
udev_monitor_filter_add_match_subsystem_devtype
(
monitor
,
"input"
,
NULL
)
<
0
)
WARN
(
"Failed to add 'input' subsystem to monitor
\n
"
);
...
...
@@ -1288,10 +1287,9 @@ static void process_monitor_event(struct udev_monitor *monitor)
NTSTATUS
udev_bus_init
(
void
*
args
)
{
static
const
WCHAR
hidraw_disabledW
[]
=
{
'D'
,
'i'
,
's'
,
'a'
,
'b'
,
'l'
,
'e'
,
'H'
,
'i'
,
'd'
,
'r'
,
'a'
,
'w'
,
0
};
static
const
UNICODE_STRING
hidraw_disabled
=
{
sizeof
(
hidraw_disabledW
)
-
sizeof
(
WCHAR
),
sizeof
(
hidraw_disabledW
),
(
WCHAR
*
)
hidraw_disabledW
};
static
const
WCHAR
input_disabledW
[]
=
{
'D'
,
'i'
,
's'
,
'a'
,
'b'
,
'l'
,
'e'
,
'I'
,
'n'
,
'p'
,
'u'
,
't'
,
0
};
static
const
UNICODE_STRING
input_disabled
=
{
sizeof
(
input_disabledW
)
-
sizeof
(
WCHAR
),
sizeof
(
input_disabledW
),
(
WCHAR
*
)
input_disabledW
};
TRACE
(
"args %p
\n
"
,
args
);
options
=
*
(
struct
udev_bus_options
*
)
args
;
if
(
pipe
(
deviceloop_control
)
!=
0
)
{
...
...
@@ -1305,16 +1303,6 @@ NTSTATUS udev_bus_init(void *args)
goto
error
;
}
disable_hidraw
=
check_bus_option
(
&
hidraw_disabled
,
0
);
if
(
disable_hidraw
)
TRACE
(
"UDEV hidraw devices disabled in registry
\n
"
);
#ifdef HAS_PROPER_INPUT_HEADER
disable_input
=
check_bus_option
(
&
input_disabled
,
0
);
if
(
disable_input
)
TRACE
(
"UDEV input devices disabled in registry
\n
"
);
#endif
if
(
!
(
udev_monitor
=
create_monitor
(
&
udev_monitor_fd
)))
{
ERR
(
"UDEV monitor creation failed
\n
"
);
...
...
dlls/winebus.sys/main.c
View file @
7e1d1fac
...
...
@@ -411,6 +411,20 @@ static NTSTATUS build_device_relations(DEVICE_RELATIONS **devices)
return
STATUS_SUCCESS
;
}
static
DWORD
check_bus_option
(
const
UNICODE_STRING
*
option
,
DWORD
default_value
)
{
char
buffer
[
FIELD_OFFSET
(
KEY_VALUE_PARTIAL_INFORMATION
,
Data
[
sizeof
(
DWORD
)])];
KEY_VALUE_PARTIAL_INFORMATION
*
info
=
(
KEY_VALUE_PARTIAL_INFORMATION
*
)
buffer
;
DWORD
size
;
if
(
NtQueryValueKey
(
driver_key
,
option
,
KeyValuePartialInformation
,
info
,
sizeof
(
buffer
),
&
size
)
==
STATUS_SUCCESS
)
{
if
(
info
->
Type
==
REG_DWORD
)
return
*
(
DWORD
*
)
info
->
Data
;
}
return
default_value
;
}
static
NTSTATUS
handle_IRP_MN_QUERY_DEVICE_RELATIONS
(
IRP
*
irp
)
{
NTSTATUS
status
=
irp
->
IoStatus
.
Status
;
...
...
@@ -632,6 +646,7 @@ struct bus_main_params
{
const
WCHAR
*
name
;
void
*
init_args
;
HANDLE
init_done
;
unsigned
int
init_code
;
unsigned
int
wait_code
;
...
...
@@ -643,7 +658,7 @@ static DWORD CALLBACK bus_main_thread(void *args)
NTSTATUS
status
;
TRACE
(
"%s main loop starting
\n
"
,
debugstr_w
(
bus
.
name
));
status
=
winebus_call
(
bus
.
init_code
,
NULL
);
status
=
winebus_call
(
bus
.
init_code
,
bus
.
init_args
);
SetEvent
(
bus
.
init_done
);
TRACE
(
"%s main loop started
\n
"
,
debugstr_w
(
bus
.
name
));
...
...
@@ -682,35 +697,55 @@ static NTSTATUS bus_main_thread_start(struct bus_main_params *bus)
static
NTSTATUS
sdl_driver_init
(
void
)
{
static
const
WCHAR
bus_name
[]
=
{
'S'
,
'D'
,
'L'
,
0
};
static
const
WCHAR
controller_modeW
[]
=
{
'M'
,
'a'
,
'p'
,
' '
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'l'
,
'e'
,
'r'
,
's'
,
0
};
static
const
UNICODE_STRING
controller_mode
=
{
sizeof
(
controller_modeW
)
-
sizeof
(
WCHAR
),
sizeof
(
controller_modeW
),
(
WCHAR
*
)
controller_modeW
};
struct
sdl_bus_options
bus_options
;
struct
bus_main_params
bus
=
{
.
name
=
bus_name
,
.
init_args
=
&
bus_options
,
.
init_code
=
sdl_init
,
.
wait_code
=
sdl_wait
,
};
bus_options
.
map_controllers
=
check_bus_option
(
&
controller_mode
,
1
);
if
(
!
bus_options
.
map_controllers
)
TRACE
(
"SDL controller to XInput HID gamepad mapping disabled
\n
"
);
return
bus_main_thread_start
(
&
bus
);
}
static
NTSTATUS
udev_driver_init
(
void
)
{
static
const
WCHAR
bus_name
[]
=
{
'U'
,
'D'
,
'E'
,
'V'
,
0
};
static
const
WCHAR
hidraw_disabledW
[]
=
{
'D'
,
'i'
,
's'
,
'a'
,
'b'
,
'l'
,
'e'
,
'H'
,
'i'
,
'd'
,
'r'
,
'a'
,
'w'
,
0
};
static
const
UNICODE_STRING
hidraw_disabled
=
{
sizeof
(
hidraw_disabledW
)
-
sizeof
(
WCHAR
),
sizeof
(
hidraw_disabledW
),
(
WCHAR
*
)
hidraw_disabledW
};
static
const
WCHAR
input_disabledW
[]
=
{
'D'
,
'i'
,
's'
,
'a'
,
'b'
,
'l'
,
'e'
,
'I'
,
'n'
,
'p'
,
'u'
,
't'
,
0
};
static
const
UNICODE_STRING
input_disabled
=
{
sizeof
(
input_disabledW
)
-
sizeof
(
WCHAR
),
sizeof
(
input_disabledW
),
(
WCHAR
*
)
input_disabledW
};
struct
udev_bus_options
bus_options
;
struct
bus_main_params
bus
=
{
.
name
=
bus_name
,
.
init_args
=
&
bus_options
,
.
init_code
=
udev_init
,
.
wait_code
=
udev_wait
,
};
bus_options
.
disable_hidraw
=
check_bus_option
(
&
hidraw_disabled
,
0
);
if
(
bus_options
.
disable_hidraw
)
TRACE
(
"UDEV hidraw devices disabled in registry
\n
"
);
bus_options
.
disable_input
=
check_bus_option
(
&
input_disabled
,
0
);
if
(
bus_options
.
disable_input
)
TRACE
(
"UDEV input devices disabled in registry
\n
"
);
return
bus_main_thread_start
(
&
bus
);
}
static
NTSTATUS
iohid_driver_init
(
void
)
{
static
const
WCHAR
bus_name
[]
=
{
'I'
,
'O'
,
'H'
,
'I'
,
'D'
};
struct
iohid_bus_options
bus_options
;
struct
bus_main_params
bus
=
{
.
name
=
bus_name
,
.
init_args
=
&
bus_options
,
.
init_code
=
iohid_init
,
.
wait_code
=
iohid_wait
,
};
...
...
@@ -1120,21 +1155,6 @@ void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length)
LeaveCriticalSection
(
&
ext
->
cs
);
}
DWORD
check_bus_option
(
const
UNICODE_STRING
*
option
,
DWORD
default_value
)
{
char
buffer
[
FIELD_OFFSET
(
KEY_VALUE_PARTIAL_INFORMATION
,
Data
[
sizeof
(
DWORD
)])];
KEY_VALUE_PARTIAL_INFORMATION
*
info
=
(
KEY_VALUE_PARTIAL_INFORMATION
*
)
buffer
;
DWORD
size
;
if
(
NtQueryValueKey
(
driver_key
,
option
,
KeyValuePartialInformation
,
info
,
sizeof
(
buffer
),
&
size
)
==
STATUS_SUCCESS
)
{
if
(
info
->
Type
==
REG_DWORD
)
return
*
(
DWORD
*
)
info
->
Data
;
}
return
default_value
;
}
BOOL
is_xbox_gamepad
(
WORD
vid
,
WORD
pid
)
{
int
i
;
...
...
dlls/winebus.sys/unixlib.h
View file @
7e1d1fac
...
...
@@ -29,6 +29,21 @@
#include "wine/unixlib.h"
struct
sdl_bus_options
{
BOOL
map_controllers
;
};
struct
udev_bus_options
{
BOOL
disable_hidraw
;
BOOL
disable_input
;
};
struct
iohid_bus_options
{
};
enum
unix_funcs
{
sdl_init
,
...
...
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