CVS: cvs.openbsd.org: src

2024-07-23 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/07/23 02:59:21

Modified files:
sys/dev/usb: uaudio.c 

Log message:
uaudio: Fix confusion between interface numbers and interface indexes

There is rare hardware for which the interface numbers and indexes are
not equal. Such devices couldn't attach because the driver claimed the
wrong interface.



CVS: cvs.openbsd.org: src

2024-07-23 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/07/23 02:36:51

Modified files:
lib/libsndio   : sioctl_sun.c 

Log message:
libsndio: Don't use poll(2) for output on the control device.

The AUDIO_MIXER_WRITE ioctl always succeeds without blocking, so no
need to use poll(2) for output. The audio(4) control device driver
doesn't implement the corresponding struct filterops anyway.

Fixes delayed level settings.



CVS: cvs.openbsd.org: src

2024-07-23 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/07/23 00:34:03

Modified files:
usr.bin/sndiod : file.c 

Log message:
sndiod: Properly update the poll(2) event masks after i/o.

If there are no descriptors to poll for an event source, we call
the i/o handlers immediately (before poll(2) is called). As this
may generate output for other descriptors, their the poll(2) event
masks need to be updated.



CVS: cvs.openbsd.org: src

2024-07-08 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/07/08 10:10:34

Modified files:
usr.bin/aucat  : aucat.c 

Log message:
aucat: check for failled allocation

>From Nihal Jere , thanks!



CVS: cvs.openbsd.org: src

2024-06-01 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/06/01 03:44:10

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Don't add/remove server.device entries in dev_{open,close}()

Fixes server.device entries disappearing when usb devices are unplugged
while in use. Found, analysed and tested by Laurie Tratt, thanks!



CVS: cvs.openbsd.org: src

2024-05-24 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/05/24 09:21:35

Modified files:
usr.bin/sndiod : dev.c opt.c 

Log message:
sndiod: Set the display string of all server.device entries

with help from edd@ and armani@



CVS: cvs.openbsd.org: src

2024-05-24 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/05/24 09:10:27

Modified files:
include: sndio.h 
lib/libsndio   : shlib_version sioctl_aucat.c sioctl_open.3 
 sioctl_sun.c 
usr.bin/sndioctl: sndioctl.c 

Log message:
sndio: Add a display string to the sioctl_open API

For hardware devices, add a server.device control
with a single item and the device name as display
string.

Add the necessary sndioctl(1) bits to print it.



CVS: cvs.openbsd.org: src

2024-05-24 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/05/24 09:03:12

Modified files:
usr.bin/sndiod : sock.c sock.h 

Log message:
sndiod: Use a 'unsigned char *' for the pointer to the temp sock buffer



CVS: cvs.openbsd.org: src

2024-05-24 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/05/24 09:01:53

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Hide "hardware" device's server.device control.

If sndiod is using another sndiod instance instead of the bare
hardware, then it must disable the underlying server.device
control to avoid conflicts with its own server.device control.



CVS: cvs.openbsd.org: src

2024-05-24 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/05/24 09:00:15

Modified files:
usr.bin/sndiod : dev_sioctl.c 

Log message:
sndiod: Don't mark as dirty controls that have not been changed



CVS: cvs.openbsd.org: src

2024-05-20 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/05/20 23:09:29

Modified files:
usr.bin/aucat  : aucat.1 

Log message:
aucat.1: Fix needless line breaks in the -h and MIDI sections.

Diff from Jan Stary , thanks!

ok jmc



CVS: cvs.openbsd.org: src

2024-05-05 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/05/05 23:37:26

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Ignore server.device settings to a non-working device



CVS: cvs.openbsd.org: src

2024-05-03 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/05/03 10:48:41

Modified files:
usr.bin/aucat  : aucat.1 

Log message:
aucat.1: Drop the number component of sndio descriptors

ok jmc



CVS: cvs.openbsd.org: src

2024-05-03 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/05/03 10:47:15

Modified files:
usr.bin/sndiod : sndiod.8 

Log message:
sndiod.1: Drop the number component of sndio descriptors



