Re: New meaning oss_sysinfo.nummixers
- Reply: Alfonso Sabato Siciliano : "Re: New meaning oss_sysinfo.nummixers"
- In reply to: Alfonso Sabato Siciliano : "New meaning oss_sysinfo.nummixers"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 05 Oct 2024 18:11:26 UTC
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. 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). 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