[Bug 277615] /usr/sbin/mixer -a does not display all mixer devices if /dev/mixer0 happens to not exist.

2024-05-25 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277615

--- Comment #4 from commit-h...@freebsd.org ---
A commit in branch stable/14 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=cd254b9243d3d0f4d86b388f919dc744086fb002

commit cd254b9243d3d0f4d86b388f919dc744086fb002
Author: Christos Margiolis 
AuthorDate: 2024-05-23 00:57:25 +
Commit: Christos Margiolis 
CommitDate: 2024-05-25 19:30:49 +

mixer(8): Ignore mixer_open() failures for the -a option

The most likely reason mixer_open() will fail is because either the
device doesn't exist, or because it is disabled, so there is not reason
to kill the application. Instead, continue and print the rest of the
enabled mixers.

PR: 277615
Sponsored by:   The FreeBSD Foundation
MFC after:  1 day
Reviewed by:dev_submerge.ch
Differential Revision:  https://reviews.freebsd.org/D45151

(cherry picked from commit 0e80798518be673bdad7245b627cb5bd7ec0)

 usr.sbin/mixer/mixer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.


[Bug 277615] /usr/sbin/mixer -a does not display all mixer devices if /dev/mixer0 happens to not exist.

2024-05-25 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277615

--- Comment #3 from commit-h...@freebsd.org ---
A commit in branch stable/14 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=ab7c89415462567665c36628137375847fbff590

commit ab7c89415462567665c36628137375847fbff590
Author: Christos Margiolis 
AuthorDate: 2024-05-23 00:57:17 +
Commit: Christos Margiolis 
CommitDate: 2024-05-25 19:30:40 +

sound: Handle unavailable devices in various OSS IOCTLs

mixer(8)'s -a option is used to print information about all mixer
devices in the system. To do this, it loops from 0 to
mixer_get_nmixers(), and tries to open "/dev/mixer%d". However, this
approach doesn't work when there are disabled/unregistered mixers in the
system, or when an audio device simply doesn't have a mixer.

mixer_get_nmixers() calls SNDCTL_SYSINFO and returns
oss_sysinfo->nummixers, whose value is the number of currently _enabled_
mixers only. Taking the bug report mentioned below (277615) as an
example, suppose a system with 8 mixer devices total, but 3 of them are
either disabled or non-existent, which means they will not show up under
/dev, meaning we have 5 enabled mixer devices, which is also what the
value of oss_sysinfo->nummixers will be. What mixer(8) will do is loop
from 0 to 5 (instead of 8), and start calling mixer_open() on
/dev/mixer0, up to /dev/mixer4, and as is expected, the first call will
fail right away, hence the error shown in the bug report.

To fix this, modify oss_sysinfo->nummixers to hold the value of the
maximum unit in the system, which, although not necessarily "correct",
is more intuitive for applications that will want to use this value to
loop through all mixer devices.

Additionally, notify applications that a device is
unavailable/unregistered instead of skipping it. The current
implementations of SNDCTL_AUDIOINFO, SNDCTL_MIXERINFO and
SNDCTL_CARDINFO break applications that expect to get information about
a device that is skipped. Related discussion can be found here:
https://reviews.freebsd.org/D45135#1029526

It has to be noted, that other applications, apart from mixer(8), suffer
from this.

PR: 277615
Sponsored by:   The FreeBSD Foundation
MFC after:  1 day
Reviewed by:dev_submerge.ch
Differential Revision:  https://reviews.freebsd.org/D45256

(cherry picked from commit 5d980fadf73df64a1e0eda40a93170ed76ce6f14)

 lib/libmixer/mixer.3  |   7 +-
 sys/dev/sound/pcm/dsp.c   |  23 +-
 sys/dev/sound/pcm/mixer.c | 201 --
 sys/dev/sound/pcm/mixer.h |   2 -
 sys/dev/sound/pcm/sound.c |  41 ++
 5 files changed, 155 insertions(+), 119 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.


[Bug 277615] /usr/sbin/mixer -a does not display all mixer devices if /dev/mixer0 happens to not exist.

2024-05-22 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277615

Christos Margiolis  changed:

   What|Removed |Added

 Status|New |Closed
 Resolution|--- |FIXED

-- 
You are receiving this mail because:
You are the assignee for the bug.


[Bug 277615] /usr/sbin/mixer -a does not display all mixer devices if /dev/mixer0 happens to not exist.

2024-05-22 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277615