CVS: cvs.openbsd.org: src

2024-05-02 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/05/02 23:18:09

Modified files:
usr.bin/sndiod : midi.c midi.h sndiod.c 

Log message:
sndiod: Fix SIGHUP to reopen the devices in priority order

With this commit, SIGHUP makes sndiod discover new devices and if
there is a new device with higher priority (greater -F option number)
than the current one, sndiod switches to it.  If the current device is
already the one with the highest priority (i.e. last -F), then SIGHUP
does nothing.



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 08:11:35

Modified files:
usr.bin/sndiod : dsp.c 

Log message:
sndiod: Use the channel mapping code of aucat

For now sndiod uses only a subset of the available channel mappings.
It gives the same result as the previous one, but having the same
in both programs makes code review and testing easier.



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 06:32:51

Modified files:
usr.bin/aucat  : dsp.c dsp.h 

Log message:
aucat: Use a 24-bit table for index to volume conversion



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 06:21:49

Modified files:
usr.bin/aucat  : dsp.h 

Log message:
aucat: Fix comments, from similar comments fixes in sndiod



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 05:07:42

Modified files:
usr.bin/sndiod : dsp.c dsp.h 

Log message:
sndiod: Use a 24-bit table for index to volume conversion.



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 05:01:02

Modified files:
usr.bin/sndiod : dev.c dsp.c dsp.h 

Log message:
sndiod: Use resampling algorithm from aucat

sndiod doesn't use partial blocks as aucat, but having the same
algorithm makes code review and testing easier.



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 04:57:36

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Drop duplicate prototype of dev_new()



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 04:49:01

Modified files:
usr.bin/sndioctl: sndioctl.c 

Log message:
sndioctl: Remove assert about duplicate controls

On the sndiod(8) side device controls are not ordered. While switching
from one device to another, a new control (of the new device) may
appear before an old control with the same name is removed. As
discussed in sioctl_open(3), once the full description increment is
fetched (i.e. the call-back is invoked with NULL sioctl_desc
structure) the representation of the control set is consistent.



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 04:43:55

Modified files:
usr.bin/sndiod : dev_sioctl.c 

Log message:
sndiod: Hide forgotten debug printfs



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 04:43:16

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Call ctlslot->ops->sync() after every control update

This ensures that the final NULL sioctl_ondesc() call-back
call is not lost.



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 04:42:04

Modified files:
usr.bin/sndiod : opt.c opt.h 

Log message:
sndiod: Make opt_setdev() return 1 if the device was accepted



CVS: cvs.openbsd.org: src

2024-04-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/22 04:39:51

Modified files:
usr.bin/sndiod : dev.c dev.h 

Log message:
sndiod: Return the number of controls ctl_del() has deleted.



CVS: cvs.openbsd.org: src

2024-04-19 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/19 00:50:37

Modified files:
sys/nfs: nfs_socket.c nfs_syscalls.c 

Log message:
nfs: Permit null requests (aka server pings) from non-reserved ports

Unfortunately, this is recommended by rfc 2623 and used by Linux
nfs-utils to mount NFS exports. So until nfs-utils switches into
using reserved ports, this is needed to mount OpenBSD file-systems
on most (all?) Linux distros.

Bits from claudio, ok millert



CVS: cvs.openbsd.org: src

2024-04-01 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/01 23:32:10

Modified files:
usr.bin/sndiod : siofile.c 

Log message:
sndiod: Migrate clients upon watchdog timeout

When -F is used, fixes the difference in behavior between watchdog
timer expiry and other errors.



CVS: cvs.openbsd.org: src

2024-04-01 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/04/01 23:21:32

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Fix confusion between the slot and ctlslot pointers

Fixes crash when the device is disconnected and the clients are not
migrated to another device.



CVS: cvs.openbsd.org: src

2024-03-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/03/22 00:20:48

Modified files:
usr.bin/aucat  : aucat.c 

Log message:
aucat: Allow any device sample encoding.

