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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
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
[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr">Hello,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 5 Oct 2024 at 20:11, Christos Margiolis <<a href="mailto:christos@freebsd.org">christos@freebsd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin: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 main<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/mixer5<br>
> <br>
> 6 mixers from 0 to 5. But now oss_sysinfo.nummixers is 7, it was 6 until<br>
> some months ago.<br>
> <br>
> I thought the new value could be the max index, in the case some mixers<br>
> are closed, example /dev/mixer0 /dev/mixer2 /dev/mixer5. But in this<br>
> case 'nummixers' should be 5 not 7.<br>
> <br>
> Maybe the hidden /dev/mixer is in the count (6 + 1 = 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 commit.</div><div> </div><blockquote class="gmail_quote" style="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 _next_ should be 6 not 7. Same on other 2 laptops.<br>Actually, I was referred to this change because I am receiving several<br>private emails for mixertui, when users run F6 can see a suddenly<br>extra pcm (unreal /dev/mixer<n+1>).</div><div> </div><div>Anyway, now it is not a problem, I am 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="gmail_quote" style="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 ones<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="https://cgit.freebsd.org/src/commit/?id=5d980fadf73df64a1e0eda40a93170ed76ce6f14" rel="noreferrer" target="_blank">https://cgit.freebsd.org/src/commit/?id=5d980fadf73df64a1e0eda40a93170ed76ce6f14</a></blockquote><div><br></div><div><br></div><div>OK.</div><div><br></div><div>Best regards,</div><div>Alfonso</div><div><br></div><div> </div></div></div>
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPJrGM2VO5bTRvumDO6pwJMK8yO2Xbjzt_cqpCmKewDV0OVVkQ>
