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