If the device doesn't support the aucat internal encoding,
then setup a conversion layer instead of failing. This allows
aucat to be used for audio equipment testing/debugging
without involving the full sndiod processing chain.



CVS: cvs.openbsd.org: src

2024-03-22 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/03/22 00:06:06

Modified files:
usr.bin/aucat  : aucat.c 

Log message:
aucat: Add a bytes-per-sample argument to allcobuf()

No behavior change.



CVS: cvs.openbsd.org: src

2024-03-21 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/03/21 23:54:25

Modified files:
sys/kern   : kern_pledge.c 

Log message:
pledge: Allow the AUDIO_GETDEV ioctl in "audio"

ok deraadt, kn, phessler



CVS: cvs.openbsd.org: src

2024-03-20 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/03/20 02:42:11

Modified files:
usr.bin/aucat  : aucat.1 aucat.c dsp.c 

Log message:
aucat: Add generic channel mapping in place of -j and -c options.

The argument to the -m option specifies the source and destination
channel ranges to be mapped. Compatibility is maintained: if -m
is not used, the -c and -j options still work.

Help and suggestions from Jan Stary , thanks.



CVS: cvs.openbsd.org: src

2024-01-31 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/01/31 22:28:54

Modified files:
usr.bin/aucat  : aucat.c 

Log message:
aucat: Fix MIDI control of the levels of individual files

Change the order of slot_list to match the order of the -io options on
the command-line and fix the way slot_list searched using the MIDI
channel number of the CC-07 message.

Reported and analysed by Dirk-Wilhelm Peters 

Thanks!



CVS: cvs.openbsd.org: src

2024-01-12 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2024/01/12 01:47:46

Modified files:
sys/nfs: nfs_syscalls.c 

Log message:
nfssvc: When the client disconnects, close the socket before sleeping.

If the server doesn't close the socket immediately and starts waiting
for the client to reconnect, then the TCP connection will remain open.
The client will have to wait for the connection to be closed in order
to reconnect with the same source port; this never happens, resulting
in a freeze until the file system is umounted.

This change fixes Linux NFS clients freezing after 5 min of inactivity.

ok miod, help from claudio



CVS: cvs.openbsd.org: src

2023-12-09 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2023/12/09 23:32:14

Modified files:
sys/dev/usb: uaudio.c 

Log message:
Skip interfaces already claimed by other uaudio(4) instances.

Fixes support of devices that attach multiple uaudio(4) drivers.

Every uaudio(4) instance parses the full set of device descriptors
because there are multiple interfaces per driver instance. If there is
a second uaudio(4) instance (i.e. a second control & stream interfaces
combo), the latter must skip the interfaces already used by the first
one (if it didn't, multiple uaudio(4) would try to use the same
interface and neither would work).

Help from and ok armani@.



CVS: cvs.openbsd.org: src

2023-12-09 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2023/12/09 15:12:03

Modified files:
usr.bin/sndiod : dev.c 

Log message:
Fix wrong call to slot->ops->exit() causing server to abort.

ok kn@



CVS: cvs.openbsd.org: src

2023-06-27 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2023/06/27 03:28:08

Modified files:
sys/dev/usb: uaudio.c 

Log message:
Return error if the USB request to get the sample rate fails.

found by mlarkin



CVS: cvs.openbsd.org: src

2023-01-31 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2023/01/31 14:38:01

Modified files:
usr.bin/sndioctl: sndioctl.c 

Log message:
Fix a typo in a comment and spacing

from weerd@



CVS: cvs.openbsd.org: src

2023-01-13 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2023/01/13 08:14:24

Modified files:
usr.bin/aucat  : afile.c 

Log message:
Use extended header format for .wav files.

According to Microsoft docs, it is needed if bits > 16 or if there are
more than 2 channels, which aucat supports and is the defaut. Fixes
errors reported by audio/sox port when trying to play .wav files
generated by aucat.

Reported by John Rigg  and others on misc@



CVS: cvs.openbsd.org: src

2023-01-10 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2023/01/10 13:48:34

Modified files:
usr.bin/aucat  : aucat.1 

Log message:
Fix device name in the MIDI control section

