Subject: Re: eap(4) mixer increment/decrement
To: None <tech-kern@netbsd.org>
From: Rui Paulo <rpaulo@fnop.net>
List: tech-kern
Date: 06/10/2006 16:34:18
At Sat, 10 Jun 2006 14:02:02 +0000 (UTC),
Martijn van Buul wrote:
> 
> It occurred to me that Rui Paulo wrote in gmane.os.netbsd.devel.kernel:
> > Hi,
> > I have an eap 1370 and I'm trying to figure out how to make 
> > ``mixerctl <var>++'' work correctly:
> >
> > % mixerctl -w inputs.dac++                                                  [~]
> > inputs.dac: 200,200 -> 200,200
> > % mixerctl -w inputs.dac+=8                                              [~]
> > inputs.dac: 200,200 -> 208,208
> > % mixerctl -w inputs.dac--                                                  [~]
> > inputs.dac: 208,208 -> 200,200
> 
> It looks like this particular mixer input has a delta (min. step size) of 8,
> but the driver mis-reports it as having a delta of 8. See man mixerctl.
> 
> On my (auich) soundcard, mixerctl -w inputs.dac++ works as expected:
> 
> % mixerctl -w inputs.dac++
> inputs.dac: 199,199 -> 207,207
> % mixerctl -w inputs.dac--
> inputs.dac: 207,207 -> 199,199
> 
> On my system, I also get
> 
> % mixerctl -v inputs.dac
> inputs.dac=199,199 volume delta=8
> 
> I think the eap driver misreports this 'delta'. 

Amazing. Before writing this email I thought about a similar
scheme.. We'll here's the patch. I'm not sure if this is correct
because I only own this card, but someone with a eap can try ?

Index: sys/dev/pci/eap.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/eap.c,v
retrieving revision 1.82
diff -u -p -r1.82 eap.c
--- sys/dev/pci/eap.c	10 Jun 2006 12:29:39 -0000	1.82
+++ sys/dev/pci/eap.c	10 Jun 2006 15:33:07 -0000
@@ -1648,6 +1648,7 @@ eap1370_query_devinfo(void *addr, mixer_
 		dip->prev = dip->next = AUDIO_MIXER_LAST;
 		strcpy(dip->label.name, AudioNmaster);
 		dip->un.v.num_channels = 2;
+		dip->un.v.delta = 8;
 		strcpy(dip->un.v.units.name, AudioNvolume);
 		return 0;
 	case EAP_VOICE_VOL:
@@ -1657,6 +1658,7 @@ eap1370_query_devinfo(void *addr, mixer_
 		dip->next = AUDIO_MIXER_LAST;
 		strcpy(dip->label.name, AudioNdac);
 		dip->un.v.num_channels = 2;
+		dip->un.v.delta = 8;
 		strcpy(dip->un.v.units.name, AudioNvolume);
 		return 0;
 	case EAP_FM_VOL:
@@ -1666,6 +1668,7 @@ eap1370_query_devinfo(void *addr, mixer_
 		dip->next = AUDIO_MIXER_LAST;
 		strcpy(dip->label.name, AudioNfmsynth);
 		dip->un.v.num_channels = 2;
+		dip->un.v.delta = 8;
 		strcpy(dip->un.v.units.name, AudioNvolume);
 		return 0;
 	case EAP_CD_VOL:
@@ -1675,6 +1678,7 @@ eap1370_query_devinfo(void *addr, mixer_
 		dip->next = AUDIO_MIXER_LAST;
 		strcpy(dip->label.name, AudioNcd);
 		dip->un.v.num_channels = 2;
+		dip->un.v.delta = 8;
 		strcpy(dip->un.v.units.name, AudioNvolume);
 		return 0;
 	case EAP_LINE_VOL:
@@ -1684,6 +1688,7 @@ eap1370_query_devinfo(void *addr, mixer_
 		dip->next = AUDIO_MIXER_LAST;
 		strcpy(dip->label.name, AudioNline);
 		dip->un.v.num_channels = 2;
+		dip->un.v.delta = 8;
 		strcpy(dip->un.v.units.name, AudioNvolume);
 		return 0;
 	case EAP_AUX_VOL:
@@ -1693,6 +1698,7 @@ eap1370_query_devinfo(void *addr, mixer_
 		dip->next = AUDIO_MIXER_LAST;
 		strcpy(dip->label.name, AudioNaux);
 		dip->un.v.num_channels = 2;
+		dip->un.v.delta = 8;
 		strcpy(dip->un.v.units.name, AudioNvolume);
 		return 0;
 	case EAP_MIC_VOL:
@@ -1702,6 +1708,7 @@ eap1370_query_devinfo(void *addr, mixer_
 		dip->next = EAP_MIC_PREAMP;
 		strcpy(dip->label.name, AudioNmicrophone);
 		dip->un.v.num_channels = 1;
+		dip->un.v.delta = 8;
 		strcpy(dip->un.v.units.name, AudioNvolume);
 		return 0;
 	case EAP_RECORD_SOURCE: