=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sndioctl/sndioctl.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- src/usr.bin/sndioctl/sndioctl.c 2020/06/18 05:33:16 1.13 +++ src/usr.bin/sndioctl/sndioctl.c 2020/06/28 05:17:26 1.14 @@ -1,4 +1,4 @@ -/* $OpenBSD: sndioctl.c,v 1.13 2020/06/18 05:33:16 ratchov Exp $ */ +/* $OpenBSD: sndioctl.c,v 1.14 2020/06/28 05:17:26 ratchov Exp $ */ /* * Copyright (c) 2014-2020 Alexandre Ratchov * @@ -103,7 +103,8 @@ if (res != 0) return res; res = d1->node0.unit - d2->node0.unit; - if (d1->type == SIOCTL_VEC || + if (d1->type == SIOCTL_SEL || + d1->type == SIOCTL_VEC || d1->type == SIOCTL_LIST) { if (res != 0) return res; @@ -293,6 +294,7 @@ return 0; } break; + case SIOCTL_SEL: case SIOCTL_VEC: case SIOCTL_LIST: for (p2 = g; p2 != NULL; p2 = nextpar(p2)) { @@ -341,6 +343,7 @@ case SIOCTL_SW: printf("*"); break; + case SIOCTL_SEL: case SIOCTL_VEC: case SIOCTL_LIST: more = 0; @@ -354,7 +357,8 @@ if (more) printf(","); print_node(&e->desc.node1, mono); - printf(":*"); + if (p->desc.type != SIOCTL_SEL) + printf(":*"); more = 1; } } @@ -390,6 +394,7 @@ case SIOCTL_NONE: printf("\n"); break; + case SIOCTL_SEL: case SIOCTL_VEC: case SIOCTL_LIST: print_node(&e->desc.node1, 0); @@ -418,6 +423,7 @@ case SIOCTL_SW: print_num(p); break; + case SIOCTL_SEL: case SIOCTL_VEC: case SIOCTL_LIST: more = 0; @@ -617,6 +623,9 @@ case SIOCTL_SW: printf("0..%d (%u)", i->desc.maxval, i->curval); break; + case SIOCTL_SEL: + print_node(&i->desc.node1, 0); + break; case SIOCTL_VEC: case SIOCTL_LIST: print_node(&i->desc.node1, 0); @@ -696,6 +705,7 @@ npar++; } break; + case SIOCTL_SEL: case SIOCTL_VEC: case SIOCTL_LIST: for (i = g; i != NULL; i = nextpar(i)) { @@ -853,6 +863,7 @@ case SIOCTL_SW: case SIOCTL_VEC: case SIOCTL_LIST: + case SIOCTL_SEL: break; default: return; @@ -892,17 +903,36 @@ void onctl(void *arg, unsigned addr, unsigned val) { - struct info *i; + struct info *i, *j; - for (i = infolist; i != NULL; i = i->next) { - if (i->ctladdr != addr) - continue; - if (i->curval != val) { - i->curval = val; - if (m_flag) - print_ent(i, "changed"); - } + i = infolist; + for (;;) { + if (i == NULL) + return; + if (i->ctladdr == addr) + break; + i = i->next; } + + if (i->curval == val) { + print_ent(i, "eq"); + return; + } + + if (i->desc.type == SIOCTL_SEL) { + for (j = infolist; j != NULL; j = j->next) { + if (strcmp(i->desc.group, j->desc.group) != 0 || + strcmp(i->desc.node0.name, j->desc.node0.name) != 0 || + strcmp(i->desc.func, j->desc.func) != 0 || + i->desc.node0.unit != j->desc.node0.unit) + continue; + j->curval = (i->ctladdr == j->ctladdr); + } + } else + i->curval = val; + + if (m_flag) + print_ent(i, "changed"); } int