For MMC to work, the MIDI sequencer must send MMC to subdevices
registered with -tslave.

>From Dirk-Wilhelm Peters , thanks.



CVS: cvs.openbsd.org: src

2023-01-07 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2023/01/07 23:58:07

Modified files:
usr.bin/audioctl: audioctl.8 audioctl.c 

Log message:
Add -w option to display variables periodically

The purpose of -w is to monitor underruns without triggering long
kernel code-paths (ex. fork and exec of new audioctl process) that may
cause additional underruns than the ones being monitored.

ok chehola, edd



CVS: cvs.openbsd.org: src

2022-07-16 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2022/07/16 03:49:46

Modified files:
lib/libsndio   : sndio.pc 

Log message:
Bump libsndio pkg-config version to 1.9.0



CVS: cvs.openbsd.org: src

2022-05-03 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2022/05/03 07:03:30

Modified files:
lib/libsndio   : sioctl_open.3 

Log message:
sioctl_onval(3) returns int not void

Fix from Carlin Bingham , thanks!



CVS: cvs.openbsd.org: src

2022-04-30 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2022/04/30 02:47:18

Modified files:
lib/libsndio   : sio_open.3 

Log message:
Tweak to clarify sio_stop(3) and sio_flush() description, from jmc@



CVS: cvs.openbsd.org: src

2022-04-29 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2022/04/29 03:12:57

Modified files:
usr.bin/sndiod : dev.c dev.h 

Log message:
Wait until the buffer is drained before closing the device

Fixes last few samples not being played when very large buffers
are used.



CVS: cvs.openbsd.org: src

2022-04-29 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2022/04/29 02:30:48

Modified files:
include: sndio.h 
lib/libsndio   : Symbols.map amsg.h shlib_version sio.c 
 sio_aucat.c sio_open.3 sio_priv.h sio_sun.c 
usr.bin/sndiod : siofile.c sock.c 

Log message:
Add sio_flush(3) function to stop playback immediately

The new sio_flush(3) functions works the same way as sio_stop(3),
except that it doesn't wait for play buffer to be drained. Instead,
it discards its contents and returns immediately.



CVS: cvs.openbsd.org: src

2022-03-14 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2022/03/14 23:53:37

Modified files:
usr.bin/sndiod : dev.c 

Log message:
Fix crash caused by confusion between requested device and last used one

Found by and ok semarie@



CVS: cvs.openbsd.org: src

2022-03-07 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2022/03/07 02:04:45

Modified files:
usr.bin/aucat  : aucat.1 aucat.c dsp.h 

Log message:
Switch internal sample representation to 24-bit fixed-point

Note that this also changes the default file encoding to 24-bit.



CVS: cvs.openbsd.org: src

2022-03-07 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2022/03/07 01:58:33

Modified files:
usr.bin/sndiod : dsp.h sndiod.8 sndiod.c 

Log message:
Switch internal sample representation to 24-bit fixed-point.

The default device precision doesn't change (yet), i.e. we still
request the usual 16-bit mode, when available. Hardware supporting
24-bit samples only gets end-to-end 24-bit processing by default.

ok kettenis



CVS: cvs.openbsd.org: src

2021-12-25 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/12/25 09:25:07

Modified files:
usr.bin/sndioctl: sndioctl.c 

Log message:
Don't accept an empty string as selector value

"looks good" edd@



CVS: cvs.openbsd.org: src

2021-12-25 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/12/25 09:15:53

Modified files:
usr.bin/sndiod : sndiod.8 

Log message:
Move example about USB devices from -F description to hot plugging section

ok kn



CVS: cvs.openbsd.org: src

2021-12-25 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/12/25 08:24:02

Modified files:
usr.bin/sndiod : sndiod.8 

Log message:
Add section to explain how to handle device hot plugging

mostly from kn@, tweaks from me



CVS: cvs.openbsd.org: src

2021-12-15 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/12/15 01:30:34

Modified files:
lib/libsndio   : sndio.pc 

Log message:
Bump pkg-config version to 1.8.1



