rename grp->func

This commit is contained in:
Alexandre Ratchov 2015-06-04 06:12:38 +02:00
parent fc071998df
commit 8468b9f0a0
12 changed files with 41 additions and 41 deletions

View File

@ -124,7 +124,7 @@ struct amsg_mix_chan {
struct amsg_mix_desc {
struct amsg_mix_chan chan0; /* affected channels */
struct amsg_mix_chan chan1; /* dito for AMSG_MIX_{SEL,VEC,LIST} */
char grp[AMSG_MIX_NAMEMAX]; /* parameter group name */
char func[AMSG_MIX_NAMEMAX]; /* parameter group name */
uint8_t type; /* see siomix_desc structure */
uint8_t __pad[1];
uint16_t addr; /* control address */

View File

@ -175,7 +175,7 @@ _siomix_ondesc_cb(struct siomix_hdl *hdl,
DPRINTF("%u -> %s[%s].%s=%s[%s]\n",
desc->addr,
desc->chan0.str, desc->chan0.opt,
desc->grp,
desc->func,
desc->chan1.str, desc->chan1.opt);
}
if (hdl->desc_cb)

View File

@ -78,7 +78,7 @@ siomix_aucat_rdata(struct siomix_aucat_hdl *hdl)
strlcpy(desc.chan0.opt, c->chan0.opt, SIOMIX_NAMEMAX);
strlcpy(desc.chan1.str, c->chan1.str, SIOMIX_NAMEMAX);
strlcpy(desc.chan1.opt, c->chan1.opt, SIOMIX_NAMEMAX);
strlcpy(desc.grp, c->grp, SIOMIX_NAMEMAX);
strlcpy(desc.func, c->func, SIOMIX_NAMEMAX);
desc.type = c->type;
desc.addr = ntohs(c->addr);
_siomix_ondesc_cb(&hdl->siomix, &desc, ntohs(c->curval));

View File

@ -129,7 +129,7 @@ struct siomix_desc {
#define SIOMIX_LIST 5 /* element of array of switches */
#define SIOMIX_LABEL 6 /* string attached to chan0 */
unsigned int type; /* one of above */
char grp[SIOMIX_NAMEMAX]; /* parameter group name */
char func[SIOMIX_NAMEMAX]; /* parameter group name */
struct siomix_chan chan0; /* affected channels */
struct siomix_chan chan1; /* dito for vec, and list */
};
@ -175,7 +175,7 @@ label is changing.
.El
.Pp
The
.Va grp
.Va func
attribute is the name of the parameter being controlled.
There may be no parameters of different types with the same name.
.Pp
@ -197,7 +197,7 @@ Stream names in the
and
.Va chan1
attributes and
.Va grp
.Va func
are static strings usable as unique identifiers.
.Sh Changing and reading control values
Controls are changed with the

View File

@ -261,7 +261,7 @@ copyname_num(struct siomix_sun_hdl *hdl,
sep = strchr(info->label.name, '_');
if (sep) {
strlcpy(desc->grp, "mix", SIOMIX_NAMEMAX);
strlcpy(desc->func, "mix", SIOMIX_NAMEMAX);
desc->type = SIOMIX_VEC;
len = sep - info->label.name;
if (len >= SIOMIX_NAMEMAX - 1)
@ -273,7 +273,7 @@ copyname_num(struct siomix_sun_hdl *hdl,
desc->chan1.str, rmin, rnum))
return 0;
} else {
strlcpy(desc->grp, "level", SIOMIX_NAMEMAX);
strlcpy(desc->func, "level", SIOMIX_NAMEMAX);
desc->type = SIOMIX_NUM;
istr = info->label.name;
if (!copy_ch(hdl, info->mixer_class, istr,
@ -299,7 +299,7 @@ copyname_enum(struct siomix_sun_hdl *hdl,
fprintf(stderr, "no separator\n");
return 0;
}
strlcpy(desc->grp, info->label.name, SIOMIX_NAMEMAX);
strlcpy(desc->func, info->label.name, SIOMIX_NAMEMAX);
while (info->prev >= 0)
info = hdl->info + info->prev;
if (!copy_ch(hdl, info->mixer_class, info->label.name,
@ -307,7 +307,7 @@ copyname_enum(struct siomix_sun_hdl *hdl,
return 0;
desc->chan1.str[0] = 0;
} else {
strlcpy(desc->grp, sep + 1, SIOMIX_NAMEMAX);
strlcpy(desc->func, sep + 1, SIOMIX_NAMEMAX);
len = sep - info->label.name;
if (len >= SIOMIX_NAMEMAX - 1)
return 0;
@ -322,9 +322,9 @@ copyname_enum(struct siomix_sun_hdl *hdl,
* certain cards expose adc[0-1].source and adc[2-3].source
* as different types, which we forbid.
*/
if (strcmp(desc->grp, "source") == 0) {
if (strcmp(desc->func, "source") == 0) {
if (info->type == AUDIO_MIXER_SET)
strlcpy(desc->grp, "sources", SIOMIX_NAMEMAX);
strlcpy(desc->func, "sources", SIOMIX_NAMEMAX);
}
return 1;
}
@ -367,7 +367,7 @@ enum_to_sw(struct mixer_devinfo *info, struct siomix_desc *desc)
if (strcmp(v0, "off") == 0 && strcmp(v1, "on") == 0)
goto make_sw;
if (strcmp(v0, "unplugged") == 0 && strcmp(v1, "plugged") == 0) {
strlcpy(desc->grp,
strlcpy(desc->func,
info->un.e.member[1].label.name,
SIOMIX_NAMEMAX);
goto make_sw;

View File

@ -112,7 +112,7 @@ struct siomix_desc {
#define SIOMIX_LIST 5 /* switch, element of a list */
#define SIOMIX_LABEL 6 /* label attached to chan0 */
unsigned int type; /* one of above */
char grp[SIOMIX_NAMEMAX]; /* parameter name or label */
char func[SIOMIX_NAMEMAX]; /* function name or label */
struct siomix_chan chan0; /* affected channels */
struct siomix_chan chan1; /* dito for SIOMIX_{VEC,LIST} */
};

View File

@ -85,7 +85,7 @@ cmpdesc(struct siomix_desc *d1, struct siomix_desc *d2)
res = d1->type - d2->type;
if (res != 0)
return res;
res = strcmp(d1->grp, d2->grp);
res = strcmp(d1->func, d2->func);
if (res != 0)
return res;
res = strcmp(d1->chan0.opt, d2->chan0.opt);
@ -149,13 +149,13 @@ vecent(struct info *i, char *vstr, char *vopt)
struct info *
nextgrp(struct info *i)
{
char *str, *grp;
char *str, *func;
grp = i->desc.grp;
func = i->desc.func;
str = i->desc.chan0.str;
for (i = i->next; i != NULL; i = i->next) {
if (strcmp(i->desc.chan0.str, str) != 0 ||
strcmp(i->desc.grp, grp) != 0)
strcmp(i->desc.func, func) != 0)
return i;
}
return NULL;
@ -167,14 +167,14 @@ nextgrp(struct info *i)
struct info *
nextpar(struct info *i)
{
char *str, *opt, *grp;
char *str, *opt, *func;
grp = i->desc.grp;
func = i->desc.func;
str = i->desc.chan0.str;
opt = i->desc.chan0.opt;
for (i = i->next; i != NULL; i = i->next) {
if (strcmp(i->desc.chan0.str, str) != 0 ||
strcmp(i->desc.grp, grp) != 0)
strcmp(i->desc.func, func) != 0)
break;
if (strcmp(i->desc.chan0.opt, opt) != 0)
return i;
@ -188,14 +188,14 @@ nextpar(struct info *i)
struct info *
firstent(struct info *g, char *vstr)
{
char *astr, *grp;
char *astr, *func;
struct info *i;
astr = g->desc.chan0.str;
grp = g->desc.grp;
func = g->desc.func;
for (i = g; i != NULL; i = i->next) {
if (strcmp(i->desc.chan0.str, astr) != 0 ||
strcmp(i->desc.grp, grp) != 0)
strcmp(i->desc.func, func) != 0)
break;
if (!isdiag(i))
continue;
@ -213,14 +213,14 @@ firstent(struct info *g, char *vstr)
struct info *
nextent(struct info *i, int mono)
{
char *str, *opt, *grp;
char *str, *opt, *func;
grp = i->desc.grp;
func = i->desc.func;
str = i->desc.chan0.str;
opt = i->desc.chan0.opt;
for (i = i->next; i != NULL; i = i->next) {
if (strcmp(i->desc.chan0.str, str) != 0 ||
strcmp(i->desc.grp, grp) != 0)
strcmp(i->desc.func, func) != 0)
return NULL;
if (mono)
return i;
@ -401,7 +401,7 @@ print_par(struct info *p, int mono)
int more;
print_chan(&p->desc.chan0, mono);
printf(".%s=", p->desc.grp);
printf(".%s=", p->desc.func);
if (i_flag)
print_desc(p, mono);
else
@ -419,7 +419,7 @@ print_par(struct info *p, int mono)
printf("\t#");
more = 1;
}
printf(" %s=%s", i->desc.grp, i->desc.chan1.str);
printf(" %s=%s", i->desc.func, i->desc.chan1.str);
}
}
}
@ -551,7 +551,7 @@ dump(void)
for (i = infolist; i != NULL; i = i->next) {
printf("%03u:", i->ctladdr);
print_chan(&i->desc.chan0, 0);
printf(".%s", i->desc.grp);
printf(".%s", i->desc.func);
printf("=");
switch (i->desc.type) {
case SIOMIX_LABEL:
@ -578,7 +578,7 @@ cmd(char *line)
{
char *pos = line;
struct info *i, *e, *g;
char grp[SIOMIX_NAMEMAX], astr[SIOMIX_NAMEMAX], vstr[SIOMIX_NAMEMAX];
char func[SIOMIX_NAMEMAX], astr[SIOMIX_NAMEMAX], vstr[SIOMIX_NAMEMAX];
char aopt[SIOMIX_NAMEMAX], vopt[SIOMIX_NAMEMAX];
unsigned val, npar = 0, nent = 0;
int comma, mode;
@ -590,14 +590,14 @@ cmd(char *line)
return 0;
}
pos++;
if (!parse_name(&pos, grp))
if (!parse_name(&pos, func))
return 0;
for (g = infolist;; g = g->next) {
if (g == NULL) {
fprintf(stderr, "%s.%s: no such group\n", astr, grp);
fprintf(stderr, "%s.%s: no such group\n", astr, func);
return 0;
}
if (strcmp(g->desc.grp, grp) == 0 &&
if (strcmp(g->desc.func, func) == 0 &&
strcmp(g->desc.chan0.str, astr) == 0)
break;
}

View File

@ -2042,7 +2042,7 @@ ctl_log(struct ctl *c)
{
ctl_chan_log(&c->chan0);
log_puts(".");
log_puts(c->grp);
log_puts(c->func);
log_puts("=");
switch (c->type) {
case CTL_NUM:
@ -2090,13 +2090,13 @@ dev_uniqname(struct dev *d, char *templ, char *name)
*/
struct ctl *
dev_addctl(struct dev *d, int type, int addr,
char *str0, char *opt0, char *grp, char *str1, char *opt1)
char *str0, char *opt0, char *func, char *str1, char *opt1)
{
struct ctl *c;
c = xmalloc(sizeof(struct ctl));
c->type = type;
strlcpy(c->grp, grp, CTL_NAMEMAX);
strlcpy(c->func, func, CTL_NAMEMAX);
strlcpy(c->chan0.str, str0, CTL_NAMEMAX);
strlcpy(c->chan0.opt, opt0, CTL_NAMEMAX);
if (c->type == CTL_VEC ||

View File

@ -114,7 +114,7 @@ struct ctl {
unsigned int type; /* one of above */
unsigned int addr; /* control address */
#define CTL_NAMEMAX 16 /* max name lenght */
char grp[CTL_NAMEMAX]; /* parameter group name */
char func[CTL_NAMEMAX]; /* parameter group name */
struct ctl_chan {
char str[CTL_NAMEMAX]; /* stream name */
char opt[CTL_NAMEMAX];

View File

@ -71,7 +71,7 @@ dev_siomix_ondesc(void *arg, struct siomix_desc *desc, int val)
return;
}
c = dev_addctl(d, desc->type, desc->addr,
desc->chan0.str, desc->chan0.opt, desc->grp,
desc->chan0.str, desc->chan0.opt, desc->func,
desc->chan1.str, desc->chan1.opt);
c->curval = val;
#ifdef DEBUG

View File

@ -1560,7 +1560,7 @@ sock_buildmsg(struct sock *f)
strlcpy(desc->chan1.opt, c->chan1.opt,
AMSG_MIX_NAMEMAX);
desc->type = c->type;
strlcpy(desc->grp, c->grp, AMSG_MIX_NAMEMAX);
strlcpy(desc->func, c->func, AMSG_MIX_NAMEMAX);
desc->addr = htons(c->addr);
desc->curval = htons(c->curval);
desc++;

View File

@ -66,7 +66,7 @@ mixer_ondesc(void *unused, struct siomix_desc *desc, int val)
if (master_found)
return;
if (strcmp(desc->chan0.str, "sndiod0") == 0 &&
strcmp(desc->grp, "level") == 0) {
strcmp(desc->func, "level") == 0) {
master_found = 1;
master_addr = desc->addr;
master_val = val;