=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sndioctl/sndioctl.c,v retrieving revision 1.13 retrieving revision 1.14 diff -c -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 **** ! /* $OpenBSD: sndioctl.c,v 1.13 2020/06/18 05:33:16 ratchov Exp $ */ /* * Copyright (c) 2014-2020 Alexandre Ratchov * --- 1,4 ---- ! /* $OpenBSD: sndioctl.c,v 1.14 2020/06/28 05:17:26 ratchov Exp $ */ /* * Copyright (c) 2014-2020 Alexandre Ratchov * *************** *** 103,109 **** if (res != 0) return res; res = d1->node0.unit - d2->node0.unit; ! if (d1->type == SIOCTL_VEC || d1->type == SIOCTL_LIST) { if (res != 0) return res; --- 103,110 ---- if (res != 0) return res; res = d1->node0.unit - d2->node0.unit; ! if (d1->type == SIOCTL_SEL || ! d1->type == SIOCTL_VEC || d1->type == SIOCTL_LIST) { if (res != 0) return res; *************** *** 293,298 **** --- 294,300 ---- return 0; } break; + case SIOCTL_SEL: case SIOCTL_VEC: case SIOCTL_LIST: for (p2 = g; p2 != NULL; p2 = nextpar(p2)) { *************** *** 341,346 **** --- 343,349 ---- case SIOCTL_SW: printf("*"); break; + case SIOCTL_SEL: case SIOCTL_VEC: case SIOCTL_LIST: more = 0; *************** *** 354,360 **** if (more) printf(","); print_node(&e->desc.node1, mono); ! printf(":*"); more = 1; } } --- 357,364 ---- if (more) printf(","); print_node(&e->desc.node1, mono); ! if (p->desc.type != SIOCTL_SEL) ! printf(":*"); more = 1; } } *************** *** 390,395 **** --- 394,400 ---- case SIOCTL_NONE: printf("\n"); break; + case SIOCTL_SEL: case SIOCTL_VEC: case SIOCTL_LIST: print_node(&e->desc.node1, 0); *************** *** 418,423 **** --- 423,429 ---- case SIOCTL_SW: print_num(p); break; + case SIOCTL_SEL: case SIOCTL_VEC: case SIOCTL_LIST: more = 0; *************** *** 617,622 **** --- 623,631 ---- 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,701 **** --- 705,711 ---- npar++; } break; + case SIOCTL_SEL: case SIOCTL_VEC: case SIOCTL_LIST: for (i = g; i != NULL; i = nextpar(i)) { *************** *** 853,858 **** --- 863,869 ---- case SIOCTL_SW: case SIOCTL_VEC: case SIOCTL_LIST: + case SIOCTL_SEL: break; default: return; *************** *** 892,908 **** void onctl(void *arg, unsigned addr, unsigned val) { ! struct info *i; ! 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"); ! } } } int --- 903,938 ---- void onctl(void *arg, unsigned addr, unsigned val) { ! struct info *i, *j; ! 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