@@ -4215,6 +4215,37 @@ static void snd_dragonfly_quirk_db_scale(struct usb_mixer_interface *mixer,
}
}
+static void snd_fix_plt_control_name(struct snd_kcontrol *kctl)
+{
+ static const char * const names_to_remove[] = {
+ "Earphone",
+ "Microphone",
+ "Receive",
+ "Transmit",
+ NULL
+ };
+ const char * const *n2r;
+ char *dst, *src;
+ size_t len;
+
+ for (n2r = names_to_remove; *n2r; ++n2r) {
+ dst = strstr(kctl->id.name, *n2r);
+ if (dst) {
+ src = dst + strlen(*n2r);
+ len = strlen(src) + 1;
+ if ((char *)kctl->id.name != dst && *(dst - 1) == ' ')
+ --dst;
+ memmove(dst, src, len);
+ }
+ }
+ if (kctl->id.name[0] == ' ') {
+ char rcat[sizeof(kctl->id.name)] = { "Headset" };
+
+ strlcat(rcat, kctl->id.name, sizeof(rcat));
+ strscpy(kctl->id.name, rcat, sizeof(kctl->id.name));
+ }
+}
+
void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
struct usb_mixer_elem_info *cval, int unitid,
struct snd_kcontrol *kctl)
@@ -4232,5 +4263,9 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
cval->min_mute = 1;
break;
}
+
+ /* ALSA-ify some Plantronics headset control names */
+ if (USB_ID_VENDOR(mixer->chip->usb_id) == 0x047f)
+ snd_fix_plt_control_name(kctl);
}
Many Poly/Plantronics headset families name the feature, input, and/or output units in a such a way to produce control names that are not recognized by user space. As such, the volume and mute events do not get routed to the headset's audio controls. As an example from a product family: The microphone mute control is named Headset Microphone Capture Switch and the headset volume control is named Headset Earphone Playback Volume The quirk fixes these to become Headset Capture Switch Headset Playback Volume Signed-off-by: Terry Junge <linuxhid@cosmicgizmosystems.com> --- sound/usb/mixer_quirks.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)