CVS: cvs.openbsd.org: src

2021-11-07 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/11/07 13:51:47

Modified files:
lib/libsndio   : aucat.c 

Log message:
Allow -current libsndio to connect to old sndiod servers

Recent sndio device naming change is missing the proper compatibility
bits for this case. Found and fixed by bluhm@ and tweaks from me.

ok bluhm



CVS: cvs.openbsd.org: www

2021-11-02 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:www
Changes by: ratc...@cvs.openbsd.org 2021/11/02 04:14:04

Modified files:
faq: current.html 

Log message:
Add entry to explain sndio(7) device name changes

ok tb@



CVS: cvs.openbsd.org: src

2021-11-01 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/11/01 12:23:09

Modified files:
usr.bin/sndiod : utils.h 

Log message:
Remove unused struct name



CVS: cvs.openbsd.org: src

2021-11-01 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/11/01 08:43:25

Modified files:
lib/libsndio   : amsg.h aucat.c sio.c sioctl.c sndio.7 
usr.bin/sndiod : dev.c dev.h fdpass.c fdpass.h midi.c midi.h 
 miofile.c miofile.h opt.c opt.h siofile.c 
 siofile.h sndiod.c sock.c utils.c utils.h 

Log message:
Stop binding audio devices exposed by sndiod to physical devices

This a shift towards a new model: clients connect to logical devices
(created with -s option) then the server routes data to/from the
underlying physical device (registered with -f option). The binding
may be changed at run-time with the server.device control exposed by
sndioctl(1).

As audio devices exposed by sndiod(8) are not bound to fixed physical
devices anymore, the physical audio device number component of
sndio(7) descriptors was removed.

fixes, help from and ok denis, edd



CVS: cvs.openbsd.org: src

2021-10-30 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/10/30 06:48:11

Modified files:
sys/dev: midi.c 

Log message:
Fix build break caused by accidental keystroke during last commit



CVS: cvs.openbsd.org: src

2021-10-30 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/10/30 06:40:55

Modified files:
sys/dev: midi.c 

Log message:
Disestablish softintrs upon detach (missed in last commit)

During detach, we can't rely on softintrs to signal processes blocked
in read, write or poll, so we need to explicitely call wakeup
functions in the detach method, as other drivers do.



CVS: cvs.openbsd.org: src

2021-10-30 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/10/30 06:26:26

Modified files:
sys/dev: midi.c midivar.h 

Log message:
Defer selwakeup() calls to a softintr

selwakeup() needs to be protected by KERNEL_LOCK, but we're not
allowed to grab KERNEL_LOCK on interrupt context because midi runs at
IPL_AUDIO with the audio_lock held. Furthermore, doing so is a locking
order bug: syscall code-path grabs KERNEL_LOCK first while interrupt
code-path does the opposite when calling selwakeup().

ok visa



CVS: cvs.openbsd.org: src

2021-10-30 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/10/30 05:56:19

Modified files:
sys/dev/usb: uhidev.h 

Log message:
Revert previous commit as it's causing panic when devices are detached

ok sthen, anton



CVS: cvs.openbsd.org: src

2021-10-29 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/10/29 07:24:50

Modified files:
sys/dev: midi.c 

Log message:
Don't grab audio_lock in filt_midi{read,write} if NOTE_SUBMIT is set.

Fixes panics caused by attempts to grab audio_lock twice in the
interrupt code path: once in the low-lever interrupt handler and once
in selwakeup()

This is exactly how audio(4) handles this problem.

ok mpi



CVS: cvs.openbsd.org: src

2021-07-05 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/07/05 02:29:59

Modified files:
usr.bin/aucat  : dsp.c 
usr.bin/sndiod : dsp.c 

Log message:
Fix off-by-one array access when 64 channel stream is resampled



CVS: cvs.openbsd.org: src

2021-06-09 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/06/09 23:02:50

Modified files:
lib/libsndio   : sndio.pc 

Log message:
Bump pkg-config version to 1.8.0 to match portable package version

Suggested by brad@



CVS: cvs.openbsd.org: src

