nusb/audio: name audio device as audioUxxxx/volumeUxxxx (thanks arne)

This allows having multiple audio devices.
This commit is contained in:
cinap_lenrek 2024-01-06 19:55:38 +00:00
parent 5e370061e0
commit dc593372bf
2 changed files with 10 additions and 5 deletions

View file

@ -272,8 +272,12 @@ and
configures and manages a USB audio device.
It implements a file system (normally seen under
.BR /dev ),
compatible with
.IR audio (3).
exporting
.BN audioU N
and
.BI volumeU N
files that have the same semantics as
.IR audio (1)).
.SS Camera devices
.I Cam
configures and exposes a USB camera device's capabilities,

View file

@ -395,9 +395,9 @@ Foundaltc:
devctl(d, "sampledelay %d", audiodelay);
devctl(d, "hz %d", speed);
if(e->dir==Ein)
devctl(d, "name audioin");
devctl(d, "name audioinU%s", audiodev->hname);
else
devctl(d, "name audio");
devctl(d, "name audioU%s", audiodev->hname);
return d;
}
@ -549,7 +549,8 @@ main(int argc, char *argv[])
sysfatal("no output stream found");
fs.tree = alloctree(user, "usb", DMDIR|0555, nil);
createfile(fs.tree->root, "volume", user, 0666, nil);
snprint(buf, sizeof buf, "volumeU%s", audiodev->hname);
createfile(fs.tree->root, buf, user, 0666, nil);
snprint(buf, sizeof buf, "%d.audio", audiodev->id);
postsharesrv(&fs, nil, "usb", buf);