=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sndiod/miofile.c,v retrieving revision 1.5 retrieving revision 1.6 diff -c -r1.5 -r1.6 *** src/usr.bin/sndiod/miofile.c 2019/09/21 04:42:46 1.5 --- src/usr.bin/sndiod/miofile.c 2020/01/23 05:40:09 1.6 *************** *** 1,4 **** ! /* $OpenBSD: miofile.c,v 1.5 2019/09/21 04:42:46 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * --- 1,4 ---- ! /* $OpenBSD: miofile.c,v 1.6 2020/01/23 05:40:09 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * *************** *** 45,54 **** port_mio_hup }; int port_mio_open(struct port *p) { ! p->mio.hdl = fdpass_mio_open(p->num, p->midi->mode); if (p->mio.hdl == NULL) return 0; p->mio.file = file_new(&port_mio_ops, p, "port", mio_nfds(p->mio.hdl)); --- 45,85 ---- port_mio_hup }; + /* + * open the port using one of the provided paths + */ + static struct mio_hdl * + port_mio_openlist(struct port *c, unsigned int mode) + { + struct mio_hdl *hdl; + struct name *n; + int idx; + + idx = 0; + n = c->path_list; + while (1) { + if (n == NULL) + break; + hdl = fdpass_mio_open(c->num, idx, mode); + if (hdl != NULL) { + if (log_level >= 2) { + port_log(c); + log_puts(": using "); + log_puts(n->str); + log_puts("\n"); + } + return hdl; + } + n = n->next; + idx++; + } + return NULL; + } + int port_mio_open(struct port *p) { ! p->mio.hdl = port_mio_openlist(p, p->midi->mode); if (p->mio.hdl == NULL) return 0; p->mio.file = file_new(&port_mio_ops, p, "port", mio_nfds(p->mio.hdl)); *************** *** 64,70 **** { struct mio_hdl *hdl; ! hdl = fdpass_mio_open(p->num, p->midi->mode); if (hdl == NULL) { if (log_level >= 1) { port_log(p); --- 95,101 ---- { struct mio_hdl *hdl; ! hdl = port_mio_openlist(p, p->midi->mode); if (hdl == NULL) { if (log_level >= 1) { port_log(p);