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
077d64bd
Commit
077d64bd
authored
Jun 16, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Use UINT instead of enum and UINT64 instead of unix_device pointer.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
3b1354ff
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
33 deletions
+49
-33
main.c
dlls/winebus.sys/main.c
+17
-14
unix_private.h
dlls/winebus.sys/unix_private.h
+2
-0
unixlib.c
dlls/winebus.sys/unixlib.c
+15
-12
unixlib.h
dlls/winebus.sys/unixlib.h
+15
-7
No files found.
dlls/winebus.sys/main.c
View file @
077d64bd
...
...
@@ -86,7 +86,7 @@ struct device_extension
struct
list
reports
;
IRP
*
pending_read
;
struct
unix_device
*
unix_device
;
UINT64
unix_device
;
};
static
CRITICAL_SECTION
device_list_cs
;
...
...
@@ -111,13 +111,15 @@ static NTSTATUS winebus_call(unsigned int code, void *args)
static
void
unix_device_remove
(
DEVICE_OBJECT
*
device
)
{
struct
device_extension
*
ext
=
(
struct
device_extension
*
)
device
->
DeviceExtension
;
winebus_call
(
device_remove
,
ext
->
unix_device
);
struct
device_remove_params
params
=
{.
device
=
ext
->
unix_device
};
winebus_call
(
device_remove
,
&
params
);
}
static
NTSTATUS
unix_device_start
(
DEVICE_OBJECT
*
device
)
{
struct
device_extension
*
ext
=
(
struct
device_extension
*
)
device
->
DeviceExtension
;
return
winebus_call
(
device_start
,
ext
->
unix_device
);
struct
device_start_params
params
=
{.
device
=
ext
->
unix_device
};
return
winebus_call
(
device_start
,
&
params
);
}
static
NTSTATUS
unix_device_get_report_descriptor
(
DEVICE_OBJECT
*
device
,
BYTE
*
buffer
,
UINT
length
,
UINT
*
out_length
)
...
...
@@ -125,7 +127,7 @@ static NTSTATUS unix_device_get_report_descriptor(DEVICE_OBJECT *device, BYTE *b
struct
device_extension
*
ext
=
(
struct
device_extension
*
)
device
->
DeviceExtension
;
struct
device_descriptor_params
params
=
{
.
ifa
ce
=
ext
->
unix_device
,
.
devi
ce
=
ext
->
unix_device
,
.
buffer
=
buffer
,
.
length
=
length
,
.
out_length
=
out_length
...
...
@@ -138,7 +140,7 @@ static void unix_device_set_output_report(DEVICE_OBJECT *device, HID_XFER_PACKET
struct
device_extension
*
ext
=
(
struct
device_extension
*
)
device
->
DeviceExtension
;
struct
device_report_params
params
=
{
.
ifa
ce
=
ext
->
unix_device
,
.
devi
ce
=
ext
->
unix_device
,
.
packet
=
packet
,
.
io
=
io
,
};
...
...
@@ -150,7 +152,7 @@ static void unix_device_get_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKE
struct
device_extension
*
ext
=
(
struct
device_extension
*
)
device
->
DeviceExtension
;
struct
device_report_params
params
=
{
.
ifa
ce
=
ext
->
unix_device
,
.
devi
ce
=
ext
->
unix_device
,
.
packet
=
packet
,
.
io
=
io
,
};
...
...
@@ -162,7 +164,7 @@ static void unix_device_set_feature_report(DEVICE_OBJECT *device, HID_XFER_PACKE
struct
device_extension
*
ext
=
(
struct
device_extension
*
)
device
->
DeviceExtension
;
struct
device_report_params
params
=
{
.
ifa
ce
=
ext
->
unix_device
,
.
devi
ce
=
ext
->
unix_device
,
.
packet
=
packet
,
.
io
=
io
,
};
...
...
@@ -284,7 +286,7 @@ static void remove_pending_irps(DEVICE_OBJECT *device)
}
}
static
DEVICE_OBJECT
*
bus_create_hid_device
(
struct
device_desc
*
desc
,
struct
unix_device
*
unix_device
)
static
DEVICE_OBJECT
*
bus_create_hid_device
(
struct
device_desc
*
desc
,
UINT64
unix_device
)
{
struct
device_extension
*
ext
;
DEVICE_OBJECT
*
device
;
...
...
@@ -292,7 +294,7 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni
WCHAR
dev_name
[
256
];
NTSTATUS
status
;
TRACE
(
"desc %s, unix_device %
p
\n
"
,
debugstr_device_desc
(
desc
),
unix_device
);
TRACE
(
"desc %s, unix_device %
#I64x
\n
"
,
debugstr_device_desc
(
desc
),
unix_device
);
swprintf
(
dev_name
,
ARRAY_SIZE
(
dev_name
),
L"
\\
Device
\\
WINEBUS#%p"
,
unix_device
);
RtlInitUnicodeString
(
&
nameW
,
dev_name
);
...
...
@@ -323,7 +325,7 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni
return
device
;
}
static
DEVICE_OBJECT
*
bus_find_unix_device
(
struct
unix_device
*
unix_device
)
static
DEVICE_OBJECT
*
bus_find_unix_device
(
UINT64
unix_device
)
{
struct
device_extension
*
ext
;
...
...
@@ -568,7 +570,7 @@ static DWORD CALLBACK bus_main_thread(void *args)
case
BUS_EVENT_TYPE_DEVICE_REMOVED
:
RtlEnterCriticalSection
(
&
device_list_cs
);
device
=
bus_find_unix_device
(
event
->
device
);
if
(
!
device
)
WARN
(
"could not find device for %s bus device %
p
\n
"
,
debugstr_w
(
bus
.
name
),
event
->
device
);
if
(
!
device
)
WARN
(
"could not find device for %s bus device %
#I64x
\n
"
,
debugstr_w
(
bus
.
name
),
event
->
device
);
else
bus_unlink_hid_device
(
device
);
RtlLeaveCriticalSection
(
&
device_list_cs
);
IoInvalidateDeviceRelations
(
bus_pdo
,
BusRelations
);
...
...
@@ -578,14 +580,15 @@ static DWORD CALLBACK bus_main_thread(void *args)
if
(
device
)
IoInvalidateDeviceRelations
(
bus_pdo
,
BusRelations
);
else
{
WARN
(
"failed to create device for %s bus device %p
\n
"
,
debugstr_w
(
bus
.
name
),
event
->
device
);
winebus_call
(
device_remove
,
event
->
device
);
struct
device_remove_params
params
=
{.
device
=
event
->
device
};
WARN
(
"failed to create device for %s bus device %#I64x
\n
"
,
debugstr_w
(
bus
.
name
),
event
->
device
);
winebus_call
(
device_remove
,
&
params
);
}
break
;
case
BUS_EVENT_TYPE_INPUT_REPORT
:
RtlEnterCriticalSection
(
&
device_list_cs
);
device
=
bus_find_unix_device
(
event
->
device
);
if
(
!
device
)
WARN
(
"could not find device for %s bus device %
p
\n
"
,
debugstr_w
(
bus
.
name
),
event
->
device
);
if
(
!
device
)
WARN
(
"could not find device for %s bus device %
#I64x
\n
"
,
debugstr_w
(
bus
.
name
),
event
->
device
);
else
process_hid_report
(
device
,
event
->
input_report
.
buffer
,
event
->
input_report
.
length
);
RtlLeaveCriticalSection
(
&
device_list_cs
);
break
;
...
...
dlls/winebus.sys/unix_private.h
View file @
077d64bd
...
...
@@ -91,6 +91,8 @@ struct effect_params
};
};
struct
unix_device
;
struct
raw_device_vtbl
{
void
(
*
destroy
)(
struct
unix_device
*
iface
);
...
...
dlls/winebus.sys/unixlib.c
View file @
077d64bd
...
...
@@ -163,7 +163,7 @@ static NTSTATUS mouse_device_create(void *args)
{
struct
device_create_params
*
params
=
args
;
params
->
desc
=
mouse_device_desc
;
params
->
device
=
hid_device_create
(
&
mouse_vtbl
,
sizeof
(
struct
mouse_device
));
params
->
device
=
(
UINT_PTR
)
hid_device_create
(
&
mouse_vtbl
,
sizeof
(
struct
mouse_device
));
return
STATUS_SUCCESS
;
}
...
...
@@ -254,7 +254,7 @@ static NTSTATUS keyboard_device_create(void *args)
{
struct
device_create_params
*
params
=
args
;
params
->
desc
=
keyboard_device_desc
;
params
->
device
=
hid_device_create
(
&
keyboard_vtbl
,
sizeof
(
struct
keyboard_device
));
params
->
device
=
(
UINT_PTR
)
hid_device_create
(
&
keyboard_vtbl
,
sizeof
(
struct
keyboard_device
));
return
STATUS_SUCCESS
;
}
...
...
@@ -285,7 +285,8 @@ static ULONG unix_device_incref(struct unix_device *iface)
static
NTSTATUS
unix_device_remove
(
void
*
args
)
{
struct
unix_device
*
iface
=
args
;
struct
device_remove_params
*
params
=
args
;
struct
unix_device
*
iface
=
(
struct
unix_device
*
)(
UINT_PTR
)
params
->
device
;
iface
->
vtbl
->
stop
(
iface
);
unix_device_decref
(
iface
);
return
STATUS_SUCCESS
;
...
...
@@ -293,21 +294,22 @@ static NTSTATUS unix_device_remove(void *args)
static
NTSTATUS
unix_device_start
(
void
*
args
)
{
struct
unix_device
*
iface
=
args
;
struct
device_start_params
*
params
=
args
;
struct
unix_device
*
iface
=
(
struct
unix_device
*
)(
UINT_PTR
)
params
->
device
;
return
iface
->
vtbl
->
start
(
iface
);
}
static
NTSTATUS
unix_device_get_report_descriptor
(
void
*
args
)
{
struct
device_descriptor_params
*
params
=
args
;
struct
unix_device
*
iface
=
params
->
ifa
ce
;
struct
unix_device
*
iface
=
(
struct
unix_device
*
)(
UINT_PTR
)
params
->
devi
ce
;
return
iface
->
vtbl
->
get_report_descriptor
(
iface
,
params
->
buffer
,
params
->
length
,
params
->
out_length
);
}
static
NTSTATUS
unix_device_set_output_report
(
void
*
args
)
{
struct
device_report_params
*
params
=
args
;
struct
unix_device
*
iface
=
params
->
ifa
ce
;
struct
unix_device
*
iface
=
(
struct
unix_device
*
)(
UINT_PTR
)
params
->
devi
ce
;
iface
->
vtbl
->
set_output_report
(
iface
,
params
->
packet
,
params
->
io
);
return
STATUS_SUCCESS
;
}
...
...
@@ -315,7 +317,7 @@ static NTSTATUS unix_device_set_output_report(void *args)
static
NTSTATUS
unix_device_get_feature_report
(
void
*
args
)
{
struct
device_report_params
*
params
=
args
;
struct
unix_device
*
iface
=
params
->
ifa
ce
;
struct
unix_device
*
iface
=
(
struct
unix_device
*
)(
UINT_PTR
)
params
->
devi
ce
;
iface
->
vtbl
->
get_feature_report
(
iface
,
params
->
packet
,
params
->
io
);
return
STATUS_SUCCESS
;
}
...
...
@@ -323,7 +325,7 @@ static NTSTATUS unix_device_get_feature_report(void *args)
static
NTSTATUS
unix_device_set_feature_report
(
void
*
args
)
{
struct
device_report_params
*
params
=
args
;
struct
unix_device
*
iface
=
params
->
ifa
ce
;
struct
unix_device
*
iface
=
(
struct
unix_device
*
)(
UINT_PTR
)
params
->
devi
ce
;
iface
->
vtbl
->
set_feature_report
(
iface
,
params
->
packet
,
params
->
io
);
return
STATUS_SUCCESS
;
}
...
...
@@ -351,8 +353,9 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
void
bus_event_cleanup
(
struct
bus_event
*
event
)
{
struct
unix_device
*
iface
=
(
struct
unix_device
*
)(
UINT_PTR
)
event
->
device
;
if
(
event
->
type
==
BUS_EVENT_TYPE_NONE
)
return
;
unix_device_decref
(
event
->
devi
ce
);
unix_device_decref
(
ifa
ce
);
}
struct
bus_event_entry
...
...
@@ -386,7 +389,7 @@ BOOL bus_event_queue_device_removed(struct list *queue, struct unix_device *devi
}
entry
->
event
.
type
=
BUS_EVENT_TYPE_DEVICE_REMOVED
;
entry
->
event
.
device
=
device
;
entry
->
event
.
device
=
(
UINT_PTR
)
device
;
list_add_tail
(
queue
,
&
entry
->
entry
);
return
TRUE
;
...
...
@@ -405,7 +408,7 @@ BOOL bus_event_queue_device_created(struct list *queue, struct unix_device *devi
}
entry
->
event
.
type
=
BUS_EVENT_TYPE_DEVICE_CREATED
;
entry
->
event
.
device
=
device
;
entry
->
event
.
device
=
(
UINT_PTR
)
device
;
entry
->
event
.
device_created
.
desc
=
*
desc
;
list_add_tail
(
queue
,
&
entry
->
entry
);
...
...
@@ -425,7 +428,7 @@ BOOL bus_event_queue_input_report(struct list *queue, struct unix_device *device
}
entry
->
event
.
type
=
BUS_EVENT_TYPE_INPUT_REPORT
;
entry
->
event
.
device
=
device
;
entry
->
event
.
device
=
(
UINT_PTR
)
device
;
entry
->
event
.
input_report
.
length
=
length
;
memcpy
(
entry
->
event
.
input_report
.
buffer
,
report
,
length
);
list_add_tail
(
queue
,
&
entry
->
entry
);
...
...
dlls/winebus.sys/unixlib.h
View file @
077d64bd
...
...
@@ -64,8 +64,6 @@ struct iohid_bus_options
{
};
struct
unix_device
;
enum
bus_event_type
{
BUS_EVENT_TYPE_NONE
,
...
...
@@ -76,8 +74,8 @@ enum bus_event_type
struct
bus_event
{
enum
bus_event_type
type
;
struct
unix_device
*
device
;
UINT
type
;
UINT64
device
;
union
{
struct
...
...
@@ -96,12 +94,22 @@ struct bus_event
struct
device_create_params
{
struct
device_desc
desc
;
struct
unix_device
*
device
;
UINT64
device
;
};
struct
device_remove_params
{
UINT64
device
;
};
struct
device_start_params
{
UINT64
device
;
};
struct
device_descriptor_params
{
struct
unix_device
*
ifa
ce
;
UINT64
devi
ce
;
BYTE
*
buffer
;
UINT
length
;
UINT
*
out_length
;
...
...
@@ -109,7 +117,7 @@ struct device_descriptor_params
struct
device_report_params
{
struct
unix_device
*
ifa
ce
;
UINT64
devi
ce
;
HID_XFER_PACKET
*
packet
;
IO_STATUS_BLOCK
*
io
;
};
...
...
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