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
9d4b7047
Commit
9d4b7047
authored
Sep 13, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebus.sys: Query manufacturer string on device creation.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e4f0b4ab
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
15 deletions
+38
-15
bus_iohid.c
dlls/winebus.sys/bus_iohid.c
+3
-3
bus_sdl.c
dlls/winebus.sys/bus_sdl.c
+1
-3
bus_udev.c
dlls/winebus.sys/bus_udev.c
+6
-8
main.c
dlls/winebus.sys/main.c
+24
-1
unixlib.c
dlls/winebus.sys/unixlib.c
+2
-0
unixlib.h
dlls/winebus.sys/unixlib.h
+2
-0
No files found.
dlls/winebus.sys/bus_iohid.c
View file @
9d4b7047
...
...
@@ -193,9 +193,6 @@ static NTSTATUS iohid_device_get_string(struct unix_device *iface, DWORD index,
case
HID_STRING_ID_IPRODUCT
:
str
=
IOHIDDeviceGetProperty
(
private
->
device
,
CFSTR
(
kIOHIDProductKey
));
break
;
case
HID_STRING_ID_IMANUFACTURER
:
str
=
IOHIDDeviceGetProperty
(
private
->
device
,
CFSTR
(
kIOHIDManufacturerKey
));
break
;
case
HID_STRING_ID_ISERIALNUMBER
:
str
=
IOHIDDeviceGetProperty
(
private
->
device
,
CFSTR
(
kIOHIDSerialNumberKey
));
break
;
...
...
@@ -313,6 +310,9 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void *
}
IOHIDDeviceScheduleWithRunLoop
(
IOHIDDevice
,
CFRunLoopGetCurrent
(),
kCFRunLoopDefaultMode
);
str
=
IOHIDDeviceGetProperty
(
IOHIDDevice
,
CFSTR
(
kIOHIDManufacturerKey
));
if
(
str
)
lstrcpynA
(
desc
.
manufacturer
,
str
,
sizeof
(
desc
.
manufacturer
));
if
(
IOHIDDeviceConformsTo
(
IOHIDDevice
,
kHIDPage_GenericDesktop
,
kHIDUsage_GD_GamePad
)
||
IOHIDDeviceConformsTo
(
IOHIDDevice
,
kHIDPage_GenericDesktop
,
kHIDUsage_GD_Joystick
))
{
...
...
dlls/winebus.sys/bus_sdl.c
View file @
9d4b7047
...
...
@@ -528,9 +528,6 @@ static NTSTATUS sdl_device_get_string(struct unix_device *iface, DWORD index, WC
else
str
=
pSDL_JoystickName
(
ext
->
sdl_joystick
);
break
;
case
HID_STRING_ID_IMANUFACTURER
:
str
=
"SDL"
;
break
;
case
HID_STRING_ID_ISERIALNUMBER
:
str
=
"000000"
;
break
;
...
...
@@ -739,6 +736,7 @@ static void sdl_add_device(unsigned int index)
.
busid
=
sdl_busidW
,
.
input
=
-
1
,
.
serial
=
{
'0'
,
'0'
,
'0'
,
'0'
,
0
},
.
manufacturer
=
{
"SDL"
},
};
struct
platform_private
*
private
;
char
guid_str
[
34
];
...
...
dlls/winebus.sys/bus_udev.c
View file @
9d4b7047
...
...
@@ -677,9 +677,6 @@ static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index,
case
HID_STRING_ID_IPRODUCT
:
str
=
get_sysattr_string
(
usbdev
,
"product"
);
break
;
case
HID_STRING_ID_IMANUFACTURER
:
str
=
get_sysattr_string
(
usbdev
,
"manufacturer"
);
break
;
case
HID_STRING_ID_ISERIALNUMBER
:
str
=
get_sysattr_string
(
usbdev
,
"serial"
);
break
;
...
...
@@ -702,8 +699,6 @@ static NTSTATUS hidraw_device_get_string(struct unix_device *iface, DWORD index,
str
=
strdupAtoW
(
buf
);
break
;
}
case
HID_STRING_ID_IMANUFACTURER
:
break
;
case
HID_STRING_ID_ISERIALNUMBER
:
break
;
default:
...
...
@@ -969,9 +964,6 @@ static NTSTATUS lnxev_device_get_string(struct unix_device *iface, DWORD index,
case
HID_STRING_ID_IPRODUCT
:
ioctl
(
ext
->
base
.
device_fd
,
EVIOCGNAME
(
sizeof
(
str
)),
str
);
break
;
case
HID_STRING_ID_IMANUFACTURER
:
strcpy
(
str
,
"evdev"
);
break
;
case
HID_STRING_ID_ISERIALNUMBER
:
ioctl
(
ext
->
base
.
device_fd
,
EVIOCGUNIQ
(
sizeof
(
str
)),
str
);
break
;
...
...
@@ -1088,6 +1080,9 @@ static void get_device_subsystem_info(struct udev_device *dev, char const *subsy
}
}
}
if
(
!
desc
->
manufacturer
[
0
]
&&
(
tmp
=
udev_device_get_sysattr_value
(
dev
,
"manufacturer"
)))
lstrcpynA
(
desc
->
manufacturer
,
tmp
,
sizeof
(
desc
->
manufacturer
));
}
static
void
udev_add_device
(
struct
udev_device
*
dev
)
...
...
@@ -1133,6 +1128,7 @@ static void udev_add_device(struct udev_device *dev)
if
(
!
strcmp
(
subsystem
,
"hidraw"
))
{
desc
.
busid
=
hidraw_busidW
;
if
(
!
desc
.
manufacturer
[
0
])
strcpy
(
desc
.
manufacturer
,
"hidraw"
);
}
#ifdef HAS_PROPER_INPUT_HEADER
else
if
(
!
strcmp
(
subsystem
,
"input"
))
...
...
@@ -1154,6 +1150,8 @@ static void udev_add_device(struct udev_device *dev)
device_uid
[
0
]
=
0
;
if
(
ioctl
(
fd
,
EVIOCGUNIQ
(
254
),
device_uid
)
>=
0
&&
device_uid
[
0
])
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
device_uid
,
-
1
,
desc
.
serial
,
ARRAY_SIZE
(
desc
.
serial
));
if
(
!
desc
.
manufacturer
[
0
])
strcpy
(
desc
.
manufacturer
,
"evdev"
);
}
#endif
...
...
dlls/winebus.sys/main.c
View file @
9d4b7047
...
...
@@ -111,6 +111,8 @@ struct device_extension
struct
device_desc
desc
;
DWORD
index
;
WCHAR
manufacturer
[
MAX_PATH
];
BYTE
*
last_report
;
DWORD
last_report_size
;
BOOL
last_report_read
;
...
...
@@ -364,6 +366,8 @@ static DEVICE_OBJECT *bus_create_hid_device(struct device_desc *desc, struct uni
ext
->
buffer_size
=
0
;
ext
->
unix_device
=
unix_device
;
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
ext
->
desc
.
manufacturer
,
-
1
,
ext
->
manufacturer
,
MAX_PATH
);
InitializeListHead
(
&
ext
->
irp_queue
);
InitializeCriticalSection
(
&
ext
->
cs
);
ext
->
cs
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": cs"
);
...
...
@@ -815,6 +819,23 @@ static NTSTATUS deliver_last_report(struct device_extension *ext, DWORD buffer_l
}
}
static
NTSTATUS
hid_get_device_string
(
DEVICE_OBJECT
*
device
,
DWORD
index
,
WCHAR
*
buffer
,
DWORD
buffer_len
)
{
struct
device_extension
*
ext
=
(
struct
device_extension
*
)
device
->
DeviceExtension
;
DWORD
len
;
switch
(
index
)
{
case
HID_STRING_ID_IMANUFACTURER
:
len
=
(
strlenW
(
ext
->
manufacturer
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
len
>
buffer_len
)
return
STATUS_BUFFER_TOO_SMALL
;
else
memcpy
(
buffer
,
ext
->
manufacturer
,
len
);
return
STATUS_SUCCESS
;
}
return
STATUS_NOT_IMPLEMENTED
;
}
static
NTSTATUS
WINAPI
hid_internal_dispatch
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
IO_STACK_LOCATION
*
irpsp
=
IoGetCurrentIrpStackLocation
(
irp
);
...
...
@@ -906,7 +927,9 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
DWORD
index
=
(
ULONG_PTR
)
irpsp
->
Parameters
.
DeviceIoControl
.
Type3InputBuffer
;
TRACE
(
"IOCTL_HID_GET_STRING[%08x]
\n
"
,
index
);
irp
->
IoStatus
.
Status
=
unix_device_get_string
(
device
,
index
,
(
WCHAR
*
)
irp
->
UserBuffer
,
buffer_len
/
sizeof
(
WCHAR
));
irp
->
IoStatus
.
Status
=
hid_get_device_string
(
device
,
index
,
(
WCHAR
*
)
irp
->
UserBuffer
,
buffer_len
);
if
(
irp
->
IoStatus
.
Status
!=
STATUS_SUCCESS
)
irp
->
IoStatus
.
Status
=
unix_device_get_string
(
device
,
index
,
(
WCHAR
*
)
irp
->
UserBuffer
,
buffer_len
/
sizeof
(
WCHAR
));
if
(
irp
->
IoStatus
.
Status
==
STATUS_SUCCESS
)
irp
->
IoStatus
.
Information
=
(
strlenW
((
WCHAR
*
)
irp
->
UserBuffer
)
+
1
)
*
sizeof
(
WCHAR
);
break
;
...
...
dlls/winebus.sys/unixlib.c
View file @
9d4b7047
...
...
@@ -119,6 +119,7 @@ static const struct device_desc mouse_device_desc =
.
busid
=
mouse_bus_id
,
.
input
=
-
1
,
.
serial
=
{
'0'
,
'0'
,
'0'
,
'0'
,
0
},
.
manufacturer
=
{
"The Wine Project"
},
};
static
struct
unix_device
mouse_device
=
{.
vtbl
=
&
mouse_vtbl
};
...
...
@@ -212,6 +213,7 @@ static const struct device_desc keyboard_device_desc =
.
busid
=
keyboard_bus_id
,
.
input
=
-
1
,
.
serial
=
{
'0'
,
'0'
,
'0'
,
'0'
,
0
},
.
manufacturer
=
{
"The Wine Project"
},
};
static
struct
unix_device
keyboard_device
=
{.
vtbl
=
&
keyboard_vtbl
};
...
...
dlls/winebus.sys/unixlib.h
View file @
9d4b7047
...
...
@@ -42,6 +42,8 @@ struct device_desc
DWORD
uid
;
WCHAR
serial
[
256
];
BOOL
is_gamepad
;
char
manufacturer
[
MAX_PATH
];
};
struct
sdl_bus_options
...
...
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