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
5d0d812d
Commit
5d0d812d
authored
Jun 27, 2022
by
Arkadiusz Hiler
Committed by
Alexandre Julliard
Jun 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winealsa.drv: Set device path for all devices.
Signed-off-by:
Arkadiusz Hiler
<
ahiler@codeweavers.com
>
parent
3180ed32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
41 deletions
+33
-41
alsa.c
dlls/winealsa.drv/alsa.c
+33
-41
No files found.
dlls/winealsa.drv/alsa.c
View file @
5d0d812d
...
...
@@ -2318,21 +2318,21 @@ static NTSTATUS get_prop_value(void *args)
if
(
IsEqualPropertyKey
(
*
prop
,
devicepath_key
))
{
enum
AudioDeviceConnectionType
connection
=
AudioDeviceConnectionType_Unknown
;
USHORT
vendor_id
=
0
,
product_id
=
0
;
char
uevent
[
MAX_PATH
];
FILE
*
fuevent
;
FILE
*
fuevent
=
NULL
;
int
card
,
device
;
UINT
serial_number
;
char
buf
[
128
];
int
len
;
/* only implemented for identifiable devices, i.e. not "default" */
if
(
!
sscanf
(
name
,
"plughw:%u,%u"
,
&
card
,
&
device
)){
params
->
result
=
E_NOTIMPL
;
return
STATUS_SUCCESS
;
if
(
sscanf
(
name
,
"plughw:%u,%u"
,
&
card
,
&
device
)){
sprintf
(
uevent
,
"/sys/class/sound/card%u/device/uevent"
,
card
);
fuevent
=
fopen
(
uevent
,
"r"
);
}
sprintf
(
uevent
,
"/sys/class/sound/card%u/device/uevent"
,
card
);
fuevent
=
fopen
(
uevent
,
"r"
);
if
(
fuevent
){
enum
AudioDeviceConnectionType
connection
=
AudioDeviceConnectionType_Unknown
;
USHORT
vendor_id
=
0
,
product_id
=
0
;
char
line
[
256
];
while
(
fgets
(
line
,
sizeof
(
line
),
fuevent
))
{
...
...
@@ -2365,41 +2365,33 @@ static NTSTATUS get_prop_value(void *args)
}
fclose
(
fuevent
);
}
if
(
connection
==
AudioDeviceConnectionType_USB
||
connection
==
AudioDeviceConnectionType_PCI
){
UINT
serial_number
;
char
buf
[
128
];
int
len
;
/* As hardly any audio devices have serial numbers, Windows instead
appears to use a persistent random number. We emulate this here
by instead using the last 8 hex digits of the GUID. */
serial_number
=
(
guid
->
Data4
[
4
]
<<
24
)
|
(
guid
->
Data4
[
5
]
<<
16
)
|
(
guid
->
Data4
[
6
]
<<
8
)
|
guid
->
Data4
[
7
];
if
(
connection
==
AudioDeviceConnectionType_USB
)
sprintf
(
buf
,
"{1}.USB
\\
VID_%04X&PID_%04X
\\
%u&%08X"
,
vendor_id
,
product_id
,
device
,
serial_number
);
else
/* AudioDeviceConnectionType_PCI */
sprintf
(
buf
,
"{1}.HDAUDIO
\\
FUNC_01&VEN_%04X&DEV_%04X
\\
%u&%08X"
,
vendor_id
,
product_id
,
device
,
serial_number
);
len
=
strlen
(
buf
)
+
1
;
if
(
*
params
->
buffer_size
<
len
*
sizeof
(
WCHAR
)){
params
->
result
=
E_NOT_SUFFICIENT_BUFFER
;
*
params
->
buffer_size
=
len
*
sizeof
(
WCHAR
);
return
STATUS_SUCCESS
;
}
out
->
vt
=
VT_LPWSTR
;
out
->
pwszVal
=
params
->
buffer
;
ntdll_umbstowcs
(
buf
,
len
,
out
->
pwszVal
,
len
);
params
->
result
=
S_OK
;
return
STATUS_SUCCESS
;
}
}
else
{
WARN
(
"Could not open %s for reading
\n
"
,
uevent
);
params
->
result
=
E_NOTIMPL
;
/* As hardly any audio devices have serial numbers, Windows instead
appears to use a persistent random number. We emulate this here
by instead using the last 8 hex digits of the GUID. */
serial_number
=
(
guid
->
Data4
[
4
]
<<
24
)
|
(
guid
->
Data4
[
5
]
<<
16
)
|
(
guid
->
Data4
[
6
]
<<
8
)
|
guid
->
Data4
[
7
];
if
(
connection
==
AudioDeviceConnectionType_USB
)
sprintf
(
buf
,
"{1}.USB
\\
VID_%04X&PID_%04X
\\
%u&%08X"
,
vendor_id
,
product_id
,
device
,
serial_number
);
else
if
(
connection
==
AudioDeviceConnectionType_PCI
)
sprintf
(
buf
,
"{1}.HDAUDIO
\\
FUNC_01&VEN_%04X&DEV_%04X
\\
%u&%08X"
,
vendor_id
,
product_id
,
device
,
serial_number
);
else
sprintf
(
buf
,
"{1}.ROOT
\\
MEDIA
\\
%04u"
,
serial_number
&
0x1FF
);
len
=
strlen
(
buf
)
+
1
;
if
(
*
params
->
buffer_size
<
len
*
sizeof
(
WCHAR
)){
params
->
result
=
E_NOT_SUFFICIENT_BUFFER
;
*
params
->
buffer_size
=
len
*
sizeof
(
WCHAR
);
return
STATUS_SUCCESS
;
}
out
->
vt
=
VT_LPWSTR
;
out
->
pwszVal
=
params
->
buffer
;
ntdll_umbstowcs
(
buf
,
len
,
out
->
pwszVal
,
len
);
params
->
result
=
S_OK
;
return
STATUS_SUCCESS
;
}
else
if
(
flow
!=
eCapture
&&
IsEqualPropertyKey
(
*
prop
,
PKEY_AudioEndpoint_PhysicalSpeakers
))
{
unsigned
int
num_speakers
,
card
,
device
;
char
hwname
[
255
];
...
...
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