Document sioctl_desc structure maxval attribute

This commit is contained in:
Alexandre Ratchov 2020-06-16 07:34:03 +02:00
parent 0c3fd96693
commit 41b654cfe7
2 changed files with 19 additions and 5 deletions

View File

@ -123,7 +123,7 @@ struct sioctl_node {
struct sioctl_desc {
unsigned int addr; /* control address */
#define SIOCTL_NONE 0 /* deleted */
#define SIOCTL_NUM 2 /* integer in the 0..127 range */
#define SIOCTL_NUM 2 /* integer in the maxval range */
#define SIOCTL_SW 3 /* on/off switch (0 or 1) */
#define SIOCTL_VEC 4 /* number, element of vector */
#define SIOCTL_LIST 5 /* switch, element of a list */
@ -132,6 +132,7 @@ struct sioctl_desc {
char group[SIOCTL_NAMEMAX]; /* group this control belongs to */
struct sioctl_node node0; /* affected node */
struct sioctl_node node1; /* dito for SIOCTL_{VEC,LIST} */
unsigned int maxval; /* max value */
};
.Ed
.Pp
@ -149,7 +150,11 @@ Possible types are:
.It SIOCTL_NONE
A previously valid control was deleted.
.It SIOCTL_NUM
A continuous control in the 0..SIOCTL_VALMAX range.
A continuous control in the
.Sm 0 ..
.Va maxval
.Sm
range.
For instance the volume of the speaker.
.It SIOCTL_SW
A on/off switch control.
@ -190,6 +195,11 @@ attributes and
.Va func
are strings usable as unique identifiers within the the given
.Va group .
.Pp
The
.Va maxval
attribute indicates the maximum value of this control.
For boolean control types it is set to 1.
.Sh Changing and reading control values
Controls are changed with the
.Fn sioctl_setval
@ -198,7 +208,11 @@ The
.Fn sioctl_onval
function can be used to register a call-back which will be invoked whenever
a control changes.
Continuous values are in the 0..127 range.
Continuous values are in the
.Sm 0 ..
.Va maxval
.Sm
range.
.Sh "Interface to" Xr poll 2
The
.Fn sioctl_pollfd

View File

@ -104,7 +104,7 @@ struct sioctl_node {
struct sioctl_desc {
unsigned int addr; /* control address */
#define SIOCTL_NONE 0 /* deleted */
#define SIOCTL_NUM 2 /* integer in the 0..127 range */
#define SIOCTL_NUM 2 /* integer in the 0..maxval range */
#define SIOCTL_SW 3 /* on/off switch (0 or 1) */
#define SIOCTL_VEC 4 /* number, element of vector */
#define SIOCTL_LIST 5 /* switch, element of a list */
@ -113,7 +113,7 @@ struct sioctl_desc {
char group[SIOCTL_NAMEMAX]; /* group this control belongs to */
struct sioctl_node node0; /* affected node */
struct sioctl_node node1; /* dito for SIOCTL_{VEC,LIST} */
unsigned int maxval; /* max value for SIOCTL_{NUM,VEC} */
unsigned int maxval; /* max value */
int __pad[3];
};