Allow "snd/default" style syntax

This commit is contained in:
Alexandre Ratchov 2020-01-03 15:41:30 +01:00
parent d2057194b1
commit ddf18ab3e1
2 changed files with 10 additions and 6 deletions

View File

@ -45,9 +45,9 @@ sioctl_open(const char *str, unsigned int mode, int nbio)
if (hdl != NULL)
return hdl;
#if defined(USE_SUN_MIXER)
return _sioctl_sun_open("rsnd/0", mode, nbio);
return _sioctl_sun_open("rsnd/default", mode, nbio);
#elif defined(USE_ALSA_MIXER)
return _sioctl_alsa_open("rsnd/0", mode, nbio);
return _sioctl_alsa_open("rsnd/default", mode, nbio);
#else
return NULL;
#endif

View File

@ -294,10 +294,14 @@ sioctl_sun_getfd(const char *str, unsigned int mode, int nbio)
DPRINTF("sioctl_sun_getfd: %s: '/' expected\n", str);
return -1;
}
p = _sndio_parsenum(p, &devnum, 255);
if (p == NULL || *p != '\0') {
DPRINTF("sioctl_sun_getfd: %s: number expected after '/'\n", str);
return -1;
if (strcmp(p, "default") == 0) {
devnum = 0;
} else {
p = _sndio_parsenum(p, &devnum, 255);
if (p == NULL || *p != '\0') {
DPRINTF("sioctl_sun_getfd: %s: number expected after '/'\n", str);
return -1;
}
}
snprintf(path, sizeof(path), DEVPATH_PREFIX "%u", devnum);
if (mode == (SIOCTL_READ | SIOCTL_WRITE))