mirror of https://github.com/ericonr/sndio.git
Rename sioctl_chan to sioctl_node
This commit is contained in:
parent
0031ec4a72
commit
f51534ae26
|
@ -128,7 +128,7 @@ struct amsg {
|
||||||
/*
|
/*
|
||||||
* subset of channels of a stream
|
* subset of channels of a stream
|
||||||
*/
|
*/
|
||||||
struct amsg_ctl_chan {
|
struct amsg_ctl_node {
|
||||||
char str[AMSG_CTL_NAMEMAX]; /* stream name */
|
char str[AMSG_CTL_NAMEMAX]; /* stream name */
|
||||||
int16_t unit; /* stream number */
|
int16_t unit; /* stream number */
|
||||||
uint8_t __pad[2];
|
uint8_t __pad[2];
|
||||||
|
@ -138,8 +138,8 @@ struct amsg_ctl_chan {
|
||||||
* description of a control (index, value) pair
|
* description of a control (index, value) pair
|
||||||
*/
|
*/
|
||||||
struct amsg_ctl_desc {
|
struct amsg_ctl_desc {
|
||||||
struct amsg_ctl_chan chan0; /* affected channels */
|
struct amsg_ctl_node node0; /* affected channels */
|
||||||
struct amsg_ctl_chan chan1; /* dito for AMSG_CTL_{SEL,VEC,LIST} */
|
struct amsg_ctl_node node1; /* dito for AMSG_CTL_{SEL,VEC,LIST} */
|
||||||
char func[AMSG_CTL_NAMEMAX]; /* parameter function name */
|
char func[AMSG_CTL_NAMEMAX]; /* parameter function name */
|
||||||
char group[AMSG_CTL_NAMEMAX]; /* group of the control */
|
char group[AMSG_CTL_NAMEMAX]; /* group of the control */
|
||||||
uint8_t type; /* see sioctl_desc structure */
|
uint8_t type; /* see sioctl_desc structure */
|
||||||
|
|
|
@ -164,9 +164,9 @@ _sioctl_ondesc_cb(struct sioctl_hdl *hdl,
|
||||||
if (desc) {
|
if (desc) {
|
||||||
DPRINTF("_sioctl_ondesc_cb: %u -> %s[%d].%s=%s[%d]:%d\n",
|
DPRINTF("_sioctl_ondesc_cb: %u -> %s[%d].%s=%s[%d]:%d\n",
|
||||||
desc->addr,
|
desc->addr,
|
||||||
desc->chan0.str, desc->chan0.unit,
|
desc->node0.str, desc->node0.unit,
|
||||||
desc->func,
|
desc->func,
|
||||||
desc->chan1.str, desc->chan1.unit,
|
desc->node1.str, desc->node1.unit,
|
||||||
val);
|
val);
|
||||||
}
|
}
|
||||||
if (hdl->desc_cb)
|
if (hdl->desc_cb)
|
||||||
|
|
|
@ -83,10 +83,10 @@ sioctl_aucat_rdata(struct sioctl_aucat_hdl *hdl)
|
||||||
rpos = 0;
|
rpos = 0;
|
||||||
while (rpos < hdl->buf_wpos) {
|
while (rpos < hdl->buf_wpos) {
|
||||||
strlcpy(desc.group, c->group, SIOCTL_NAMEMAX);
|
strlcpy(desc.group, c->group, SIOCTL_NAMEMAX);
|
||||||
strlcpy(desc.chan0.str, c->chan0.str, SIOCTL_NAMEMAX);
|
strlcpy(desc.node0.str, c->node0.str, SIOCTL_NAMEMAX);
|
||||||
desc.chan0.unit = (int16_t)ntohs(c->chan0.unit);
|
desc.node0.unit = (int16_t)ntohs(c->node0.unit);
|
||||||
strlcpy(desc.chan1.str, c->chan1.str, SIOCTL_NAMEMAX);
|
strlcpy(desc.node1.str, c->node1.str, SIOCTL_NAMEMAX);
|
||||||
desc.chan1.unit = (int16_t)ntohs(c->chan1.unit);
|
desc.node1.unit = (int16_t)ntohs(c->node1.unit);
|
||||||
strlcpy(desc.func, c->func, SIOCTL_NAMEMAX);
|
strlcpy(desc.func, c->func, SIOCTL_NAMEMAX);
|
||||||
desc.type = c->type;
|
desc.type = c->type;
|
||||||
desc.addr = ntohs(c->addr);
|
desc.addr = ntohs(c->addr);
|
||||||
|
|
|
@ -115,23 +115,23 @@ Controls are described by the
|
||||||
.Va sioctl_ondesc
|
.Va sioctl_ondesc
|
||||||
stucture as follows:
|
stucture as follows:
|
||||||
.Bd -literal
|
.Bd -literal
|
||||||
struct sioctl_chan {
|
struct sioctl_node {
|
||||||
char str[SIOCTL_NAMEMAX]; /* stream name */
|
char str[SIOCTL_NAMEMAX]; /* name, ex "spkr" */
|
||||||
int unit; /* optional number */
|
int unit; /* optional number or -1 */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sioctl_desc {
|
struct sioctl_desc {
|
||||||
unsigned int addr; /* control address */
|
unsigned int addr; /* control address */
|
||||||
#define SIOCTL_NONE 0 /* control deleted */
|
#define SIOCTL_NONE 0 /* deleted */
|
||||||
#define SIOCTL_NUM 2 /* integer in the 0..127 range */
|
#define SIOCTL_NUM 2 /* integer in the 0..127 range */
|
||||||
#define SIOCTL_SW 3 /* on/off switch (0 or 1) */
|
#define SIOCTL_SW 3 /* on/off switch (0 or 1) */
|
||||||
#define SIOCTL_VEC 4 /* number, element of vector */
|
#define SIOCTL_VEC 4 /* number, element of vector */
|
||||||
#define SIOCTL_LIST 5 /* switch, element of a list */
|
#define SIOCTL_LIST 5 /* switch, element of a list */
|
||||||
unsigned int type; /* one of above */
|
unsigned int type; /* one of above */
|
||||||
char func[SIOCTL_NAMEMAX]; /* function name */
|
char func[SIOCTL_NAMEMAX]; /* function name, ex. "level" */
|
||||||
char group[SIOCTL_NAMEMAX]; /* group this control belongs to */
|
char group[SIOCTL_NAMEMAX]; /* group this control belongs to */
|
||||||
struct sioctl_chan chan0; /* affected channels */
|
struct sioctl_node node0; /* affected node */
|
||||||
struct sioctl_chan chan1; /* dito for SIOCTL_{VEC,LIST} */
|
struct sioctl_node node1; /* dito for SIOCTL_{VEC,LIST} */
|
||||||
};
|
};
|
||||||
.Ed
|
.Ed
|
||||||
.Pp
|
.Pp
|
||||||
|
@ -149,7 +149,7 @@ Possible types are:
|
||||||
.It SIOCTL_NONE
|
.It SIOCTL_NONE
|
||||||
A previously valid control was deleted.
|
A previously valid control was deleted.
|
||||||
.It SIOCTL_NUM
|
.It SIOCTL_NUM
|
||||||
A continuous control in the 0..SIOCTL_INTMAX range.
|
A continuous control in the 0..SIOCTL_VALMAX range.
|
||||||
For instance the volume of the speaker.
|
For instance the volume of the speaker.
|
||||||
.It SIOCTL_SW
|
.It SIOCTL_SW
|
||||||
A on/off switch control.
|
A on/off switch control.
|
||||||
|
@ -170,26 +170,26 @@ attribute is the name of the parameter being controlled.
|
||||||
There may be no parameters of different types with the same name.
|
There may be no parameters of different types with the same name.
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Va chan0
|
.Va node0
|
||||||
and
|
and
|
||||||
.Va chan1
|
.Va node1
|
||||||
attributes indicate the names of the affected streams, and
|
attributes indicate the names of the controlled nodes, typically
|
||||||
an optional channel sub-set.
|
channels of audio streams.
|
||||||
.Va chan1
|
.Va node1
|
||||||
is meaningful for
|
is meaningful for
|
||||||
.Va SIOCTL_VEC
|
.Va SIOCTL_VEC
|
||||||
and
|
and
|
||||||
.Va SIOCTL_LIST
|
.Va SIOCTL_LIST
|
||||||
only.
|
only.
|
||||||
.Pp
|
.Pp
|
||||||
Stream names in the
|
Names in the
|
||||||
.Va chan0
|
.Va node0
|
||||||
and
|
and
|
||||||
.Va chan1
|
.Va node1
|
||||||
attributes and
|
attributes and
|
||||||
.Va func
|
.Va func
|
||||||
are strings usable as unique identifiers within the the given
|
are strings usable as unique identifiers within the the given
|
||||||
.Va namespace .
|
.Va group .
|
||||||
.Sh Changing and reading control values
|
.Sh Changing and reading control values
|
||||||
Controls are changed with the
|
Controls are changed with the
|
||||||
.Fn sioctl_setval
|
.Fn sioctl_setval
|
||||||
|
|
|
@ -234,12 +234,12 @@ scanvol(struct sioctl_sun_hdl *hdl, struct wskbd_vol *vol)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
desc.type = SIOCTL_NUM;
|
desc.type = SIOCTL_NUM;
|
||||||
desc.chan1.str[0] = 0;
|
desc.node1.str[0] = 0;
|
||||||
desc.chan1.unit = -1;
|
desc.node1.unit = -1;
|
||||||
strlcpy(desc.func, "level", SIOCTL_NAMEMAX);
|
strlcpy(desc.func, "level", SIOCTL_NAMEMAX);
|
||||||
strlcpy(desc.chan0.str, vol->name, SIOCTL_NAMEMAX);
|
strlcpy(desc.node0.str, vol->name, SIOCTL_NAMEMAX);
|
||||||
for (i = 0; i < vol->nch; i++) {
|
for (i = 0; i < vol->nch; i++) {
|
||||||
desc.chan0.unit = i;
|
desc.node0.unit = i;
|
||||||
desc.addr = vol->base_addr + i;
|
desc.addr = vol->base_addr + i;
|
||||||
val = SUN_TO_SIOCTL(ctrl.un.value.level[i]);
|
val = SUN_TO_SIOCTL(ctrl.un.value.level[i]);
|
||||||
vol->level_val[i] = val;
|
vol->level_val[i] = val;
|
||||||
|
@ -254,14 +254,14 @@ scanvol(struct sioctl_sun_hdl *hdl, struct wskbd_vol *vol)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
desc.type = SIOCTL_SW;
|
desc.type = SIOCTL_SW;
|
||||||
desc.chan1.str[0] = 0;
|
desc.node1.str[0] = 0;
|
||||||
desc.chan1.unit = -1;
|
desc.node1.unit = -1;
|
||||||
strlcpy(desc.func, "mute", SIOCTL_NAMEMAX);
|
strlcpy(desc.func, "mute", SIOCTL_NAMEMAX);
|
||||||
strlcpy(desc.chan0.str, vol->name, SIOCTL_NAMEMAX);
|
strlcpy(desc.node0.str, vol->name, SIOCTL_NAMEMAX);
|
||||||
val = ctrl.un.ord ? 1 : 0;
|
val = ctrl.un.ord ? 1 : 0;
|
||||||
vol->mute_val = val;
|
vol->mute_val = val;
|
||||||
for (i = 0; i < vol->nch; i++) {
|
for (i = 0; i < vol->nch; i++) {
|
||||||
desc.chan0.unit = i;
|
desc.node0.unit = i;
|
||||||
desc.addr = vol->base_addr + 32 + i;
|
desc.addr = vol->base_addr + 32 + i;
|
||||||
_sioctl_ondesc_cb(&hdl->sioctl, &desc, val);
|
_sioctl_ondesc_cb(&hdl->sioctl, &desc, val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
* limits
|
* limits
|
||||||
*/
|
*/
|
||||||
#define SIOCTL_NAMEMAX 12 /* max name length */
|
#define SIOCTL_NAMEMAX 12 /* max name length */
|
||||||
#define SIOCTL_VALMAX 127 /* max channel number */
|
#define SIOCTL_VALMAX 127 /* max control value */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* private ``handle'' structure
|
* private ``handle'' structure
|
||||||
|
@ -93,11 +93,11 @@ struct sio_cap {
|
||||||
#define SIO_XSTRINGS { "ignore", "sync", "error" }
|
#define SIO_XSTRINGS { "ignore", "sync", "error" }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* subset of channels of a stream
|
* controlled component of the device
|
||||||
*/
|
*/
|
||||||
struct sioctl_chan {
|
struct sioctl_node {
|
||||||
char str[SIOCTL_NAMEMAX]; /* stream name */
|
char str[SIOCTL_NAMEMAX]; /* name, ex "spkr" */
|
||||||
int unit; /* optional stream number */
|
int unit; /* optional number or -1 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -111,10 +111,10 @@ struct sioctl_desc {
|
||||||
#define SIOCTL_VEC 4 /* number, element of vector */
|
#define SIOCTL_VEC 4 /* number, element of vector */
|
||||||
#define SIOCTL_LIST 5 /* switch, element of a list */
|
#define SIOCTL_LIST 5 /* switch, element of a list */
|
||||||
unsigned int type; /* one of above */
|
unsigned int type; /* one of above */
|
||||||
char func[SIOCTL_NAMEMAX]; /* function name */
|
char func[SIOCTL_NAMEMAX]; /* function name, ex. "level" */
|
||||||
char group[SIOCTL_NAMEMAX]; /* group this control belongs to */
|
char group[SIOCTL_NAMEMAX]; /* group this control belongs to */
|
||||||
struct sioctl_chan chan0; /* affected channels */
|
struct sioctl_node node0; /* affected node */
|
||||||
struct sioctl_chan chan1; /* dito for SIOCTL_{VEC,LIST} */
|
struct sioctl_node node1; /* dito for SIOCTL_{VEC,LIST} */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -50,13 +50,13 @@ struct info *nextent(struct info *, int);
|
||||||
int matchpar(struct info *, char *, int);
|
int matchpar(struct info *, char *, int);
|
||||||
int matchent(struct info *, char *, int);
|
int matchent(struct info *, char *, int);
|
||||||
int ismono(struct info *);
|
int ismono(struct info *);
|
||||||
void print_chan(struct sioctl_chan *, int);
|
void print_node(struct sioctl_node *, int);
|
||||||
void print_desc(struct info *, int);
|
void print_desc(struct info *, int);
|
||||||
void print_val(struct info *, int);
|
void print_val(struct info *, int);
|
||||||
void print_par(struct info *, int, char *);
|
void print_par(struct info *, int, char *);
|
||||||
int parse_name(char **, char *);
|
int parse_name(char **, char *);
|
||||||
int parse_dec(char **, int *);
|
int parse_dec(char **, int *);
|
||||||
int parse_chan(char **, char *, int *);
|
int parse_node(char **, char *, int *);
|
||||||
int parse_modeval(char **, int *, int *);
|
int parse_modeval(char **, int *, int *);
|
||||||
void dump(void);
|
void dump(void);
|
||||||
int cmd(char *);
|
int cmd(char *);
|
||||||
|
@ -80,7 +80,7 @@ cmpdesc(struct sioctl_desc *d1, struct sioctl_desc *d2)
|
||||||
res = strcmp(d1->group, d2->group);
|
res = strcmp(d1->group, d2->group);
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
return res;
|
return res;
|
||||||
res = strcmp(d1->chan0.str, d2->chan0.str);
|
res = strcmp(d1->node0.str, d2->node0.str);
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
return res;
|
return res;
|
||||||
res = d1->type - d2->type;
|
res = d1->type - d2->type;
|
||||||
|
@ -89,15 +89,15 @@ cmpdesc(struct sioctl_desc *d1, struct sioctl_desc *d2)
|
||||||
res = strcmp(d1->func, d2->func);
|
res = strcmp(d1->func, d2->func);
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
return res;
|
return res;
|
||||||
res = d1->chan0.unit - d2->chan0.unit;
|
res = d1->node0.unit - d2->node0.unit;
|
||||||
if (d1->type == SIOCTL_VEC ||
|
if (d1->type == SIOCTL_VEC ||
|
||||||
d1->type == SIOCTL_LIST) {
|
d1->type == SIOCTL_LIST) {
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
return res;
|
return res;
|
||||||
res = strcmp(d1->chan1.str, d2->chan1.str);
|
res = strcmp(d1->node1.str, d2->node1.str);
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
return res;
|
return res;
|
||||||
res = d1->chan1.unit - d2->chan1.unit;
|
res = d1->node1.unit - d2->node1.unit;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -108,9 +108,9 @@ cmpdesc(struct sioctl_desc *d1, struct sioctl_desc *d2)
|
||||||
int
|
int
|
||||||
isdiag(struct info *e)
|
isdiag(struct info *e)
|
||||||
{
|
{
|
||||||
if (e->desc.chan0.unit < 0 || e->desc.chan1.unit < 0)
|
if (e->desc.node0.unit < 0 || e->desc.node1.unit < 0)
|
||||||
return 1;
|
return 1;
|
||||||
return e->desc.chan1.unit == e->desc.chan0.unit;
|
return e->desc.node1.unit == e->desc.node0.unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -120,8 +120,8 @@ struct info *
|
||||||
vecent(struct info *i, char *vstr, int vunit)
|
vecent(struct info *i, char *vstr, int vunit)
|
||||||
{
|
{
|
||||||
while (i != NULL) {
|
while (i != NULL) {
|
||||||
if ((strcmp(i->desc.chan1.str, vstr) == 0) &&
|
if ((strcmp(i->desc.node1.str, vstr) == 0) &&
|
||||||
(vunit < 0 || i->desc.chan1.unit == vunit))
|
(vunit < 0 || i->desc.node1.unit == vunit))
|
||||||
break;
|
break;
|
||||||
i = i->next;
|
i = i->next;
|
||||||
}
|
}
|
||||||
|
@ -138,10 +138,10 @@ nextfunc(struct info *i)
|
||||||
|
|
||||||
group = i->desc.group;
|
group = i->desc.group;
|
||||||
func = i->desc.func;
|
func = i->desc.func;
|
||||||
str = i->desc.chan0.str;
|
str = i->desc.node0.str;
|
||||||
for (i = i->next; i != NULL; i = i->next) {
|
for (i = i->next; i != NULL; i = i->next) {
|
||||||
if (strcmp(i->desc.group, group) != 0 ||
|
if (strcmp(i->desc.group, group) != 0 ||
|
||||||
strcmp(i->desc.chan0.str, str) != 0 ||
|
strcmp(i->desc.node0.str, str) != 0 ||
|
||||||
strcmp(i->desc.func, func) != 0)
|
strcmp(i->desc.func, func) != 0)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -159,15 +159,15 @@ nextpar(struct info *i)
|
||||||
|
|
||||||
group = i->desc.group;
|
group = i->desc.group;
|
||||||
func = i->desc.func;
|
func = i->desc.func;
|
||||||
str = i->desc.chan0.str;
|
str = i->desc.node0.str;
|
||||||
unit = i->desc.chan0.unit;
|
unit = i->desc.node0.unit;
|
||||||
for (i = i->next; i != NULL; i = i->next) {
|
for (i = i->next; i != NULL; i = i->next) {
|
||||||
if (strcmp(i->desc.group, group) != 0 ||
|
if (strcmp(i->desc.group, group) != 0 ||
|
||||||
strcmp(i->desc.chan0.str, str) != 0 ||
|
strcmp(i->desc.node0.str, str) != 0 ||
|
||||||
strcmp(i->desc.func, func) != 0)
|
strcmp(i->desc.func, func) != 0)
|
||||||
break;
|
break;
|
||||||
/* XXX: need to check for -1 ? */
|
/* XXX: need to check for -1 ? */
|
||||||
if (i->desc.chan0.unit != unit)
|
if (i->desc.node0.unit != unit)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -183,16 +183,16 @@ firstent(struct info *g, char *vstr)
|
||||||
struct info *i;
|
struct info *i;
|
||||||
|
|
||||||
group = g->desc.group;
|
group = g->desc.group;
|
||||||
astr = g->desc.chan0.str;
|
astr = g->desc.node0.str;
|
||||||
func = g->desc.func;
|
func = g->desc.func;
|
||||||
for (i = g; i != NULL; i = i->next) {
|
for (i = g; i != NULL; i = i->next) {
|
||||||
if (strcmp(i->desc.group, group) != 0 ||
|
if (strcmp(i->desc.group, group) != 0 ||
|
||||||
strcmp(i->desc.chan0.str, astr) != 0 ||
|
strcmp(i->desc.node0.str, astr) != 0 ||
|
||||||
strcmp(i->desc.func, func) != 0)
|
strcmp(i->desc.func, func) != 0)
|
||||||
break;
|
break;
|
||||||
if (!isdiag(i))
|
if (!isdiag(i))
|
||||||
continue;
|
continue;
|
||||||
if (strcmp(i->desc.chan1.str, vstr) == 0)
|
if (strcmp(i->desc.node1.str, vstr) == 0)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -211,16 +211,16 @@ nextent(struct info *i, int mono)
|
||||||
|
|
||||||
group = i->desc.group;
|
group = i->desc.group;
|
||||||
func = i->desc.func;
|
func = i->desc.func;
|
||||||
str = i->desc.chan0.str;
|
str = i->desc.node0.str;
|
||||||
unit = i->desc.chan0.unit;
|
unit = i->desc.node0.unit;
|
||||||
for (i = i->next; i != NULL; i = i->next) {
|
for (i = i->next; i != NULL; i = i->next) {
|
||||||
if (strcmp(i->desc.group, group) != 0 ||
|
if (strcmp(i->desc.group, group) != 0 ||
|
||||||
strcmp(i->desc.chan0.str, str) != 0 ||
|
strcmp(i->desc.node0.str, str) != 0 ||
|
||||||
strcmp(i->desc.func, func) != 0)
|
strcmp(i->desc.func, func) != 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (mono)
|
if (mono)
|
||||||
return i;
|
return i;
|
||||||
if (i->desc.chan0.unit == unit)
|
if (i->desc.node0.unit == unit)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -232,15 +232,15 @@ nextent(struct info *i, int mono)
|
||||||
int
|
int
|
||||||
matchpar(struct info *i, char *astr, int aunit)
|
matchpar(struct info *i, char *astr, int aunit)
|
||||||
{
|
{
|
||||||
if (strcmp(i->desc.chan0.str, astr) != 0)
|
if (strcmp(i->desc.node0.str, astr) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (aunit < 0)
|
if (aunit < 0)
|
||||||
return 1;
|
return 1;
|
||||||
else if (i->desc.chan0.unit < 0) {
|
else if (i->desc.node0.unit < 0) {
|
||||||
fprintf(stderr, "unit used for parameter with no unit\n");
|
fprintf(stderr, "unit used for parameter with no unit\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
return i->desc.chan0.unit == aunit;
|
return i->desc.node0.unit == aunit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -250,15 +250,15 @@ matchpar(struct info *i, char *astr, int aunit)
|
||||||
int
|
int
|
||||||
matchent(struct info *i, char *vstr, int vunit)
|
matchent(struct info *i, char *vstr, int vunit)
|
||||||
{
|
{
|
||||||
if (strcmp(i->desc.chan1.str, vstr) != 0)
|
if (strcmp(i->desc.node1.str, vstr) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (vunit < 0)
|
if (vunit < 0)
|
||||||
return 1;
|
return 1;
|
||||||
else if (i->desc.chan1.unit < 0) {
|
else if (i->desc.node1.unit < 0) {
|
||||||
fprintf(stderr, "unit used for parameter with no unit\n");
|
fprintf(stderr, "unit used for parameter with no unit\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
return i->desc.chan1.unit == vunit;
|
return i->desc.node1.unit == vunit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -289,8 +289,8 @@ ismono(struct info *g)
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
e1 = vecent(p1,
|
e1 = vecent(p1,
|
||||||
e2->desc.chan1.str,
|
e2->desc.node1.str,
|
||||||
p1->desc.chan0.unit);
|
p1->desc.node0.unit);
|
||||||
if (e1 == NULL)
|
if (e1 == NULL)
|
||||||
continue;
|
continue;
|
||||||
if (e1->curval != e2->curval)
|
if (e1->curval != e2->curval)
|
||||||
|
@ -307,7 +307,7 @@ ismono(struct info *g)
|
||||||
* print a sub-stream, eg. "spkr[4]"
|
* print a sub-stream, eg. "spkr[4]"
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
print_chan(struct sioctl_chan *c, int mono)
|
print_node(struct sioctl_node *c, int mono)
|
||||||
{
|
{
|
||||||
printf("%s", c->str);
|
printf("%s", c->str);
|
||||||
if (!mono && c->unit >= 0)
|
if (!mono && c->unit >= 0)
|
||||||
|
@ -335,12 +335,12 @@ print_desc(struct info *p, int mono)
|
||||||
if (mono) {
|
if (mono) {
|
||||||
if (!isdiag(e))
|
if (!isdiag(e))
|
||||||
continue;
|
continue;
|
||||||
if (e != firstent(p, e->desc.chan1.str))
|
if (e != firstent(p, e->desc.node1.str))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (more)
|
if (more)
|
||||||
printf(",");
|
printf(",");
|
||||||
print_chan(&e->desc.chan1, mono);
|
print_node(&e->desc.node1, mono);
|
||||||
printf(":*");
|
printf(":*");
|
||||||
more = 1;
|
more = 1;
|
||||||
}
|
}
|
||||||
|
@ -368,12 +368,12 @@ print_val(struct info *p, int mono)
|
||||||
if (mono) {
|
if (mono) {
|
||||||
if (!isdiag(e))
|
if (!isdiag(e))
|
||||||
continue;
|
continue;
|
||||||
if (e != firstent(p, e->desc.chan1.str))
|
if (e != firstent(p, e->desc.node1.str))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (more)
|
if (more)
|
||||||
printf(",");
|
printf(",");
|
||||||
print_chan(&e->desc.chan1, mono);
|
print_node(&e->desc.node1, mono);
|
||||||
printf(":%u", e->curval);
|
printf(":%u", e->curval);
|
||||||
more = 1;
|
more = 1;
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ print_par(struct info *p, int mono, char *comment)
|
||||||
printf("%s", p->desc.group);
|
printf("%s", p->desc.group);
|
||||||
printf("/");
|
printf("/");
|
||||||
}
|
}
|
||||||
print_chan(&p->desc.chan0, mono);
|
print_node(&p->desc.node0, mono);
|
||||||
printf(".%s=", p->desc.func);
|
printf(".%s=", p->desc.func);
|
||||||
if (i_flag)
|
if (i_flag)
|
||||||
print_desc(p, mono);
|
print_desc(p, mono);
|
||||||
|
@ -464,7 +464,7 @@ parse_dec(char **line, int *num)
|
||||||
* parse a sub-stream, eg. "spkr[7]"
|
* parse a sub-stream, eg. "spkr[7]"
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
parse_chan(char **line, char *str, int *unit)
|
parse_node(char **line, char *str, int *unit)
|
||||||
{
|
{
|
||||||
char *p = *line;
|
char *p = *line;
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ dump(void)
|
||||||
|
|
||||||
for (i = infolist; i != NULL; i = i->next) {
|
for (i = infolist; i != NULL; i = i->next) {
|
||||||
printf("%03u:", i->ctladdr);
|
printf("%03u:", i->ctladdr);
|
||||||
print_chan(&i->desc.chan0, 0);
|
print_node(&i->desc.node0, 0);
|
||||||
printf(".%s", i->desc.func);
|
printf(".%s", i->desc.func);
|
||||||
printf("=");
|
printf("=");
|
||||||
switch (i->desc.type) {
|
switch (i->desc.type) {
|
||||||
|
@ -541,7 +541,7 @@ dump(void)
|
||||||
break;
|
break;
|
||||||
case SIOCTL_VEC:
|
case SIOCTL_VEC:
|
||||||
case SIOCTL_LIST:
|
case SIOCTL_LIST:
|
||||||
print_chan(&i->desc.chan1, 0);
|
print_node(&i->desc.node1, 0);
|
||||||
printf(":* (%u)", i->curval);
|
printf(":* (%u)", i->curval);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -568,11 +568,11 @@ cmd(char *line)
|
||||||
if (*pos == '/')
|
if (*pos == '/')
|
||||||
pos++;
|
pos++;
|
||||||
else {
|
else {
|
||||||
/* this was chan string, go backwards and assume no group */
|
/* this was node string, go backwards and assume no group */
|
||||||
pos = line;
|
pos = line;
|
||||||
group[0] = '\0';
|
group[0] = '\0';
|
||||||
}
|
}
|
||||||
if (!parse_chan(&pos, astr, &aunit))
|
if (!parse_node(&pos, astr, &aunit))
|
||||||
return 0;
|
return 0;
|
||||||
if (*pos != '.') {
|
if (*pos != '.') {
|
||||||
fprintf(stderr, "'.' expected near '%s'\n", pos);
|
fprintf(stderr, "'.' expected near '%s'\n", pos);
|
||||||
|
@ -588,7 +588,7 @@ cmd(char *line)
|
||||||
}
|
}
|
||||||
if (strcmp(g->desc.group, group) == 0 &&
|
if (strcmp(g->desc.group, group) == 0 &&
|
||||||
strcmp(g->desc.func, func) == 0 &&
|
strcmp(g->desc.func, func) == 0 &&
|
||||||
strcmp(g->desc.chan0.str, astr) == 0)
|
strcmp(g->desc.node0.str, astr) == 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g->mode = MODE_PRINT;
|
g->mode = MODE_PRINT;
|
||||||
|
@ -638,7 +638,7 @@ cmd(char *line)
|
||||||
break;
|
break;
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
if (!parse_chan(&pos, vstr, &vunit))
|
if (!parse_node(&pos, vstr, &vunit))
|
||||||
return 0;
|
return 0;
|
||||||
if (*pos == ':') {
|
if (*pos == ':') {
|
||||||
pos++;
|
pos++;
|
||||||
|
@ -661,7 +661,7 @@ cmd(char *line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nent == 0) {
|
if (nent == 0) {
|
||||||
/* XXX: use print_chan()-like routine */
|
/* XXX: use print_node()-like routine */
|
||||||
fprintf(stderr, "%s[%d]: invalid value\n", vstr, vunit);
|
fprintf(stderr, "%s[%d]: invalid value\n", vstr, vunit);
|
||||||
print_par(g, 0, NULL);
|
print_par(g, 0, NULL);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
22
sndiod/dev.c
22
sndiod/dev.c
|
@ -93,7 +93,7 @@ void slot_write(struct slot *);
|
||||||
void slot_read(struct slot *);
|
void slot_read(struct slot *);
|
||||||
int slot_skip(struct slot *);
|
int slot_skip(struct slot *);
|
||||||
|
|
||||||
void ctl_chan_log(struct ctl_chan *);
|
void ctl_node_log(struct ctl_node *);
|
||||||
void ctl_log(struct ctl *);
|
void ctl_log(struct ctl *);
|
||||||
|
|
||||||
struct midiops dev_midiops = {
|
struct midiops dev_midiops = {
|
||||||
|
@ -2222,7 +2222,7 @@ ctlslot_del(struct ctlslot *s)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ctl_chan_log(struct ctl_chan *c)
|
ctl_node_log(struct ctl_node *c)
|
||||||
{
|
{
|
||||||
log_puts(c->str);
|
log_puts(c->str);
|
||||||
if (c->unit >= 0)
|
if (c->unit >= 0)
|
||||||
|
@ -2236,7 +2236,7 @@ ctl_log(struct ctl *c)
|
||||||
log_puts(c->group);
|
log_puts(c->group);
|
||||||
log_puts("/");
|
log_puts("/");
|
||||||
}
|
}
|
||||||
ctl_chan_log(&c->chan0);
|
ctl_node_log(&c->node0);
|
||||||
log_puts(".");
|
log_puts(".");
|
||||||
log_puts(c->func);
|
log_puts(c->func);
|
||||||
log_puts("=");
|
log_puts("=");
|
||||||
|
@ -2247,7 +2247,7 @@ ctl_log(struct ctl *c)
|
||||||
break;
|
break;
|
||||||
case CTL_VEC:
|
case CTL_VEC:
|
||||||
case CTL_LIST:
|
case CTL_LIST:
|
||||||
ctl_chan_log(&c->chan1);
|
ctl_node_log(&c->node1);
|
||||||
log_puts(":");
|
log_puts(":");
|
||||||
log_putu(c->curval);
|
log_putu(c->curval);
|
||||||
}
|
}
|
||||||
|
@ -2269,13 +2269,13 @@ dev_addctl(struct dev *d, char *gstr, int type, int addr,
|
||||||
c->type = type;
|
c->type = type;
|
||||||
strlcpy(c->func, func, CTL_NAMEMAX);
|
strlcpy(c->func, func, CTL_NAMEMAX);
|
||||||
strlcpy(c->group, gstr, CTL_NAMEMAX);
|
strlcpy(c->group, gstr, CTL_NAMEMAX);
|
||||||
strlcpy(c->chan0.str, str0, CTL_NAMEMAX);
|
strlcpy(c->node0.str, str0, CTL_NAMEMAX);
|
||||||
c->chan0.unit = unit0;
|
c->node0.unit = unit0;
|
||||||
if (c->type == CTL_VEC || c->type == CTL_LIST) {
|
if (c->type == CTL_VEC || c->type == CTL_LIST) {
|
||||||
strlcpy(c->chan1.str, str1, CTL_NAMEMAX);
|
strlcpy(c->node1.str, str1, CTL_NAMEMAX);
|
||||||
c->chan1.unit = unit1;
|
c->node1.unit = unit1;
|
||||||
} else
|
} else
|
||||||
memset(&c->chan1, 0, sizeof(struct ctl_chan));
|
memset(&c->node1, 0, sizeof(struct ctl_node));
|
||||||
c->addr = addr;
|
c->addr = addr;
|
||||||
c->val_mask = ~0;
|
c->val_mask = ~0;
|
||||||
c->desc_mask = ~0;
|
c->desc_mask = ~0;
|
||||||
|
@ -2419,9 +2419,9 @@ dev_label(struct dev *d, int i)
|
||||||
c = c->next;
|
c = c->next;
|
||||||
}
|
}
|
||||||
slot_ctlname(&d->slot[i], name, CTL_NAMEMAX);
|
slot_ctlname(&d->slot[i], name, CTL_NAMEMAX);
|
||||||
if (strcmp(c->chan0.str, name) == 0)
|
if (strcmp(c->node0.str, name) == 0)
|
||||||
return;
|
return;
|
||||||
strlcpy(c->chan0.str, name, CTL_NAMEMAX);
|
strlcpy(c->node0.str, name, CTL_NAMEMAX);
|
||||||
c->desc_mask = ~0;
|
c->desc_mask = ~0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,10 +130,10 @@ struct ctl {
|
||||||
#define CTL_NAMEMAX 16 /* max name lenght */
|
#define CTL_NAMEMAX 16 /* max name lenght */
|
||||||
char func[CTL_NAMEMAX]; /* parameter function name */
|
char func[CTL_NAMEMAX]; /* parameter function name */
|
||||||
char group[CTL_NAMEMAX]; /* group aka namespace */
|
char group[CTL_NAMEMAX]; /* group aka namespace */
|
||||||
struct ctl_chan {
|
struct ctl_node {
|
||||||
char str[CTL_NAMEMAX]; /* stream name */
|
char str[CTL_NAMEMAX]; /* stream name */
|
||||||
int unit;
|
int unit;
|
||||||
} chan0, chan1; /* affected channels */
|
} node0, node1; /* affected channels */
|
||||||
#define CTL_DEVMASK (1 << 31)
|
#define CTL_DEVMASK (1 << 31)
|
||||||
#define CTL_SLOTMASK(i) (1 << (i))
|
#define CTL_SLOTMASK(i) (1 << (i))
|
||||||
unsigned int val_mask;
|
unsigned int val_mask;
|
||||||
|
|
|
@ -80,8 +80,8 @@ dev_sioctl_ondesc(void *arg, struct sioctl_desc *desc, int val)
|
||||||
group = desc->group;
|
group = desc->group;
|
||||||
|
|
||||||
dev_addctl(d, group, desc->type, addr,
|
dev_addctl(d, group, desc->type, addr,
|
||||||
desc->chan0.str, desc->chan0.unit, desc->func,
|
desc->node0.str, desc->node0.unit, desc->func,
|
||||||
desc->chan1.str, desc->chan1.unit, val);
|
desc->node1.str, desc->node1.unit, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1534,12 +1534,12 @@ sock_buildmsg(struct sock *f)
|
||||||
c->val_mask &= ~mask;
|
c->val_mask &= ~mask;
|
||||||
strlcpy(desc->group, c->group,
|
strlcpy(desc->group, c->group,
|
||||||
AMSG_CTL_NAMEMAX);
|
AMSG_CTL_NAMEMAX);
|
||||||
strlcpy(desc->chan0.str, c->chan0.str,
|
strlcpy(desc->node0.str, c->node0.str,
|
||||||
AMSG_CTL_NAMEMAX);
|
AMSG_CTL_NAMEMAX);
|
||||||
desc->chan0.unit = ntohs(c->chan0.unit);
|
desc->node0.unit = ntohs(c->node0.unit);
|
||||||
strlcpy(desc->chan1.str, c->chan1.str,
|
strlcpy(desc->node1.str, c->node1.str,
|
||||||
AMSG_CTL_NAMEMAX);
|
AMSG_CTL_NAMEMAX);
|
||||||
desc->chan1.unit = ntohs(c->chan1.unit);
|
desc->node1.unit = ntohs(c->node1.unit);
|
||||||
desc->type = c->type;
|
desc->type = c->type;
|
||||||
strlcpy(desc->func, c->func, AMSG_CTL_NAMEMAX);
|
strlcpy(desc->func, c->func, AMSG_CTL_NAMEMAX);
|
||||||
desc->addr = htons(c->addr);
|
desc->addr = htons(c->addr);
|
||||||
|
|
|
@ -66,7 +66,7 @@ dev_ondesc(void *unused, struct sioctl_desc *desc, int val)
|
||||||
if (output_found)
|
if (output_found)
|
||||||
return;
|
return;
|
||||||
if (desc->group[0] == 0 &&
|
if (desc->group[0] == 0 &&
|
||||||
strcmp(desc->chan0.str, "output") == 0 &&
|
strcmp(desc->node0.str, "output") == 0 &&
|
||||||
strcmp(desc->func, "level") == 0) {
|
strcmp(desc->func, "level") == 0) {
|
||||||
output_found = 1;
|
output_found = 1;
|
||||||
output_addr = desc->addr;
|
output_addr = desc->addr;
|
||||||
|
|
Loading…
Reference in New Issue