diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-05-24 15:16:10 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2024-05-24 15:16:10 +0000 |
commit | 7957f4291d948a8edc6e4c19296e5e7aa45dd39c (patch) | |
tree | e268fa9ccb0d693c1ee7679f59f7ec19575d71e5 /lib/libsndio | |
parent | 090ac5cda1177ebde05424eafc3ce06a402c81a1 (diff) |
sndiod: Propagate the controls' display string to clients.
with help from edd@ and armani@
Diffstat (limited to 'lib/libsndio')
-rw-r--r-- | lib/libsndio/amsg.h | 15 | ||||
-rw-r--r-- | lib/libsndio/sioctl_aucat.c | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/libsndio/amsg.h b/lib/libsndio/amsg.h index 6d1a185fcbf..331f8113003 100644 --- a/lib/libsndio/amsg.h +++ b/lib/libsndio/amsg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: amsg.h,v 1.15 2022/04/29 08:30:48 ratchov Exp $ */ +/* $OpenBSD: amsg.h,v 1.16 2024/05/24 15:16:09 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -46,6 +46,13 @@ * limits */ #define AMSG_CTL_NAMEMAX 16 /* max name length */ +#define AMSG_CTL_DISPLAYMAX 32 /* max display string length */ + +/* + * Size of the struct amsg_ctl_desc expected by clients + * using the AMSG_CTLSUB_OLD request + */ +#define AMSG_OLD_DESC_SIZE 92 /* * WARNING: since the protocol may be simultaneously used by static @@ -69,9 +76,10 @@ struct amsg { #define AMSG_HELLO 10 /* say hello, check versions and so ... */ #define AMSG_BYE 11 /* ask server to drop connection */ #define AMSG_AUTH 12 /* send authentication cookie */ -#define AMSG_CTLSUB 13 /* ondesc/onctl subscription */ +#define AMSG_CTLSUB_OLD 13 /* amsg_ctl_desc with no "display" attribute */ #define AMSG_CTLSET 14 /* set control value */ #define AMSG_CTLSYNC 15 /* end of controls descriptions */ +#define AMSG_CTLSUB 16 /* ondesc/onctl subscription */ uint32_t cmd; uint32_t __pad; union { @@ -151,7 +159,8 @@ struct amsg_ctl_desc { uint16_t addr; /* control address */ uint16_t maxval; uint16_t curval; - uint32_t __pad2[3]; + uint32_t __pad2[4]; + char display[AMSG_CTL_DISPLAYMAX]; /* free-format hint */ }; /* diff --git a/lib/libsndio/sioctl_aucat.c b/lib/libsndio/sioctl_aucat.c index 241dcb70ffc..e912e45ac85 100644 --- a/lib/libsndio/sioctl_aucat.c +++ b/lib/libsndio/sioctl_aucat.c @@ -87,7 +87,7 @@ sioctl_aucat_rdata(struct sioctl_aucat_hdl *hdl) strlcpy(desc.node1.name, c->node1.name, SIOCTL_NAMEMAX); desc.node1.unit = (int16_t)ntohs(c->node1.unit); strlcpy(desc.func, c->func, SIOCTL_NAMEMAX); - strlcpy(desc.display, "", SIOCTL_DISPLAYMAX); + strlcpy(desc.display, c->display, SIOCTL_DISPLAYMAX); desc.type = c->type; desc.addr = ntohs(c->addr); desc.maxval = ntohs(c->maxval); |