--- Comment #2 from commit-h...@freebsd.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=5d980fadf73df64a1e0eda40a93170ed76ce6f14

commit 5d980fadf73df64a1e0eda40a93170ed76ce6f14
Author: Christos Margiolis 
AuthorDate: 2024-05-23 00:57:17 +
Commit: Christos Margiolis 
CommitDate: 2024-05-23 00:57:17 +

sound: Handle unavailable devices in various OSS IOCTLs

mixer(8)'s -a option is used to print information about all mixer
devices in the system. To do this, it loops from 0 to
mixer_get_nmixers(), and tries to open "/dev/mixer%d". However, this
approach doesn't work when there are disabled/unregistered mixers in the
system, or when an audio device simply doesn't have a mixer.

mixer_get_nmixers() calls SNDCTL_SYSINFO and returns
oss_sysinfo->nummixers, whose value is the number of currently _enabled_
mixers only. Taking the bug report mentioned below (277615) as an
example, suppose a system with 8 mixer devices total, but 3 of them are
either disabled or non-existent, which means they will not show up under
/dev, meaning we have 5 enabled mixer devices, which is also what the
value of oss_sysinfo->nummixers will be. What mixer(8) will do is loop
from 0 to 5 (instead of 8), and start calling mixer_open() on
/dev/mixer0, up to /dev/mixer4, and as is expected, the first call will
fail right away, hence the error shown in the bug report.

To fix this, modify oss_sysinfo->nummixers to hold the value of the
maximum unit in the system, which, although not necessarily "correct",
is more intuitive for applications that will want to use this value to
loop through all mixer devices.

Additionally, notify applications that a device is
unavailable/unregistered instead of skipping it. The current
implementations of SNDCTL_AUDIOINFO, SNDCTL_MIXERINFO and
SNDCTL_CARDINFO break applications that expect to get information about
a device that is skipped. Related discussion can be found here:
https://reviews.freebsd.org/D45135#1029526

It has to be noted, that other applications, apart from mixer(8), suffer
from this.

PR: 277615
Sponsored by:   The FreeBSD Foundation
MFC after:  1 day
Reviewed by:dev_submerge.ch
Differential Revision:  https://reviews.freebsd.org/D45256

 lib/libmixer/mixer.3  |   7 +-
 sys/dev/sound/pcm/dsp.c   |  23 +-
 sys/dev/sound/pcm/mixer.c | 201 --
 sys/dev/sound/pcm/mixer.h |   2 -
 sys/dev/sound/pcm/sound.c |  41 ++
 5 files changed, 155 insertions(+), 119 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.


[Bug 277615] /usr/sbin/mixer -a does not display all mixer devices if /dev/mixer0 happens to not exist.

2024-05-22 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277615

--- Comment #1 from commit-h...@freebsd.org ---
A commit in branch main references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=0e80798518be673bdad7245b627cb5bd7ec0

commit 0e80798518be673bdad7245b627cb5bd7ec0
Author: Christos Margiolis 
AuthorDate: 2024-05-23 00:57:25 +
Commit: Christos Margiolis 
CommitDate: 2024-05-23 00:57:25 +

mixer(8): Ignore mixer_open() failures for the -a option

The most likely reason mixer_open() will fail is because either the
device doesn't exist, or because it is disabled, so there is not reason
to kill the application. Instead, continue and print the rest of the
enabled mixers.

PR: 277615
Sponsored by:   The FreeBSD Foundation
MFC after:  1 day
Reviewed by:dev_submerge.ch
Differential Revision:  https://reviews.freebsd.org/D45151

 usr.sbin/mixer/mixer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.


[Bug 277615] /usr/sbin/mixer -a does not display all mixer devices if /dev/mixer0 happens to not exist.

2024-03-10 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277615

Bug ID: 277615
   Summary: /usr/sbin/mixer -a does not display all mixer devices
if /dev/mixer0 happens to not exist.
   Product: Base System
   Version: 14.0-RELEASE
  Hardware: Any
OS: Any
Status: New
  Severity: Affects Some People
  Priority: ---
 Component: bin
  Assignee: b...@freebsd.org
  Reporter: khell...@mcprogramming.com

$ freebsd-version
14.0-RELEASE-p4
$ echo /dev/mixer[0-9]*
/dev/mixer3 /dev/mixer4 /dev/mixer5 /dev/mixer6 /dev/mixer7
$ /usr/sbin/mixer -a
mixer: mixer_open: /dev/mixer0: Bad file descriptor

-- 
You are receiving this mail because:
You are the assignee for the bug.