#
5d980fad |
| 23-May-2024 |
Christos Margiolis <christos@FreeBSD.org> |
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(), a
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
show more ...
|
Revision tags: release/13.3.0, release/14.0.0 |
|
#
95ee2897 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
#
4d846d26 |
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0 |
|
#
0f8dafb4 |
| 20-Jul-2021 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Implement the SOUND_MIXER_WRITE_MUTE and SOUND_MIXER_READ_MUTE ioctl(9)s.
These two ioctls are not part of the current version of OSS and were considered obsolete. However, their behaviour is not th
Implement the SOUND_MIXER_WRITE_MUTE and SOUND_MIXER_READ_MUTE ioctl(9)s.
These two ioctls are not part of the current version of OSS and were considered obsolete. However, their behaviour is not the same as their old one, so this implementation is specific to FreeBSD.
Older OSS versions had the MUTE ioctls take and return an integer with a value of 0 or 1, which meant that the _whole_ mixer is unmuted or muted respectively. In my implementation, the ioctl takes and returns a bitmask that tells us which devices are muted.
This allows us to mute and unmute only the devices we want, instead of the whole mixer. The bitmask works the same way as in DEVMASK, RECMASK and RECSRC.
Integrated the hardware volume feature with the new mute system.
Submitted by: Christos Margiolis <christos@freebsd.org> Differential Revision: https://reviews.freebsd.org/D31130 MFC after: 1 week Sponsored by: NVIDIA Networking
show more ...
|
Revision tags: release/13.0.0, release/12.2.0, release/11.4.0 |
|
#
93e39e23 |
| 30-Mar-2020 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Implement new mixer API to return the device pointer based on the mixer pointer.
MFC after: 1 week Sponsored by: Mellanox Technologies
|
Revision tags: release/12.1.0, release/11.3.0, release/12.0.0, release/11.2.0 |
|
#
718cf2cc |
| 27-Nov-2017 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error
sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
show more ...
|
Revision tags: release/10.4.0, release/11.1.0, release/11.0.1, release/11.0.0, release/10.3.0, release/10.2.0, release/10.1.0, release/9.3.0, release/10.0.0, release/9.2.0 |
|
#
cfe30d02 |
| 19-Jun-2013 |
Gleb Smirnoff <glebius@FreeBSD.org> |
Merge fresh head.
|
Revision tags: release/8.4.0 |
|
#
d241a0e6 |
| 26-Feb-2013 |
Xin LI <delphij@FreeBSD.org> |
IFC @247348.
|
#
d9a44755 |
| 08-Feb-2013 |
David E. O'Brien <obrien@FreeBSD.org> |
Sync with HEAD.
|
#
2ba0f361 |
| 07-Feb-2013 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Add support for mute buttons on USB audio devices and use the hwvol interface to adjust the mixer settings.
MFC after: 1 week
|
#
76b71212 |
| 06-Feb-2013 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Add support for buttons on USB audio devices, like Volume Up and Volume Down.
Reviewed by: mav @ MFC after: 1 week
|
Revision tags: release/9.1.0 |
|
#
300675f6 |
| 27-Nov-2012 |
Alexander Motin <mav@FreeBSD.org> |
MFC
|
#
a10c6f55 |
| 11-Nov-2012 |
Neel Natu <neel@FreeBSD.org> |
IFC @ r242684
|
#
23090366 |
| 04-Nov-2012 |
Simon J. Gerraty <sjg@FreeBSD.org> |
Sync from head
|
#
3f5171b1 |
| 01-Nov-2012 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
Add missing inclusion guard.
|
Revision tags: release/8.3.0_cvs, release/8.3.0, release/9.0.0, release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0, release/8.1.0_cvs, release/8.1.0, release/7.3.0_cvs, release/7.3.0, release/8.0.0_cvs, release/8.0.0 |
|
#
10b3b545 |
| 17-Sep-2009 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
Merge from head
|
#
7e857dd1 |
| 12-Jun-2009 |
Oleksandr Tymoshenko <gonzo@FreeBSD.org> |
- Merge from HEAD
|
#
5870e3c9 |
| 11-Jun-2009 |
Ariff Abdullah <ariff@FreeBSD.org> |
Remove custom KOBJMETHOD(), CHANNEL_DECLARE() and MIXER_DECLARE() (enabled with SND_DEBUG) that was intended to provoke build failure due to inconsistencies.
|
#
90da2b28 |
| 07-Jun-2009 |
Ariff Abdullah <ariff@FreeBSD.org> |
Sound Mega-commit. Expect further cleanup until code freeze.
For a slightly thorough explaination, please refer to [1] http://people.freebsd.org/~ariff/SOUND_4.TXT.html .
Summary of changes includ
Sound Mega-commit. Expect further cleanup until code freeze.
For a slightly thorough explaination, please refer to [1] http://people.freebsd.org/~ariff/SOUND_4.TXT.html .
Summary of changes includes:
1 Volume Per-Channel (vpc). Provides private / standalone volume control unique per-stream pcm channel without touching master volume / pcm. Applications can directly use SNDCTL_DSP_[GET|SET][PLAY|REC]VOL, or for backwards compatibility, SOUND_MIXER_PCM through the opened dsp device instead of /dev/mixer. Special "bypass" mode is enabled through /dev/mixer which will automatically detect if the adjustment is made through /dev/mixer and forward its request to this private volume controller. Changes to this volume object will not interfere with other channels.
Requirements: - SNDCTL_DSP_[GET|SET][PLAY|REC]_VOL are newer ioctls (OSSv4) which require specific application modifications (preferred). - No modifications required for using bypass mode, so applications like mplayer or xmms should work out of the box.
Kernel hints: - hint.pcm.%d.vpc (0 = disable vpc).
Kernel sysctls: - hw.snd.vpc_mixer_bypass (default: 1). Enable or disable /dev/mixer bypass mode. - hw.snd.vpc_autoreset (default: 1). By default, closing/opening /dev/dsp will reset the volume back to 0 db gain/attenuation. Setting this to 0 will preserve its settings across device closing/opening. - hw.snd.vpc_reset (default: 0). Panic/reset button to reset all volume settings back to 0 db. - hw.snd.vpc_0db (default: 45). 0 db relative to linear mixer value.
2 High quality fixed-point Bandlimited SINC sampling rate converter, based on Julius O'Smith's Digital Audio Resampling - http://ccrma.stanford.edu/~jos/resample/. It includes a filter design script written in awk (the clumsiest joke I've ever written) - 100% 32bit fixed-point, 64bit accumulator. - Possibly among the fastest (if not fastest) of its kind. - Resampling quality is tunable, either runtime or during kernel compilation (FEEDER_RATE_PRESETS). - Quality can be further customized during kernel compilation by defining FEEDER_RATE_PRESETS in /etc/make.conf.
Kernel sysctls: - hw.snd.feeder_rate_quality. 0 - Zero-order Hold (ZOH). Fastest, bad quality. 1 - Linear Interpolation (LINEAR). Slightly slower than ZOH, better quality but still does not eliminate aliasing. 2 - (and above) - Sinc Interpolation(SINC). Best quality. SINC quality always start from 2 and above.
Rough quality comparisons: - http://people.freebsd.org/~ariff/z_comparison/
3 Bit-perfect mode. Bypasses all feeder/dsp effects. Pure sound will be directly fed into the hardware.
4 Parametric (compile time) Software Equalizer (Bass/Treble mixer). Can be customized by defining FEEDER_EQ_PRESETS in /etc/make.conf.
5 Transparent/Adaptive Virtual Channel. Now you don't have to disable vchans in order to make digital format pass through. It also makes vchans more dynamic by choosing a better format/rate among all the concurrent streams, which means that dev.pcm.X.play.vchanformat/rate becomes sort of optional.
6 Exclusive Stream, with special open() mode O_EXCL. This will "mute" other concurrent vchan streams and only allow a single channel with O_EXCL set to keep producing sound.
Other Changes: * most feeder_* stuffs are compilable in userland. Let's not speculate whether we should go all out for it (save that for FreeBSD 16.0-RELEASE). * kobj signature fixups, thanks to Andriy Gapon <avg@freebsd.org> * pull out channel mixing logic out of vchan.c and create its own feeder_mixer for world justice. * various refactoring here and there, for good or bad. * activation of few more OSSv4 ioctls() (see [1] above). * opt_snd.h for possible compile time configuration: (mostly for debugging purposes, don't try these at home) SND_DEBUG SND_DIAGNOSTIC SND_FEEDER_MULTIFORMAT SND_FEEDER_FULL_MULTIFORMAT SND_FEEDER_RATE_HP SND_PCM_64 SND_OLDSTEREO
Manual page updates are on the way.
Tested by: joel, Olivier SMEDTS <olivier at gid0 d org>, too many unsung / unnamed heroes.
show more ...
|
Revision tags: release/7.2.0_cvs, release/7.2.0, release/7.1.0_cvs, release/7.1.0 |
|
#
e57c2b13 |
| 04-Dec-2008 |
Dag-Erling Smørgrav <des@FreeBSD.org> |
integrate from head@185615
|
Revision tags: release/6.4.0_cvs, release/6.4.0 |
|
#
eabe30fc |
| 04-Nov-2008 |
Alfred Perlstein <alfred@FreeBSD.org> |
Bring in USB4BSD, Hans Petter Selasky rework of the USB stack that includes significant features and SMP safety.
This commit includes a more or less complete rewrite of the *BSD USB stack, including
Bring in USB4BSD, Hans Petter Selasky rework of the USB stack that includes significant features and SMP safety.
This commit includes a more or less complete rewrite of the *BSD USB stack, including Host Controller and Device Controller drivers and updating all existing USB drivers to use the new USB API:
1) A brief feature list:
- A new and mutex enabled USB API.
- Many USB drivers are now running Giant free.
- Linux USB kernel compatibility layer.
- New UGEN backend and libusb library, finally solves the "driver unloading" problem. The new BSD licensed libusb20 library is fully compatible with libusb-0.1.12 from sourceforge.
- New "usbconfig" utility, for easy configuration of USB.
- Full support for Split transactions, which means you can use your full speed USB audio device on a high speed USB HUB.
- Full support for HS ISOC transactions, which makes writing drivers for various HS webcams possible, for example.
- Full support for USB on embedded platforms, mostly cache flushing and buffer invalidating stuff.
- Safer parsing of USB descriptors.
- Autodetect of annoying USB install disks.
- Support for USB device side mode, also called USB gadget mode, using the same API like the USB host side. In other words the new USB stack is symmetric with regard to host and device side.
- Support for USB transfers like I/O vectors, means more throughput and less interrupts.
- ... see the FreeBSD quarterly status reports under "USB project"
2) To enable the driver in the default kernel build:
2.a) Remove all existing USB device options from your kernel config file.
2.b) Add the following USB device options to your kernel configuration file:
# USB core support device usb2_core
# USB controller support device usb2_controller device usb2_controller_ehci device usb2_controller_ohci device usb2_controller_uhci
# USB mass storage support device usb2_storage device usb2_storage_mass
# USB ethernet support, requires miibus device usb2_ethernet device usb2_ethernet_aue device usb2_ethernet_axe device usb2_ethernet_cdce device usb2_ethernet_cue device usb2_ethernet_kue device usb2_ethernet_rue device usb2_ethernet_dav
# USB wireless LAN support device usb2_wlan device usb2_wlan_rum device usb2_wlan_ral device usb2_wlan_zyd
# USB serial device support device usb2_serial device usb2_serial_ark device usb2_serial_bsa device usb2_serial_bser device usb2_serial_chcom device usb2_serial_cycom device usb2_serial_foma device usb2_serial_ftdi device usb2_serial_gensa device usb2_serial_ipaq device usb2_serial_lpt device usb2_serial_mct device usb2_serial_modem device usb2_serial_moscom device usb2_serial_plcom device usb2_serial_visor device usb2_serial_vscom
# USB bluetooth support device usb2_bluetooth device usb2_bluetooth_ng
# USB input device support device usb2_input device usb2_input_hid device usb2_input_kbd device usb2_input_ms
# USB sound and MIDI device support device usb2_sound
2) To enable the driver at runtime:
2.a) Unload all existing USB modules. If USB is compiled into the kernel then you might have to build a new kernel.
2.b) Load the "usb2_xxx.ko" modules under /boot/kernel having the same base name like the kernel device option.
Submitted by: Hans Petter Selasky hselasky at c2i dot net Reviewed by: imp, alfred
show more ...
|
Revision tags: release/7.0.0_cvs, release/7.0.0, release/6.3.0_cvs, release/6.3.0 |
|
#
e4e61333 |
| 16-Jun-2007 |
Ariff Abdullah <ariff@FreeBSD.org> |
Last (again ?!?) major commit for RELENG_7, featuring total Giant eradication in/from userland path, countless locking fixes, etc.
- General sleep call through msleep(9) has been converted to condva
Last (again ?!?) major commit for RELENG_7, featuring total Giant eradication in/from userland path, countless locking fixes, etc.
- General sleep call through msleep(9) has been converted to condvar(9) with better consistencies. - Heavily guard every possible "slow path" entries (open(), close(), few ioctl()s, sysctls), but once it entering "fast path" (io, interrupt started), they are free to fly on their own. - Rearrange locking sequences, resulting better concurrency and serialization. Large part doesn't even need locking at all, and will be removed in future. Less clutter, except in few places due to lock ordering. - Anonymous mixer object creation/deletion to simplify mixer handling beyond typical mixer ioctls. Submitted by: chibis (with modifications) - Add few mix_[get|set|..] functions to avoid calling mixer_ioctl() directly using cryptic arguments. - Locking fixes to avoid possible deadlock with (still under Giant) USB. - Better simplex/duplex device handling. - Recover mmap() functionality for recording, which has been lost since 2.2.x - 3.x (the introduction of newpcm). Full-duplex mmap still doesn't work (due to VM/page design), but people still can mmap both by opening each direction separately. mmaped playback is guarantee to work either way. - New sysctl: "hw.snd.compat_linux_mmap" to allow PROT_EXEC page mapping, due to recent changes in linux compatibility layer which require it. All linux applications that using sound + mmap() (mostly games) require this to be enabled. Disabled by default. - Other goodies.. too many, that will increase releng7 shareholder value and make users of releng6 (and below) cry ;)
* This commit should be atomic. If anything goes wrong (not counting problem originated from elsewhere), I will not hesitate to revert everything back within 12 hours. This substantial changes itself not a rocket science and the process has begun for almost 2 years, and lots of incremental changes are already in place during that period of time. * Some issues does occur in snd_emu10kx (note the 'x') due to various internal locking issues and it is currently being worked on by chibis.
Tested by: chibis (Yuriy Tsibizov), joel, Alexandre Vieira, many innocent souls...
show more ...
|
Revision tags: release/6.2.0_cvs, release/6.2.0 |
|
#
7567f38c |
| 30-Sep-2006 |
Ariff Abdullah <ariff@FreeBSD.org> |
Nuke OSSV4_EXPERIMENT ifdefs from kludgy MIXER_SIZE definition since the exclusion of sizeof(oss_mixer_enuminfo) is the real cause of overflow (worth of +3000 bytes).
Noticed by: tegge
|
#
7699548f |
| 28-Sep-2006 |
Ariff Abdullah <ariff@FreeBSD.org> |
Various fixups, especially for the upcomming High Definition Audio commit.
1) sys/dev/sound/pcm/sound.h sys/dev/sound/pcm/channel.c * Be more specific: SD_F_SOFTVOL -> SD_F_SOFTPCMVOL 2) sys/d
Various fixups, especially for the upcomming High Definition Audio commit.
1) sys/dev/sound/pcm/sound.h sys/dev/sound/pcm/channel.c * Be more specific: SD_F_SOFTVOL -> SD_F_SOFTPCMVOL 2) sys/dev/sound/pcm/mixer.[ch] * Implement mix_setparentchild() mix_setrealdev() mix_getparent() mix_getchild() The purpose of these functions is implement relative volume adjustment, such as to tie two or more mixer device into a single logical device. Usefull for the upcoming HDA driver and few AC97 codec (such as AD1981B) where the master volume "vol" need to be implemented using this logical manner. 3) sys/dev/sound/pcm/ac97_patch.[ch] * Patch for AD1981B codec to enable (automuting) headphone jack sense. 4) sys/dev/sound/pcm/ac97.c * Implement proper logical master volume for AD9181B codec through various mix_set{parentchild,realdev}(). Tie both "ogain" (headphone volume) and "phone" (speaker/lineout) to a logical "vol". 5) sys/dev/sound/pcm/usb/uaudio_pcm.c * ditto, for "vol" -> { "pcm" }.
MFC after: 1 month
show more ...
|
#
b611c801 |
| 23-Sep-2006 |
Alexander Leidinger <netchild@FreeBSD.org> |
MFp4 the sound Google Summer of Code project:
The goal was to sync with the OSSv4 API 4Front Technologies uses in their proprietary OSS driver. This was successful as far as possible. The part of th
MFp4 the sound Google Summer of Code project:
The goal was to sync with the OSSv4 API 4Front Technologies uses in their proprietary OSS driver. This was successful as far as possible. The part of the API which is stable is implemented, for the rest there are some stubs already.
New system ioctls: - SNDCTL_SYSINFO - obtain audio system info (version, # of audio/midi/ mixer devices, etc.) - SNDCTL_AUDIOINFO - fetch details about a specific audio device - SNDCTL_MIXERINFO - fetch details about a specific mixer device
New audio ioctls: - Sync groups (SNDCTL_DSP_SYNCGROUP/SNDCTL_DSP_SYNCSTART) which allow triggered playback/recording on multiple devices (even across processes simultaneously). - Peak meters (SNDCTL_DSP_GETIPEAKS/SNDCTL_DSP_GETOPEAKS) - can query audio drivers for peak levels (needs driver support, disabled for now). - Per channel playback/recording levels - SNDCTL_DSP_{GET,SET}{PLAY,REC}VOL. Note that these are still in name only, just wrapping around the AC97-style mixer at the moment. The next step is to push them down to the drivers.
Audio ioctls still under development by 4Front (for which stubs may exist in this commit): - SNDCTL_GETNAME, SNDCTL_{GET,SET}{SONG,LABEL} - SNDCTL_DSP_{GET,SET}_CHNORDER - SNDCTL_MIX_ENUMINFO, SNDCTL_MIX_EXTINFO - (might be documented enough in the OSS releases to work on this. These ioctls cover the cool "twiddle any knob on your card" features.)
Missing: - SNDCTL_DSP_COOKEDMODE -- this ioctl is used to give applications direct access to a card's buffers, bypassing the feeder architecture. It's a toughy -- "someone" needs to decide : (a) if this is desireable, and (b) if it's reasonably feasible.
Updates for driver writers: So far, only two routines to the channel class (in channel_if.m) are added. One is for fetching a list of discrete supported playback/recording rates of a channel, and the other is for fetching peak level info (useful for drawing peak meters). Interested parties may want to help pushing down SNDCTL_DSP_{GET,SET}{PLAY,REC}VOL into the drivers.
To use the new stuff you need to rebuild the sound drivers or your kernel (depending on if you use modules or not) and to install soundcard.h (a buildworld/installworld handles this).
Sponsored by: Google SoC 2006 Submitted by: ryanb Many thanks to: 4Front Technologies for their cooperation, explanations and the nice license of their soundcard.h.
show more ...
|