summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2024-01-06 19:55:38 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2024-01-06 19:55:38 +0000
commitdc593372bfc4224c6cf91d2031d0ad0aeadaddfe (patch)
treea60e1d8c58100a6cd310c9140b1bb298ed769eb9
parent5e370061e07ff96868ead6138fa552f6c3a5c4bd (diff)
nusb/audio: name audio device as audioUxxxx/volumeUxxxx (thanks arne)
This allows having multiple audio devices.
-rw-r--r--sys/man/4/nusb8
-rw-r--r--sys/src/cmd/nusb/audio/audio.c7
2 files changed, 10 insertions, 5 deletions
diff --git a/sys/man/4/nusb b/sys/man/4/nusb
index e1d03a5c5..ad4cbd1b6 100644
--- a/sys/man/4/nusb
+++ b/sys/man/4/nusb
@@ -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,
diff --git a/sys/src/cmd/nusb/audio/audio.c b/sys/src/cmd/nusb/audio/audio.c
index 195bd6bd5..e11ac4db1 100644
--- a/sys/src/cmd/nusb/audio/audio.c
+++ b/sys/src/cmd/nusb/audio/audio.c
@@ -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);