Date: Sat, 5 Oct 2024 21:52:58 +0200 From: Alfonso Sabato Siciliano <alfix86@gmail.com> To: Christos Margiolis <christos@freebsd.org> Cc: multimedia@freebsd.org Subject: Re: New meaning oss_sysinfo.nummixers Message-ID: <CAPJrGM2VO5bTRvumDO6pwJMK8yO2Xbjzt_cqpCmKewDV0OVVkQ@mail.gmail.com> In-Reply-To: <phsdnmvoyjlxyrqr73djj4id3znciifyygvt6tr7racrw3ruq7@xq4gex3jmts3> References: <CAPJrGM0-ptpwZg8nB1MMJhbUr2tMuTG=Tnagce8UXQJjp2nDyw@mail.gmail.com> <phsdnmvoyjlxyrqr73djj4id3znciifyygvt6tr7racrw3ruq7@xq4gex3jmts3>
next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000ebde200623c020b7 Content-Type: text/plain; charset="UTF-8" Hello, On Sat, 5 Oct 2024 at 20:11, Christos Margiolis <christos@freebsd.org> wrote: > Hello Alfonso, > > Alfonso Sabato Siciliano wrote: > > I was inactive for months, one week ago I reinstalled CURRENT on my main > > laptop (and others). The meaning of "struct oss_sysinfo.nummixers" > > changed. Let's say: > > > > [...] > > > > Output "nummixers: 7", But > > > > % sysctl dev.pcm > > ... prints 6 devices dev.pcm.[0-5].* > > > > % ls /dev/mixer* > > /dev/mixer0 /dev/mixer1 /dev/mixer2 /dev/mixer3 /dev/mixer4 /dev/mixer5 > > > > 6 mixers from 0 to 5. But now oss_sysinfo.nummixers is 7, it was 6 until > > some months ago. > > > > I thought the new value could be the max index, in the case some mixers > > are closed, example /dev/mixer0 /dev/mixer2 /dev/mixer5. But in this > > case 'nummixers' should be 5 not 7. > > > > Maybe the hidden /dev/mixer is in the count (6 + 1 = 7). > > > > Same situation on 3 laptops. So, what is the new meaning for > > oss_sysinfo.nummixers? > > The behavior changed in the following commit of mine: 5d980fadf73d > ("sound: Handle unavailable devices in various OSS IOCTLs") [1]. > The commit message explains the rationale behind changing this > behavior. I am aware it's a bit quite unintuitive, but it solves quite a > few bugs we have with people using nummixers to loop through mixer > devices, which I suppose is the most typical use. > > Ok, I understood the point of the commit. > oss_sysinfo.nummixers now is simply populated with whatever > devclass_get_maxunit(pcm_devclass) returns, which should be the _next_ > maximum unit number that will be allocated for an audio device, hence > the 7 you get (this is how devclass_get_maxunit() works in general). > > Here is my doubt, (probably) I don't understand "_next_ maximum unit number", in this case my _next_ should be 6 not 7. Same on other 2 laptops. Actually, I was referred to this change because I am receiving several private emails for mixertui, when users run F6 can see a suddenly extra pcm (unreal /dev/mixer<n+1>). Anyway, now it is not a problem, I am going to handle it in userspace. I'll take a look at devclass_get_maxunit() in the future. Although a bit tedious, you can count the actual number of mixers in the > system by issuing open(2) for each /dev/mixer<n> and seeing which ones > succeed. This way you know the total number, but also which mixers > specifically are present. > > Christos > > [1] > https://cgit.freebsd.org/src/commit/?id=5d980fadf73df64a1e0eda40a93170ed76ce6f14 OK. Best regards, Alfonso --000000000000ebde200623c020b7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">Hello,<br></div><br><div class=3D"gmail_q= uote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, 5 Oct 2024 at 20:11, Ch= ristos Margiolis <<a href=3D"mailto:christos@freebsd.org">christos@freeb= sd.org</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"m= argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left= :1ex">Hello Alfonso,<br> <br> Alfonso Sabato Siciliano wrote:<br> > I was inactive for months, one week ago I reinstalled CURRENT on my ma= in<br> > laptop (and others). The meaning of "struct oss_sysinfo.nummixers= "<br> > changed. Let's say:<br> > <br> > [...]<br> > <br> > Output "nummixers: 7", But<br> > <br> > % sysctl dev.pcm<br> > ... prints 6 devices dev.pcm.[0-5].*<br> > <br> > % ls /dev/mixer*<br> > /dev/mixer0 /dev/mixer1 /dev/mixer2 /dev/mixer3 /dev/mixer4 /dev/mixer= 5<br> > <br> > 6 mixers from 0 to 5. But now oss_sysinfo.nummixers is 7, it was 6 unt= il<br> > some months ago.<br> > <br> > I thought the new value could be the max index, in the case some mixer= s<br> > are closed, example /dev/mixer0 /dev/mixer2 /dev/mixer5. But in this<b= r> > case 'nummixers' should be 5 not 7.<br> > <br> > Maybe the hidden /dev/mixer is in the count (6 + 1 =3D 7).<br> > <br> > Same situation on 3 laptops. So, what is the new meaning for<br> > oss_sysinfo.nummixers?<br> <br> The behavior changed in the following commit of mine: 5d980fadf73d<br> ("sound: Handle unavailable devices in various OSS IOCTLs") [1].<= br> The commit message explains the rationale behind changing this<br> behavior. I am aware it's a bit quite unintuitive, but it solves quite = a<br> few bugs we have with people using nummixers to loop through mixer<br> devices, which I suppose is the most typical use.<br> <br></blockquote><div><br></div><div>Ok, I understood the point of the comm= it.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin= :0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"= > oss_sysinfo.nummixers now is simply populated with whatever<br> devclass_get_maxunit(pcm_devclass) returns, which should be the _next_<br> maximum unit number that will be allocated for an audio device, hence<br> the 7 you get (this is how devclass_get_maxunit() works in general).<br> <br></blockquote><div><br></div><div>Here is my doubt, (probably) I don'= ;t understand "_next_ maximum unit<br>number", in this case my _n= ext_ should be 6 not 7. Same on other 2 laptops.<br>Actually, I was referre= d to this change because I am receiving several<br>private emails for mixer= tui, when users run F6 can see a suddenly<br>extra pcm (unreal /dev/mixer&l= t;n+1>).</div><div>=C2=A0</div><div>Anyway, now it is not a problem, I a= m going to handle it in userspace.<br>I'll take a look at devclass_get_= maxunit() in the future.</div><div><br></div><blockquote class=3D"gmail_quo= te" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204= );padding-left:1ex"> Although a bit tedious, you can count the actual number of mixers in the<br= > system by issuing open(2) for each /dev/mixer<n> and seeing which one= s<br> succeed. This way you know the total number, but also which mixers<br> specifically are present.<br> <br> Christos<br> <br> [1] <a href=3D"https://cgit.freebsd.org/src/commit/?id=3D5d980fadf73df64a1e= 0eda40a93170ed76ce6f14" rel=3D"noreferrer" target=3D"_blank">https://cgit.f= reebsd.org/src/commit/?id=3D5d980fadf73df64a1e0eda40a93170ed76ce6f14</a></b= lockquote><div><br></div><div><br></div><div>OK.</div><div><br></div><div>B= est regards,</div><div>Alfonso</div><div><br></div><div>=C2=A0</div></div><= /div> --000000000000ebde200623c020b7--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPJrGM2VO5bTRvumDO6pwJMK8yO2Xbjzt_cqpCmKewDV0OVVkQ>