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
b86eade7
Commit
b86eade7
authored
Sep 14, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Use helpers to create and destroy unix devices.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
cd830398
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
19 deletions
+26
-19
bus_iohid.c
dlls/winebus.sys/bus_iohid.c
+2
-5
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+2
-6
bus_udev.c
dlls/winebus.sys/bus_udev.c
+4
-8
unix_private.h
dlls/winebus.sys/unix_private.h
+3
-0
unixlib.c
dlls/winebus.sys/unixlib.c
+15
-0
No files found.
dlls/winebus.sys/bus_iohid.c
View file @
b86eade7
...
...
@@ -139,8 +139,7 @@ static void handle_IOHIDDeviceIOHIDReportCallback(void *context,
static
void
iohid_device_destroy
(
struct
unix_device
*
iface
)
{
struct
platform_private
*
private
=
impl_from_unix_device
(
iface
);
HeapFree
(
GetProcessHeap
(),
0
,
private
);
unix_device_destroy
(
iface
);
}
static
int
iohid_device_compare
(
struct
unix_device
*
iface
,
void
*
context
)
...
...
@@ -337,9 +336,7 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
TRACE
(
"dev %p, desc %s.
\n
"
,
IOHIDDevice
,
debugstr_device_desc
(
&
desc
));
if
(
!
(
private
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
platform_private
))))
return
;
private
->
unix_device
.
vtbl
=
&
iohid_device_vtbl
;
if
(
!
(
private
=
unix_device_create
(
&
iohid_device_vtbl
,
sizeof
(
struct
platform_private
))))
return
;
private
->
device
=
IOHIDDevice
;
private
->
buffer
=
NULL
;
...
...
dlls/winebus.sys/bus_sdl.c
View file @
b86eade7
...
...
@@ -480,9 +480,7 @@ failed:
static
void
sdl_device_destroy
(
struct
unix_device
*
iface
)
{
struct
platform_private
*
ext
=
impl_from_unix_device
(
iface
);
HeapFree
(
GetProcessHeap
(),
0
,
ext
);
unix_device_destroy
(
iface
);
}
static
int
sdl_device_compare
(
struct
unix_device
*
iface
,
void
*
context
)
...
...
@@ -761,9 +759,7 @@ static void sdl_add_device(unsigned int index)
TRACE
(
"%s id %d, desc %s.
\n
"
,
controller
?
"controller"
:
"joystick"
,
id
,
debugstr_device_desc
(
&
desc
));
if
(
!
(
private
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
private
))))
return
;
private
->
unix_device
.
vtbl
=
&
sdl_device_vtbl
;
if
(
!
(
private
=
unix_device_create
(
&
sdl_device_vtbl
,
sizeof
(
struct
platform_private
))))
return
;
private
->
sdl_joystick
=
joystick
;
private
->
sdl_controller
=
controller
;
private
->
id
=
id
;
...
...
dlls/winebus.sys/bus_udev.c
View file @
b86eade7
...
...
@@ -561,7 +561,7 @@ static void hidraw_device_destroy(struct unix_device *iface)
close
(
private
->
device_fd
);
udev_device_unref
(
private
->
udev_device
);
HeapFree
(
GetProcessHeap
(),
0
,
privat
e
);
unix_device_destroy
(
ifac
e
);
}
static
int
udev_device_compare
(
struct
unix_device
*
iface
,
void
*
platform_dev
)
...
...
@@ -815,7 +815,7 @@ static void lnxev_device_destroy(struct unix_device *iface)
close
(
ext
->
base
.
device_fd
);
udev_device_unref
(
ext
->
base
.
udev_device
);
HeapFree
(
GetProcessHeap
(),
0
,
ext
);
unix_device_destroy
(
iface
);
}
static
DWORD
CALLBACK
lnxev_device_report_thread
(
void
*
args
);
...
...
@@ -1084,9 +1084,7 @@ static void udev_add_device(struct udev_device *dev)
if
(
strcmp
(
subsystem
,
"hidraw"
)
==
0
)
{
if
(
!
(
private
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
platform_private
))))
return
;
private
->
unix_device
.
vtbl
=
&
hidraw_device_vtbl
;
if
(
!
(
private
=
unix_device_create
(
&
hidraw_device_vtbl
,
sizeof
(
struct
platform_private
))))
return
;
EnterCriticalSection
(
&
udev_cs
);
list_add_tail
(
&
device_list
,
&
private
->
unix_device
.
entry
);
LeaveCriticalSection
(
&
udev_cs
);
...
...
@@ -1098,9 +1096,7 @@ static void udev_add_device(struct udev_device *dev)
#ifdef HAS_PROPER_INPUT_HEADER
else
if
(
strcmp
(
subsystem
,
"input"
)
==
0
)
{
if
(
!
(
private
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
wine_input_private
))))
return
;
private
->
unix_device
.
vtbl
=
&
lnxev_device_vtbl
;
if
(
!
(
private
=
unix_device_create
(
&
lnxev_device_vtbl
,
sizeof
(
struct
wine_input_private
))))
return
;
EnterCriticalSection
(
&
udev_cs
);
list_add_tail
(
&
device_list
,
&
private
->
unix_device
.
entry
);
LeaveCriticalSection
(
&
udev_cs
);
...
...
dlls/winebus.sys/unix_private.h
View file @
b86eade7
...
...
@@ -47,6 +47,9 @@ struct unix_device
struct
list
entry
;
};
extern
void
*
unix_device_create
(
const
struct
unix_device_vtbl
*
vtbl
,
SIZE_T
size
)
DECLSPEC_HIDDEN
;
extern
void
unix_device_destroy
(
struct
unix_device
*
iface
)
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
;
...
...
dlls/winebus.sys/unixlib.c
View file @
b86eade7
...
...
@@ -213,6 +213,21 @@ static NTSTATUS keyboard_device_create(void *args)
return
STATUS_SUCCESS
;
}
void
*
unix_device_create
(
const
struct
unix_device_vtbl
*
vtbl
,
SIZE_T
size
)
{
struct
unix_device
*
iface
;
if
(
!
(
iface
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
size
)))
return
NULL
;
iface
->
vtbl
=
vtbl
;
return
iface
;
}
void
unix_device_destroy
(
struct
unix_device
*
iface
)
{
HeapFree
(
GetProcessHeap
(),
0
,
iface
);
}
static
NTSTATUS
unix_device_remove
(
void
*
args
)
{
struct
unix_device
*
iface
=
args
;
...
...
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