2021-05-25 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/05/25 02:06:12

Modified files:
usr.bin/sndiod : dsp.h 
usr.bin/aucat  : dsp.h 

Log message:
Drop assembly for 24-bit fixed-point operations

Now i386 compiler is smart enough to generate a single imul
instruction per fixed-point multiplication. This change also allows
24-bit precision to be used on all archs (if -DADATA_BITS=24 is used).

Tested on arm64 by Doug Moss , thanks

Suggested and ok naddy@



CVS: cvs.openbsd.org: src

2021-05-18 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/05/18 04:02:00

Modified files:
sys/dev/usb: uaudio.c 

Log message:
Add pre-DMA-write barrier after data is stored to memory

There's already such a barrier in usbd_transfer() code-path, but this
one is called when the frames are queued to the HC ring. The audio
samples are stored in memory by userland later, *after* the frames are
scheduled (but before they are sent on the wire) so a barrier is
needed there. Without this change, the data produced by userland may
stay in the CPU caches and is not "seen" by the HC's DMA engine, in
turn the device plays noise on certain arm64 machines (RPI4, for
instance).

Fix mostly from Luca Castagnini with few tweaks from me. OK patrick@



CVS: cvs.openbsd.org: src

2021-05-02 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/05/02 22:29:50

Modified files:
usr.bin/sndiod : dev.c 

Log message:
If mode is not allowed in struct opt, then just play/record silence

This is similar to what we already do when device is opened and its
mode doesn't match requested mode. Besides adding consistency, this
change would allow client's opt structure to be changed dynamically.



CVS: cvs.openbsd.org: src

2021-04-28 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/04/28 13:12:53

Modified files:
lib/libsndio   : Makefile 
Added files:
lib/libsndio   : sndio.pc 

Log message:
Add sndio.pc file for pkg-config, mostly from brad@

ok and help from espie@



CVS: cvs.openbsd.org: src

2021-04-27 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/04/27 23:10:29

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Attach client at the same position, regardless the device mode

This is necessary to make rec-only devices properly work in
full-duplex. Fixes full-duplex clients stuck on rec-only device.



CVS: cvs.openbsd.org: src

2021-04-27 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/04/27 23:05:05

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Allocate (free) conversion buffers in slot_attach (slot_detach)

Besides being better coding style, this allows a client to be detached
and then attached to a device with different parameters.



CVS: cvs.openbsd.org: src

2021-04-19 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/04/19 22:31:54

Modified files:
sys/dev/pci: azalia_codec.c 

Log message:
Add quirk to enable all Thinkpad X1 Extreme 1 speakers & atmos dolby

>From Ivo Sbalzarini , thanks!



CVS: cvs.openbsd.org: src

2021-04-19 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/04/19 22:30:05

Modified files:
sys/dev/pci: azalia.c 

Log message:
Allow INTEL 400SERIES cAVS to attach the azalia(4) driver

>From Ivo Sbalzarini 



CVS: cvs.openbsd.org: src

2021-03-10 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/03/10 01:22:25

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: When a slot structure is recycled allocate new control

Trying to rename the program level control is not needed anymore.
When a slot is given to another program, the new ctl_{new,del}()
functions can be used to delete the control of the old program and
create a new one for the new program. Cleaner, simpler.



CVS: cvs.openbsd.org: src

2021-03-10 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/03/10 01:21:27

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Style tweak: swap if/else code blocks in slot_new()



CVS: cvs.openbsd.org: src

2021-03-08 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/03/08 02:42:50

Modified files:
usr.bin/sndiod : dev.c midi.c sndiod.c 

Log message:
sndiod: Use chronological order for {dev,port}_list

This simplifies the logic of the initialization code, makes debug
printfs nicer and could slightly ease futur development.

No behavior change.



CVS: cvs.openbsd.org: src

2021-03-08 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/03/08 02:38:36

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Initialize dev->master_enabled earlier

This is better style as since recently dev->master_enabled is used by
the ctlslot_xxx family functions which -- in the future -- could be
called with the device closed.

No behavior change.



CVS: cvs.openbsd.org: src

2021-03-08 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/03/08 02:35:08

Modified files:
usr.bin/sndiod : dev.c 

Log message:
sndiod: Style tweak: uniformize pattern to access ctlslot_array



CVS: cvs.openbsd.org: src

2021-03-03 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/03/03 03:19:06

Modified files:
usr.bin/sndiod : dev.c dev.h opt.c opt.h sock.c 

Log message:
sndiod: Move MTC/MMC state to its own global structure



CVS: cvs.openbsd.org: src

2021-03-03 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/03/03 03:13:06

Modified files:
usr.bin/sndiod : dev.c dev.h opt.c opt.h sock.c 

Log message:
sndiod: Move MIDI control endpoint to opt structure

No behavior change.



CVS: cvs.openbsd.org: src

2021-03-03 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/03/03 03:00:27

Modified files:
usr.bin/sndiod : dev.c dev.h dev_sioctl.c siofile.c sock.c 

Log message:
sndiod: Move controls out of the device structure

Moving to a global server-wide controls list is necessary to expose
controls that are not associated to a particular device (ex. a device
selector).

The current hack to use the device-side sioctl_desc->addr variable as
client-side key can't work anymore. So, we use a unique dynamically
allocated ctl->addr key; this is much cleaner. A new "scope" enum
(with two "void *" arguments) is used to determine what the control
does control. This adds flexibility and allows to easily add new
control types that are not associated to devices.

No behavior change.



CVS: cvs.openbsd.org: src

2021-03-03 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/03/03 02:40:43

Modified files:
usr.bin/sndioctl: sndioctl.c 

Log message:
sndioctl: Flush stdout before polling

If stdout is not flushed, output is not seen by programs using
sndioctl through a pipe (ex. "sndioctl -m | cat" displays nothing).

Patch from Erico Nogueira , idea
from Duncan Overbruck 



Re: CVS: cvs.openbsd.org: src

2021-03-02 Thread Alexandre Ratchov
On Tue, Mar 02, 2021 at 02:02:04PM +0100, Peter Hessler wrote:
> On 2021 Mar 02 (Tue) at 05:15:46 -0700 (-0700), Edd Barrett wrote:
> :Modified files:
> : usr.bin/sndiod : dev.c siofile.c 
> ...
> :We can only assume that if you deviate from defaults, then you know what
> :you are doing.
> 
> I notice that you didn't include any documentation on this.  Can you
> update the man page for how to use this, as I currently do not know what
> I am doing.

What we do when device lacks capabilities is not documented (yet). We
used to drop client connection; now we play/record silence to ease
seamless migration to/from play-only (or rec-only) devices without
disturbing programs.

Indeed, maybe it's worth adding a paragraph to describe what happens
if device doesn't support desired parameters & modes.



CVS: cvs.openbsd.org: src

2021-02-02 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/02/02 04:18:57

Modified files:
usr.bin/sndiod : dev.c 

Log message:
Fix use-after-free in dev_abort()

Fixes crash that can occur when an usb device is unplugged, found by edd@



CVS: cvs.openbsd.org: src

2021-01-29 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/29 04:38:23

Modified files:
usr.bin/sndiod : dev.c dev.h sock.c 

Log message:
Make audio clients use struct opt to reach the device

No behavior change. This decreases the number of explicit references
to the dev structure



CVS: cvs.openbsd.org: src

2021-01-29 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/29 04:36:44

Modified files:
usr.bin/sndiod : dev.c dev.h sock.c 

Log message:
Make control clients use struct opt to reach the device

No behavior change. This decreases the number of explicit references
to the dev structure.



CVS: cvs.openbsd.org: src

2021-01-29 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/29 04:31:28

Modified files:
usr.bin/sndiod : dev.c dev.h sock.c 

Log message:
Rename ctlslot->mask to ctlslot->self to match the rest of the code

No binary change.



CVS: cvs.openbsd.org: src

2021-01-29 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/29 04:25:05

Modified files:
usr.bin/sndiod : opt.c opt.h 

Log message:
Order opt_list in opt_new() call order, limit items to OPT_NMAX

No behavior change, except for improved debug printfs.



CVS: cvs.openbsd.org: src

2021-01-29 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/29 04:21:00

Modified files:
usr.bin/sndiod : dev.c dev.h opt.c opt.h sndiod.c 

Log message:
Move the options list out of the device structure

No behavior change. Later this will ease applying the configuration of
one device to another by "just" swapping pointers.



CVS: cvs.openbsd.org: src

2021-01-29 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/29 03:55:19

Modified files:
usr.bin/sndiod : dev.c dev.h sock.c 

Log message:
Move the control client state out of the device structure

No behavior change. Later this will ease changing the controlled
device by "just" swapping pointers.



CVS: cvs.openbsd.org: src

2021-01-29 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/29 03:51:24

Modified files:
usr.bin/sndiod : dev.c dev.h sndiod.c sock.c 

Log message:
Move the audio clients state out of the device structure

No behavior change. Later this will ease moving clients from one
device to another by "just" swapping pointers.



CVS: cvs.openbsd.org: src

2021-01-28 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/28 04:17:58

Modified files:
usr.bin/sndiod : dev.c midi.c midi.h miofile.c 

Log message:
When an audio device is disconnected, drop MIDI clients controlling it



CVS: cvs.openbsd.org: src

2021-01-28 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/28 04:15:31

Modified files:
usr.bin/sndiod : dev.c dev.h sock.c 

Log message:
Dont attempt to drain disconnected clients

Clients are always drained before they disconnect, so this change
affects programs that die unexpectedly or loose thier network
connection.

Besides the bad style, this change fixes a theoretical bug when the
disconnected client slot could be recycled and given to another client
while it's being drained



CVS: cvs.openbsd.org: src

2021-01-28 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/28 04:10:00

Modified files:
usr.bin/sndiod : dev.c 

Log message:
In slot_xxx(), store dev pointer in local variable

This removes many redundant dereferences to obtain the dev pointer
from the slot stucture and makes the source slightly more readable.
No behavior change.



CVS: cvs.openbsd.org: src

2021-01-28 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/28 04:06:58

Modified files:
usr.bin/sndiod : dev.c 

Log message:
Use everywhere the same pattern to handle fractional clock ticks

No behavior change; this change is only to make the maths easier to
proofread



CVS: cvs.openbsd.org: src

2021-01-28 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/28 04:06:07

Modified files:
usr.bin/sndiod : dev.c 

Log message:
Make slot_{attach,detach}() the opposite of each other

No bahavior change. Now, slot_attach() moves slot's clock forward and
puts the slot on device list; slot_detach() does the opposite: remove
from device list and move clock backwards. This will allow to detach a
client and attach it later in exactly the same state.



CVS: cvs.openbsd.org: src

2021-01-28 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/28 04:02:28

Modified files:
usr.bin/sndiod : dev.c dev.h 

Log message:
Drop unused dev_nctl() function and few unused prototypes



CVS: cvs.openbsd.org: src

2021-01-11 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/11 07:45:51

Modified files:
usr.bin/aucat  : dsp.c dsp.h 

Log message:
Use sndiod's 8-th order FIR low-pass filter for resampling

Removes most of the aliasing noise during resampling



CVS: cvs.openbsd.org: src

2021-01-11 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2021/01/11 07:26:00

Modified files:
usr.bin/sndiod : dsp.c dsp.h 

Log message:
Use a 8-th order FIR low-pass filter for resampling

At the expence of slightly more CPU cycles, it almost removes aliasing
noise in most practical use-cases.



CVS: cvs.openbsd.org: src

2020-12-10 Thread Alexandre Ratchov
CVSROOT:/cvs
Module name:src
Changes by: ratc...@cvs.openbsd.org 2020/12/10 10:30:49

Modified files:
usr.bin/sndiod : dsp.c 

Log message:
Check sample signedness when setting up format conversions.

Fixes confusion between s16 and u16 found in aucat by James Cook.



  1   2   3   4   5   6   7   8   9   10   >