sync with OpenBSD -current
This commit is contained in:
parent
c1d0febac8
commit
332472a19d
230 changed files with 822 additions and 1009 deletions
|
@ -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 */
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
major=7
|
||||
minor=2
|
||||
minor=3
|
||||
|
|
|
@ -87,6 +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, c->display, SIOCTL_DISPLAYMAX);
|
||||
desc.type = c->type;
|
||||
desc.addr = ntohs(c->addr);
|
||||
desc.maxval = ntohs(c->maxval);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: sioctl_open.3,v 1.13 2022/05/03 13:03:30 ratchov Exp $
|
||||
.\" $OpenBSD: sioctl_open.3,v 1.14 2024/05/24 15:10:27 ratchov Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2011-2020 Alexandre Ratchov <alex@caoua.org>
|
||||
.\"
|
||||
|
@ -14,7 +14,7 @@
|
|||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: May 3 2022 $
|
||||
.Dd $Mdocdate: May 24 2024 $
|
||||
.Dt SIOCTL_OPEN 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -168,6 +168,7 @@ struct sioctl_desc {
|
|||
struct sioctl_node node0; /* affected node */
|
||||
struct sioctl_node node1; /* dito for SIOCTL_{VEC,LIST,SEL} */
|
||||
unsigned int maxval; /* max value */
|
||||
char display[SIOCTL_DISPLAYMAX]; /* free-format hint */
|
||||
};
|
||||
.Ed
|
||||
.Pp
|
||||
|
@ -238,6 +239,11 @@ The
|
|||
.Fa maxval
|
||||
attribute indicates the maximum value of this control.
|
||||
For boolean control types it is set to 1.
|
||||
.Pp
|
||||
The
|
||||
.Fa display
|
||||
attribute contains an optional free-format string providing additional
|
||||
hints about the control, like the hardware model, or the units.
|
||||
.Ss Changing and reading control values
|
||||
Controls are changed with the
|
||||
.Fn sioctl_setval
|
||||
|
|
|
@ -53,6 +53,8 @@ struct volume
|
|||
|
||||
struct sioctl_sun_hdl {
|
||||
struct sioctl_hdl sioctl;
|
||||
char display[SIOCTL_DISPLAYMAX];
|
||||
int display_addr;
|
||||
struct volume output, input;
|
||||
int fd, events;
|
||||
};
|
||||
|
@ -147,6 +149,7 @@ init(struct sioctl_sun_hdl *hdl)
|
|||
{AudioCinputs, AudioNvolume},
|
||||
{AudioCinputs, AudioNinput}
|
||||
};
|
||||
struct audio_device getdev;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(output_names) / sizeof(output_names[0]); i++) {
|
||||
|
@ -165,6 +168,13 @@ init(struct sioctl_sun_hdl *hdl)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
hdl->display_addr = 128;
|
||||
if (ioctl(hdl->fd, AUDIO_GETDEV, &getdev) == -1)
|
||||
strlcpy(hdl->display, "unknown", SIOCTL_DISPLAYMAX);
|
||||
else
|
||||
strlcpy(hdl->display, getdev.name, SIOCTL_DISPLAYMAX);
|
||||
DPRINTF("init: server.device: display = %s\n", hdl->display);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -407,12 +417,27 @@ static int
|
|||
sioctl_sun_ondesc(struct sioctl_hdl *addr)
|
||||
{
|
||||
struct sioctl_sun_hdl *hdl = (struct sioctl_sun_hdl *)addr;
|
||||
struct sioctl_desc desc;
|
||||
|
||||
if (!scanvol(hdl, &hdl->output) ||
|
||||
!scanvol(hdl, &hdl->input)) {
|
||||
hdl->sioctl.eof = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* report "server.device" control */
|
||||
memset(&desc, 0, sizeof(struct sioctl_desc));
|
||||
desc.type = SIOCTL_SEL;
|
||||
desc.maxval = 1;
|
||||
strlcpy(desc.func, "device", SIOCTL_NAMEMAX);
|
||||
strlcpy(desc.node0.name, "server", SIOCTL_NAMEMAX);
|
||||
desc.node0.unit = -1;
|
||||
strlcpy(desc.node1.name, "0", SIOCTL_NAMEMAX);
|
||||
desc.node1.unit = -1;
|
||||
strlcpy(desc.display, hdl->display, SIOCTL_DISPLAYMAX);
|
||||
desc.addr = hdl->display_addr;
|
||||
_sioctl_ondesc_cb(&hdl->sioctl, &desc, 1);
|
||||
|
||||
_sioctl_ondesc_cb(&hdl->sioctl, NULL, 0);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue