Commit graph

25 commits

Author SHA1 Message Date
Christos Margiolis 1ab62c8d06 mixer.3: Fix mandoc -Tlint warnings
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45290
2024-05-23 02:57:49 +02:00
Christos Margiolis 67c89b21b9 mixer(3): Implement mixer_get_path() function
This is better than hardcoding device paths in mixer applications.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45275
2024-05-23 02:57:36 +02:00
Christos Margiolis 5d980fadf7 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
2024-05-23 02:57:17 +02:00
Christos Margiolis 53c768e683 mixer(3): Do not hardcode "/dev/mixer"
We have BASEPATH defined.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D43812
2024-02-12 13:00:05 +02:00
Stephen J. Kiernan 5e3190f700 dirdeps: Update Makefile.depend* files with empty contents
Some Makefile.depend* files were committed with no contents or empty
DIRDEPS list, but they should have DIRDEPS with some contents.
2023-10-29 17:01:04 -04:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh 42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Warner Losh b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Simon J. Gerraty d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Christos Margiolis 2d3515d61e mixer(3): Add HEADNAME to TAILQ_HEAD declarations in man page
Forgot to modify the man page in commit 249526dace.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38118
2023-01-24 09:10:49 -05:00
Christos Margiolis e5f5ca7fee mixer(3): remove redundant argument in _mixer_readvol()
There's no reason to pass the mixer as an argument since we can fetch it
from mix_dev.  No functional change intended.

Reviewed by:	markj, hselasky
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38076
2023-01-17 08:08:59 -05:00
Christos Margiolis 249526dace mixer(3): Add HEADNAME to TAILQ_HEAD declarations
This allows us to use the TAILQ_PREV and TAILQ_FOREACH_REVERSE_* macros,
useful for an out-of-tree consumer.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38055
2023-01-14 21:33:58 -05:00
Hans Petter Selasky bde8460272 mixer.4 and mixer.8: Fix mandoc -Tlint errors.
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34603
Sponsored by:		NVIDIA Networking
2022-03-20 20:21:03 +01:00
Hans Petter Selasky 5c6935a645 mixer.3: Fix spelling
Submitted by:		christos@
Differential Revision:	https://reviews.freebsd.org/D34378
MFC after:		1 week
Sponsored by:		NVIDIA Networking
2022-03-18 12:10:40 +01:00
Hans Petter Selasky fff236e89d mixer(3): Revert: "Fix for header file pollution."
Differential Revision:	https://reviews.freebsd.org/D33732
Submitted by:	christos@
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-01-04 12:35:23 +01:00
Hans Petter Selasky 55224280e2 mixer(3): Fix for header file pollution.
Differential Revision:	https://reviews.freebsd.org/D33732
Submitted by:	christos@
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-01-04 11:43:59 +01:00
Christos Margiolis ce74223a36 mixer: make .Dt tags uppercase
The document title should be uppercase in man pages.

Reviewed by:	imp, gbe
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D33027
2021-11-20 08:58:36 +01:00
Hans Petter Selasky 790b526488 mixer(3): Fix spelling in comment.
s/MIX_STATUS_XXX/MIX_MODE_XXX/g

Differential Revision:	https://reviews.freebsd.org/D32548
Submitted by:	christos@
Sponsored by:	NVIDIA Networking
2021-10-24 19:37:17 +02:00
Hans Petter Selasky 5b40c0aa73 mixer(3): Fix buildworld after 38c857d956 .
s/default_unit/dunit/g

Differential Revision:	https://reviews.freebsd.org/D32254
Sponsored by:	NVIDIA Networking
2021-10-01 16:34:10 +02:00
Hans Petter Selasky 433be7f21f mixer(3): Add some manual page symlinks.
Submitted by:	christos@
Differential Revision:	https://reviews.freebsd.org/D32254
Sponsored by:	NVIDIA Networking
2021-10-01 14:18:43 +02:00
Hans Petter Selasky 38c857d956 mixer(3): Add symbol versioning.
Suggested by:	kib
Differential Revision:	https://reviews.freebsd.org/D32254
Sponsored by:	NVIDIA Networking
2021-10-01 14:18:43 +02:00
Hans Petter Selasky 3984400149 mixer(3): Add support for controlling mixer mute and volume on feeder channels.
PR:	258711
Reported by:	jbeich@FreeBSD.org
Differential Revision:	https://reviews.freebsd.org/D31636
Sponsored by:	NVIDIA Networking
2021-09-28 11:20:23 +02:00
Hans Petter Selasky db6ba1e0c5 mixer(3) and mixer(8): Update manual pages.
- Use correct e-mail address.
- Set FreeBSD 14.0 as introduction for the updated mixer(8) utility.

Submitted by:	christos@
Differential Revision:	https://reviews.freebsd.org/D31636
Sponsored by:	NVIDIA Networking
2021-09-22 22:01:40 +02:00
Hans Petter Selasky 903873ce15 Implement and use new mixer(3) library for FreeBSD.
Wiki article: https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements
This project was part of Google Summer of Code 2021.

Submitted by:	christos@
Differential Revision:	https://reviews.freebsd.org/D31636
Sponsored by:	NVIDIA Networking
2021-09-22 19:43:56 +02:00