From nobody Sat Oct 05 18:11:26 2024 X-Original-To: multimedia@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XLYQD1hF2z5Yf5k for ; Sat, 05 Oct 2024 18:11:32 +0000 (UTC) (envelope-from christos@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XLYQC6tGrz4R3h; Sat, 5 Oct 2024 18:11:31 +0000 (UTC) (envelope-from christos@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728151892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iVFpQuLGqJJNSf3/C+MNCRmI0eiGMIddnvstEOGAr+c=; b=r7oSmj6fAamtwpBjS9oj0MuWP2hRXlosBbswZh5pwCbVGq2iqwJ4cTgSY/4DFIjB9z6LAt BCVvwFkQffIsyB/ePHBkwDoqGpupRzszq8Vjw/p27MBL+2n1chNH5uTgn2NCkoT4MkO/As B5KN8c4Jn3RDgETQ8YMCo7diWbgXQ9q+qUjPufmjNz+BPbxU4uuxcI0+Sy2z8YXHugnPyE lC3YW34W1Zp77gEyT2voU2rxoHT3QUbmOtFK330pNHWVbEXrYXCwGSURRh/0E4muXJR36U unesa5Q8x2laNcKxrfDiobSV2HA1sQx29Bn1IbvoOEa2OUbFOQzimDOyOP84vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728151892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iVFpQuLGqJJNSf3/C+MNCRmI0eiGMIddnvstEOGAr+c=; b=n8jnqq19AdwxWAmrpG0oVQPlgNzzqR2AlVkCHIYKUqzRmKNLoFYwBFfbNpHTytlxqM6xP1 Y1njTI6tSCRm7HSyR6z8oyMfyk63l6yp3AYPPz7o89MWe3324AfjjYIrF6Plnfx5fKS4bl +3hc4t9KU0ZANOgrG6lH4dpgXfw6PcpcB7AsP25cTgzyU4l/ZTyU1Gzu+rOEqcgUxnZm+w DZ5s0paddofpH8xc1C8oxsJXEGh5qxEwHES9eb2LxfeYMDGxAa2zS3Cx9/EvTaomvvEL8c xr7WLX3HV+keQjMtxYDkU0C1k1RdoqeKATWMfV2tx4tzzFBGWRQ6fU3jwsAJpQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728151892; a=rsa-sha256; cv=none; b=fk589H1y70zByri5ACFIXfX6si+xT9Yd7i+2xR7L40tYxjEY71+s7nbiKm1vwpgOe3yVqf t8nbBcdX5/e5qN8cLIW1Gs0lifMokfZEObD8X+kHGze7v41dzMVvUspcB4kdM7tWdAmMA+ mW+i/yy4I/FPthKszYe6cnu0yT3H2W5QxtFUVotTDp18kYnayIBQbPRz4xmmSiKs4r8QTo xH4Yy8K3jH+hnjNUjfE5KY8DMqhCQsK70u2OJETIxuGAheVVbORBIjm+EF4NQ7IvOrQNnO 1UWoYRVTO1HKY45PuZMDHA84SxzPs1CFAqUa3Nm7tgJcSY8uZJThGiIOvQN4iA== Received: from margiolis.net (mail.margiolis.net [95.179.159.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) (Authenticated sender: christos/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4XLYQC46q6z1CVT; Sat, 5 Oct 2024 18:11:31 +0000 (UTC) (envelope-from christos@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=mail; bh=RCGOpSA1rU4qRfi G+D0fuPbvda4T9h33FVCX5Q4NY0Q=; h=in-reply-to:references:subject:cc:to: from:date; d=margiolis.net; b=J6T2W6LTUzxWB+JIsbuYjNe/gV8gw/qbUe792ws2 6ao+uGK0QAtQIrL8mcyl9JV/PjSNk4YDhLoQyrdYUcTfLNzms6iTyU3QOErwN+lKTsrk5E 0igKwBj/0is+d7bVwpYKyoqdIHDwxKWIATWYRcRCNSpqYIWW+PQCzdnqebuyA= Received: from tpad (31-217-175-193.cgn.acro.cosmote.net [31.217.175.193]) by margiolis.net (OpenSMTPD) with ESMTPSA id a5d91efd (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Sat, 5 Oct 2024 18:11:28 +0000 (UTC) Date: Sat, 5 Oct 2024 21:11:26 +0300 From: Christos Margiolis To: Alfonso Sabato Siciliano Cc: multimedia@freebsd.org Subject: Re: New meaning oss_sysinfo.nummixers Message-ID: References: List-Id: Multimedia discussions List-Archive: https://lists.freebsd.org/archives/freebsd-multimedia List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-multimedia@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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