mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-03-29 07:57:59 -04:00
ucm: let rval_sysfs check the device/driver/module first
We plan to use the sound driver module's name for the top ucm's name, I checked it on 3 different ASoC machines, the device/driver links to machine driver while deice/driver/module links to the sound driver module, so change the code to readlink the device/driver/module first, if it fails then readlink the device/driver. This is the output from those 3 machines: $readlink /sys/class/sound/card0/device/driver ../../../../bus/platform/drivers/skl_hda_dsp_generic $readlink /sys/class/sound/card0/device/driver/module ../../../../module/snd_soc_skl_hda_dsp $readlink /sys/class/sound/card2/device/driver ../../../../../bus/platform/drivers/acp_pdm_mach $readlink /sys/class/sound/card2/device/driver/module ../../../../module/snd_acp3x_rn $readlink /sys/class/sound/card0/device/driver ../../../../bus/platform/drivers/sof_sdw $readlink /sys/class/sound/card0/device/driver/module ../../../../module/snd_soc_sof_sdw Signed-off-by: Hui Wang <hui.wang@canonical.com>
This commit is contained in:
parent
ed75249852
commit
3181a91190
1 changed files with 6 additions and 3 deletions
|
|
@ -202,9 +202,12 @@ static char *rval_sysfs(snd_use_case_mgr_t *uc_mgr ATTRIBUTE_UNUSED, const char
|
||||||
e = "/sys";
|
e = "/sys";
|
||||||
if (id[0] == '/')
|
if (id[0] == '/')
|
||||||
id++;
|
id++;
|
||||||
|
snprintf(path, sizeof(path), "%s/%s/%s", e, id, "module");
|
||||||
|
if (lstat(path, &sb) != 0) {
|
||||||
snprintf(path, sizeof(path), "%s/%s", e, id);
|
snprintf(path, sizeof(path), "%s/%s", e, id);
|
||||||
if (lstat(path, &sb) != 0)
|
if (lstat(path, &sb) != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
if (S_ISLNK(sb.st_mode)) {
|
if (S_ISLNK(sb.st_mode)) {
|
||||||
len = readlink(path, link, sizeof(link) - 1);
|
len = readlink(path, link, sizeof(link) - 1);
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue