From f745d4103202d37f13e9a275d764d43908f5575d Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Sun, 10 Jan 2016 12:05:17 +0100 Subject: [PATCH] revert back to single device by default --- sndiod/sndiod.8 | 23 +++++++++++++++-------- sndiod/sndiod.c | 17 +++-------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/sndiod/sndiod.8 b/sndiod/sndiod.8 index 488d5b0..74ac1f0 100644 --- a/sndiod/sndiod.8 +++ b/sndiod/sndiod.8 @@ -350,22 +350,29 @@ to which they are attached. .Pp If no audio devices .Pq Fl f -are specified, first 4 audio devices are added and -settings are applied to all of them. -Similarly, if no MIDI ports -.Pq Fl q -are specified, first 8 MIDI ports are added and -settings are applied to all of them. +are specified, +settings are applied as if +the default device is specified. If no sub-devices .Pq Fl s are specified for a device, a default sub-device is created attached to it. -If a device or MIDI port -.Pq Fl fq +If a device +.Pq Fl f is defined twice, both definitions are merged: parameters of the first one are used but sub-devices .Pq Fl s of both definitions are created. +The default +.Xr sndio 7 +device used by +.Nm +is +.Pa rsnd/0 , +and the default sub-device exposed by +.Nm +is +.Pa snd/0 . .Pp If .Nm diff --git a/sndiod/sndiod.c b/sndiod/sndiod.c index ca55e32..e0b6672 100644 --- a/sndiod/sndiod.c +++ b/sndiod/sndiod.c @@ -338,8 +338,7 @@ main(int argc, char **argv) int c, background, unit; int pmin, pmax, rmin, rmax; char base[SOCKPATH_MAX], path[SOCKPATH_MAX]; - char loc[32]; - unsigned int mode, dup, mmc, vol, i; + unsigned int mode, dup, mmc, vol; unsigned int hold, autovol, bufsz, round, rate; const char *str; struct aparams par; @@ -466,18 +465,8 @@ main(int argc, char **argv) fputs(usagestr, stderr); return 1; } - if (dev_list == NULL) { - for (i = 0; i < 4; i++) { - snprintf(loc, sizeof(loc), "rsnd/%u", i); - mkdev(loc, &par, 0, bufsz, round, rate, hold, autovol); - } - } - if (port_list == NULL) { - for (i = 0; i < 8; i++) { - snprintf(loc, sizeof(loc), "rmidi/%u", i); - mkport(loc, hold); - } - } + if (dev_list == NULL) + mkdev(DEFAULT_DEV, &par, 0, bufsz, round, rate, hold, autovol); for (d = dev_list; d != NULL; d = d->next) { if (opt_byname("default", d->num)) continue;