* [PATCH] ALSA: usb-audio: ignore broken processing/extension unit
@ 2020-08-16 21:28 tom.ty89
2020-08-17 6:32 ` [ALSA patch] " Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: tom.ty89 @ 2020-08-16 21:28 UTC (permalink / raw)
To: patch; +Cc: alsa-devel, Tom Yan
From: Tom Yan <tom.ty89@gmail.com>
Some devices have broken extension unit where getting current value doesn't work. Attempt that once when creating mixer control for it. If it fails, just ignore it, so that it won't cripple the device entirely (and/or make the error floods).
---
sound/usb/mixer.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index eab0fd4fd7c3..e0b7174c1043 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2367,7 +2367,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
int num_ins;
struct usb_mixer_elem_info *cval;
struct snd_kcontrol *kctl;
- int i, err, nameid, type, len;
+ int i, err, nameid, type, len, val;
const struct procunit_info *info;
const struct procunit_value_info *valinfo;
const struct usbmix_name_map *map;
@@ -2470,6 +2470,12 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
break;
}
+ err = get_cur_ctl_value(cval, cval->control << 8, &val);
+ if (err < 0) {
+ usb_mixer_elem_info_free(cval);
+ return -EINVAL;
+ }
+
kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
if (!kctl) {
usb_mixer_elem_info_free(cval);
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [ALSA patch] [PATCH] ALSA: usb-audio: ignore broken processing/extension unit
2020-08-16 21:28 [PATCH] ALSA: usb-audio: ignore broken processing/extension unit tom.ty89
@ 2020-08-17 6:32 ` Takashi Iwai
0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-08-17 6:32 UTC (permalink / raw)
To: tom.ty89; +Cc: alsa-devel
On Sun, 16 Aug 2020 23:28:11 +0200,
tom.ty89@gmail.com wrote:
>
> From: Tom Yan <tom.ty89@gmail.com>
>
> Some devices have broken extension unit where getting current value doesn't work. Attempt that once when creating mixer control for it. If it fails, just ignore it, so that it won't cripple the device entirely (and/or make the error floods).
Could you give your Signed-off-by line? It's mandatory for merging to
the upstream.
thanks,
Takashi
> ---
> sound/usb/mixer.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> index eab0fd4fd7c3..e0b7174c1043 100644
> --- a/sound/usb/mixer.c
> +++ b/sound/usb/mixer.c
> @@ -2367,7 +2367,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
> int num_ins;
> struct usb_mixer_elem_info *cval;
> struct snd_kcontrol *kctl;
> - int i, err, nameid, type, len;
> + int i, err, nameid, type, len, val;
> const struct procunit_info *info;
> const struct procunit_value_info *valinfo;
> const struct usbmix_name_map *map;
> @@ -2470,6 +2470,12 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
> break;
> }
>
> + err = get_cur_ctl_value(cval, cval->control << 8, &val);
> + if (err < 0) {
> + usb_mixer_elem_info_free(cval);
> + return -EINVAL;
> + }
> +
> kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
> if (!kctl) {
> usb_mixer_elem_info_free(cval);
> --
> 2.28.0
>
> _______________________________________________
> Patch mailing list
> Patch@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/patch
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA: usb-audio: ignore broken processing/extension unit
2020-08-17 17:20 tom.ty89
@ 2020-10-07 13:35 ` Alex Volkov
0 siblings, 0 replies; 5+ messages in thread
From: Alex Volkov @ 2020-10-07 13:35 UTC (permalink / raw)
To: tom.ty89; +Cc: alsa-devel, patch
This patch breaks the creation of the "Clock rate Selector" mixer unit in E-MU
Tracker Pre USB audio interface. If the 'snd-usb-audio' module still has not
been loaded when the device gets switched on, the module autoloads and
everything works:
$ cat /proc/asound/USB/usbmixer
USB Mixer: usb_id=0x041e3f0a, ctrlif=0, ctlerr=0
Card: E-MU Systems, Inc. E-MU Tracker Pre | USB at usb-0000:00:14.0-13, high
speed
Unit: 4
Control: name="PCM Playback Volume", index=0
Info: id=4, control=2, cmask=0x3, channels=2, type="S16"
Volume: min=-25600, max=0, dBmin=-10000, dBmax=0
Unit: 4
Control: name="PCM Playback Switch", index=0
Info: id=4, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
Volume: min=0, max=1, dBmin=0, dBmax=0
Unit: 12
Control: name="Clock rate Selector", index=0
Info: id=12, control=3, cmask=0x0, channels=1, type="U8"
Volume: min=0, max=5, dBmin=0, dBmax=0
BUT! If the device gets switched off and back on when the module is still
loaded, the control never gets created:
(after I power cycled the device)
$ cat /proc/asound/USB/usbmixer
USB Mixer: usb_id=0x041e3f0a, ctrlif=0, ctlerr=0
Card: E-MU Systems, Inc. E-MU Tracker Pre | USB at usb-0000:00:14.0-13, high
speed
Unit: 4
Control: name="PCM Playback Volume", index=0
Info: id=4, control=2, cmask=0x3, channels=2, type="S16"
Volume: min=-25600, max=0, dBmin=-10000, dBmax=0
Unit: 4
Control: name="PCM Playback Switch", index=0
Info: id=4, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
Volume: min=0, max=1, dBmin=0, dBmax=0
Accordingly, the device stays at the default Clock rate with no way to change
it. Probably, there's some timing issue in the initialization of the device /
the loading of the module, but I honestly couldn't care less as long as this
patch breaks my setup.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ALSA: usb-audio: ignore broken processing/extension unit
@ 2020-08-17 17:20 tom.ty89
2020-10-07 13:35 ` Alex Volkov
0 siblings, 1 reply; 5+ messages in thread
From: tom.ty89 @ 2020-08-17 17:20 UTC (permalink / raw)
To: patch; +Cc: alsa-devel, Tom Yan
From: Tom Yan <tom.ty89@gmail.com>
Some devices have broken extension unit where getting current value doesn't work. Attempt that once when creating mixer control for it. If it fails, just ignore it, so that it won't cripple the device entirely (and/or make the error floods).
Signed-off-by: Tom Yan <tom.ty89@gmail.com>
---
sound/usb/mixer.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index eab0fd4fd7c3..e0b7174c1043 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2367,7 +2367,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
int num_ins;
struct usb_mixer_elem_info *cval;
struct snd_kcontrol *kctl;
- int i, err, nameid, type, len;
+ int i, err, nameid, type, len, val;
const struct procunit_info *info;
const struct procunit_value_info *valinfo;
const struct usbmix_name_map *map;
@@ -2470,6 +2470,12 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
break;
}
+ err = get_cur_ctl_value(cval, cval->control << 8, &val);
+ if (err < 0) {
+ usb_mixer_elem_info_free(cval);
+ return -EINVAL;
+ }
+
kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
if (!kctl) {
usb_mixer_elem_info_free(cval);
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] ALSA: usb-audio: ignore broken processing/extension unit
@ 2020-08-13 12:12 tom.ty89
0 siblings, 0 replies; 5+ messages in thread
From: tom.ty89 @ 2020-08-13 12:12 UTC (permalink / raw)
To: patch; +Cc: alsa-devel, Tom Yan
From: Tom Yan <tom.ty89@gmail.com>
Some devices have broken extension unit where getting current value doesn't work. Attempt that once when creating mixer control for it. If it fails, just ignore it, so that it won't cripple the device entirely (and/or make the error floods).
---
sound/usb/mixer.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index eab0fd4fd7c3..e0b7174c1043 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2367,7 +2367,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
int num_ins;
struct usb_mixer_elem_info *cval;
struct snd_kcontrol *kctl;
- int i, err, nameid, type, len;
+ int i, err, nameid, type, len, val;
const struct procunit_info *info;
const struct procunit_value_info *valinfo;
const struct usbmix_name_map *map;
@@ -2470,6 +2470,12 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
break;
}
+ err = get_cur_ctl_value(cval, cval->control << 8, &val);
+ if (err < 0) {
+ usb_mixer_elem_info_free(cval);
+ return -EINVAL;
+ }
+
kctl = snd_ctl_new1(&mixer_procunit_ctl, cval);
if (!kctl) {
usb_mixer_elem_info_free(cval);
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-07 16:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-16 21:28 [PATCH] ALSA: usb-audio: ignore broken processing/extension unit tom.ty89
2020-08-17 6:32 ` [ALSA patch] " Takashi Iwai
-- strict thread matches above, loose matches on Subject: below --
2020-08-17 17:20 tom.ty89
2020-10-07 13:35 ` Alex Volkov
2020-08-13 12:12 tom.ty89
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.