1 /* $NetBSD: wsmouse.c,v 1.34 2003/11/28 13:19:46 drochner Exp $ */ 2 3 /* 4 * Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the following acknowledgement: 16 * This product includes software developed by Christopher G. Demetriou 17 * for the NetBSD Project. 18 * 4. The name of the author may not be used to endorse or promote products 19 * derived from this software without specific prior written permission 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 /* 34 * Copyright (c) 1992, 1993 35 * The Regents of the University of California. All rights reserved. 36 * 37 * This software was developed by the Computer Systems Engineering group 38 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 39 * contributed to Berkeley. 40 * 41 * All advertising materials mentioning features or use of this software 42 * must display the following acknowledgement: 43 * This product includes software developed by the University of 44 * California, Lawrence Berkeley Laboratory. 45 * 46 * Redistribution and use in source and binary forms, with or without 47 * modification, are permitted provided that the following conditions 48 * are met: 49 * 1. Redistributions of source code must retain the above copyright 50 * notice, this list of conditions and the following disclaimer. 51 * 2. Redistributions in binary form must reproduce the above copyright 52 * notice, this list of conditions and the following disclaimer in the 53 * documentation and/or other materials provided with the distribution. 54 * 3. Neither the name of the University nor the names of its contributors 55 * may be used to endorse or promote products derived from this software 56 * without specific prior written permission. 57 * 58 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 68 * SUCH DAMAGE. 69 * 70 * @(#)ms.c 8.1 (Berkeley) 6/11/93 71 */ 72 73 /* 74 * Mouse driver. 75 */ 76 77 #include <sys/cdefs.h> 78 __KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.34 2003/11/28 13:19:46 drochner Exp $"); 79 80 #include "wsmouse.h" 81 #include "wsdisplay.h" 82 #include "wsmux.h" 83 84 #include <sys/param.h> 85 #include <sys/conf.h> 86 #include <sys/ioctl.h> 87 #include <sys/fcntl.h> 88 #include <sys/kernel.h> 89 #include <sys/proc.h> 90 #include <sys/syslog.h> 91 #include <sys/systm.h> 92 #include <sys/tty.h> 93 #include <sys/signalvar.h> 94 #include <sys/device.h> 95 #include <sys/vnode.h> 96 97 #include <dev/wscons/wsconsio.h> 98 #include <dev/wscons/wsmousevar.h> 99 #include <dev/wscons/wseventvar.h> 100 #include <dev/wscons/wsmuxvar.h> 101 102 #if defined(WSMUX_DEBUG) && NWSMUX > 0 103 #define DPRINTF(x) if (wsmuxdebug) printf x 104 #define DPRINTFN(n,x) if (wsmuxdebug > (n)) printf x 105 extern int wsmuxdebug; 106 #else 107 #define DPRINTF(x) 108 #define DPRINTFN(n,x) 109 #endif 110 111 #define INVALID_X INT_MAX 112 #define INVALID_Y INT_MAX 113 #define INVALID_Z INT_MAX 114 115 struct wsmouse_softc { 116 struct wsevsrc sc_base; 117 118 const struct wsmouse_accessops *sc_accessops; 119 void *sc_accesscookie; 120 121 u_int sc_mb; /* mouse button state */ 122 u_int sc_ub; /* user button state */ 123 int sc_dx; /* delta-x */ 124 int sc_dy; /* delta-y */ 125 int sc_dz; /* delta-z */ 126 int sc_x; /* absolute-x */ 127 int sc_y; /* absolute-y */ 128 int sc_z; /* absolute-z */ 129 130 int sc_refcnt; 131 u_char sc_dying; /* device is being detached */ 132 }; 133 134 static int wsmouse_match(struct device *, struct cfdata *, void *); 135 static void wsmouse_attach(struct device *, struct device *, void *); 136 static int wsmouse_detach(struct device *, int); 137 static int wsmouse_activate(struct device *, enum devact); 138 139 static int wsmouse_do_ioctl(struct wsmouse_softc *, u_long, caddr_t, 140 int, struct proc *); 141 142 #if NWSMUX > 0 143 static int wsmouse_mux_open(struct wsevsrc *, struct wseventvar *); 144 static int wsmouse_mux_close(struct wsevsrc *); 145 #endif 146 147 static int wsmousedoioctl(struct device *, u_long, caddr_t, int, struct proc *); 148 149 static int wsmousedoopen(struct wsmouse_softc *, struct wseventvar *); 150 151 CFATTACH_DECL(wsmouse, sizeof (struct wsmouse_softc), 152 wsmouse_match, wsmouse_attach, wsmouse_detach, wsmouse_activate); 153 154 extern struct cfdriver wsmouse_cd; 155 156 dev_type_open(wsmouseopen); 157 dev_type_close(wsmouseclose); 158 dev_type_read(wsmouseread); 159 dev_type_ioctl(wsmouseioctl); 160 dev_type_poll(wsmousepoll); 161 dev_type_kqfilter(wsmousekqfilter); 162 163 const struct cdevsw wsmouse_cdevsw = { 164 wsmouseopen, wsmouseclose, wsmouseread, nowrite, wsmouseioctl, 165 nostop, notty, wsmousepoll, nommap, wsmousekqfilter, 166 }; 167 168 #if NWSMUX > 0 169 struct wssrcops wsmouse_srcops = { 170 WSMUX_MOUSE, 171 wsmouse_mux_open, wsmouse_mux_close, wsmousedoioctl, NULL, NULL 172 }; 173 #endif 174 175 /* 176 * Print function (for parent devices). 177 */ 178 int 179 wsmousedevprint(void *aux, const char *pnp) 180 { 181 182 if (pnp) 183 aprint_normal("wsmouse at %s", pnp); 184 return (UNCONF); 185 } 186 187 int 188 wsmouse_match(struct device *parent, struct cfdata *match, void *aux) 189 { 190 return (1); 191 } 192 193 void 194 wsmouse_attach(struct device *parent, struct device *self, void *aux) 195 { 196 struct wsmouse_softc *sc = (struct wsmouse_softc *)self; 197 struct wsmousedev_attach_args *ap = aux; 198 #if NWSMUX > 0 199 int mux, error; 200 #endif 201 202 sc->sc_accessops = ap->accessops; 203 sc->sc_accesscookie = ap->accesscookie; 204 205 #if NWSMUX > 0 206 sc->sc_base.me_ops = &wsmouse_srcops; 207 mux = sc->sc_base.me_dv.dv_cfdata->wsmousedevcf_mux; 208 if (mux >= 0) { 209 error = wsmux_attach_sc(wsmux_getmux(mux), &sc->sc_base); 210 if (error) 211 printf(" attach error=%d", error); 212 else 213 printf(" mux %d", mux); 214 } 215 #else 216 if (sc->sc_base.me_dv.dv_cfdata->wsmousedevcf_mux >= 0) 217 printf(" (mux ignored)"); 218 #endif 219 220 printf("\n"); 221 } 222 223 int 224 wsmouse_activate(struct device *self, enum devact act) 225 { 226 struct wsmouse_softc *sc = (struct wsmouse_softc *)self; 227 228 if (act == DVACT_DEACTIVATE) 229 sc->sc_dying = 1; 230 return (0); 231 } 232 233 /* 234 * Detach a mouse. To keep track of users of the softc we keep 235 * a reference count that's incremented while inside, e.g., read. 236 * If the mouse is active and the reference count is > 0 (0 is the 237 * normal state) we post an event and then wait for the process 238 * that had the reference to wake us up again. Then we blow away the 239 * vnode and return (which will deallocate the softc). 240 */ 241 int 242 wsmouse_detach(struct device *self, int flags) 243 { 244 struct wsmouse_softc *sc = (struct wsmouse_softc *)self; 245 struct wseventvar *evar; 246 int maj, mn; 247 int s; 248 249 #if NWSMUX > 0 250 /* Tell parent mux we're leaving. */ 251 if (sc->sc_base.me_parent != NULL) { 252 DPRINTF(("wsmouse_detach:\n")); 253 wsmux_detach_sc(&sc->sc_base); 254 } 255 #endif 256 257 /* If we're open ... */ 258 evar = sc->sc_base.me_evp; 259 if (evar != NULL && evar->io != NULL) { 260 s = spltty(); 261 if (--sc->sc_refcnt >= 0) { 262 /* Wake everyone by generating a dummy event. */ 263 if (++evar->put >= WSEVENT_QSIZE) 264 evar->put = 0; 265 WSEVENT_WAKEUP(evar); 266 /* Wait for processes to go away. */ 267 if (tsleep(sc, PZERO, "wsmdet", hz * 60)) 268 printf("wsmouse_detach: %s didn't detach\n", 269 sc->sc_base.me_dv.dv_xname); 270 } 271 splx(s); 272 } 273 274 /* locate the major number */ 275 maj = cdevsw_lookup_major(&wsmouse_cdevsw); 276 277 /* Nuke the vnodes for any open instances (calls close). */ 278 mn = self->dv_unit; 279 vdevgone(maj, mn, mn, VCHR); 280 281 return (0); 282 } 283 284 void 285 wsmouse_input(struct device *wsmousedev, u_int btns /* 0 is up */, 286 int x, int y, int z, u_int flags) 287 { 288 struct wsmouse_softc *sc = (struct wsmouse_softc *)wsmousedev; 289 struct wscons_event *ev; 290 struct wseventvar *evar; 291 int mb, ub, d, get, put, any; 292 293 /* 294 * Discard input if not open. 295 */ 296 evar = sc->sc_base.me_evp; 297 if (evar == NULL) 298 return; 299 300 #ifdef DIAGNOSTIC 301 if (evar->q == NULL) { 302 printf("wsmouse_input: evar->q=NULL\n"); 303 return; 304 } 305 #endif 306 307 #if NWSMUX > 0 308 DPRINTFN(5,("wsmouse_input: %s mux=%p, evar=%p\n", 309 sc->sc_base.me_dv.dv_xname, sc->sc_base.me_parent, evar)); 310 #endif 311 312 sc->sc_mb = btns; 313 if (!(flags & WSMOUSE_INPUT_ABSOLUTE_X)) 314 sc->sc_dx += x; 315 if (!(flags & WSMOUSE_INPUT_ABSOLUTE_Y)) 316 sc->sc_dy += y; 317 if (!(flags & WSMOUSE_INPUT_ABSOLUTE_Z)) 318 sc->sc_dz += z; 319 320 /* 321 * We have at least one event (mouse button, delta-X, or 322 * delta-Y; possibly all three, and possibly three separate 323 * button events). Deliver these events until we are out 324 * of changes or out of room. As events get delivered, 325 * mark them `unchanged'. 326 */ 327 ub = sc->sc_ub; 328 any = 0; 329 get = evar->get; 330 put = evar->put; 331 ev = &evar->q[put]; 332 333 /* NEXT prepares to put the next event, backing off if necessary */ 334 #define NEXT \ 335 if ((++put) % WSEVENT_QSIZE == get) { \ 336 put--; \ 337 goto out; \ 338 } 339 /* ADVANCE completes the `put' of the event */ 340 #define ADVANCE \ 341 ev++; \ 342 if (put >= WSEVENT_QSIZE) { \ 343 put = 0; \ 344 ev = &evar->q[0]; \ 345 } \ 346 any = 1 347 /* TIMESTAMP sets `time' field of the event to the current time */ 348 #define TIMESTAMP \ 349 do { \ 350 int s; \ 351 s = splhigh(); \ 352 TIMEVAL_TO_TIMESPEC(&time, &ev->time); \ 353 splx(s); \ 354 } while (0) 355 356 if (flags & WSMOUSE_INPUT_ABSOLUTE_X) { 357 if (sc->sc_x != x) { 358 NEXT; 359 ev->type = WSCONS_EVENT_MOUSE_ABSOLUTE_X; 360 ev->value = x; 361 TIMESTAMP; 362 ADVANCE; 363 sc->sc_x = x; 364 } 365 } else { 366 if (sc->sc_dx) { 367 NEXT; 368 ev->type = WSCONS_EVENT_MOUSE_DELTA_X; 369 ev->value = sc->sc_dx; 370 TIMESTAMP; 371 ADVANCE; 372 sc->sc_dx = 0; 373 } 374 } 375 if (flags & WSMOUSE_INPUT_ABSOLUTE_Y) { 376 if (sc->sc_y != y) { 377 NEXT; 378 ev->type = WSCONS_EVENT_MOUSE_ABSOLUTE_Y; 379 ev->value = y; 380 TIMESTAMP; 381 ADVANCE; 382 sc->sc_y = y; 383 } 384 } else { 385 if (sc->sc_dy) { 386 NEXT; 387 ev->type = WSCONS_EVENT_MOUSE_DELTA_Y; 388 ev->value = sc->sc_dy; 389 TIMESTAMP; 390 ADVANCE; 391 sc->sc_dy = 0; 392 } 393 } 394 if (flags & WSMOUSE_INPUT_ABSOLUTE_Z) { 395 if (sc->sc_z != z) { 396 NEXT; 397 ev->type = WSCONS_EVENT_MOUSE_ABSOLUTE_Z; 398 ev->value = z; 399 TIMESTAMP; 400 ADVANCE; 401 sc->sc_z = z; 402 } 403 } else { 404 if (sc->sc_dz) { 405 NEXT; 406 ev->type = WSCONS_EVENT_MOUSE_DELTA_Z; 407 ev->value = sc->sc_dz; 408 TIMESTAMP; 409 ADVANCE; 410 sc->sc_dz = 0; 411 } 412 } 413 414 mb = sc->sc_mb; 415 while ((d = mb ^ ub) != 0) { 416 /* 417 * Mouse button change. Find the first change and drop 418 * it into the event queue. 419 */ 420 NEXT; 421 ev->value = ffs(d) - 1; 422 423 KASSERT(ev->value >= 0); 424 425 d = 1 << ev->value; 426 ev->type = 427 (mb & d) ? WSCONS_EVENT_MOUSE_DOWN : WSCONS_EVENT_MOUSE_UP; 428 TIMESTAMP; 429 ADVANCE; 430 ub ^= d; 431 } 432 out: 433 if (any) { 434 sc->sc_ub = ub; 435 evar->put = put; 436 WSEVENT_WAKEUP(evar); 437 #if NWSMUX > 0 438 DPRINTFN(5,("wsmouse_input: %s wakeup evar=%p\n", 439 sc->sc_base.me_dv.dv_xname, evar)); 440 #endif 441 } 442 } 443 444 int 445 wsmouseopen(dev_t dev, int flags, int mode, struct proc *p) 446 { 447 struct wsmouse_softc *sc; 448 struct wseventvar *evar; 449 int error, unit; 450 451 unit = minor(dev); 452 if (unit >= wsmouse_cd.cd_ndevs || /* make sure it was attached */ 453 (sc = wsmouse_cd.cd_devs[unit]) == NULL) 454 return (ENXIO); 455 456 #if NWSMUX > 0 457 DPRINTF(("wsmouseopen: %s mux=%p p=%p\n", sc->sc_base.me_dv.dv_xname, 458 sc->sc_base.me_parent, p)); 459 #endif 460 461 if (sc->sc_dying) 462 return (EIO); 463 464 if ((flags & (FREAD | FWRITE)) == FWRITE) 465 return (0); /* always allow open for write 466 so ioctl() is possible. */ 467 468 if (sc->sc_base.me_evp != NULL) 469 return (EBUSY); 470 471 evar = &sc->sc_base.me_evar; 472 wsevent_init(evar); 473 sc->sc_base.me_evp = evar; 474 evar->io = p; 475 476 error = wsmousedoopen(sc, evar); 477 if (error) { 478 DPRINTF(("wsmouseopen: %s open failed\n", 479 sc->sc_base.me_dv.dv_xname)); 480 sc->sc_base.me_evp = NULL; 481 wsevent_fini(evar); 482 } 483 return (error); 484 } 485 486 int 487 wsmouseclose(dev_t dev, int flags, int mode, struct proc *p) 488 { 489 struct wsmouse_softc *sc = 490 (struct wsmouse_softc *)wsmouse_cd.cd_devs[minor(dev)]; 491 struct wseventvar *evar = sc->sc_base.me_evp; 492 493 if (evar == NULL) 494 /* not open for read */ 495 return (0); 496 sc->sc_base.me_evp = NULL; 497 (*sc->sc_accessops->disable)(sc->sc_accesscookie); 498 wsevent_fini(evar); 499 500 return (0); 501 } 502 503 int 504 wsmousedoopen(struct wsmouse_softc *sc, struct wseventvar *evp) 505 { 506 sc->sc_base.me_evp = evp; 507 sc->sc_x = INVALID_X; 508 sc->sc_y = INVALID_Y; 509 sc->sc_z = INVALID_Z; 510 511 /* enable the device, and punt if that's not possible */ 512 return (*sc->sc_accessops->enable)(sc->sc_accesscookie); 513 } 514 515 int 516 wsmouseread(dev_t dev, struct uio *uio, int flags) 517 { 518 struct wsmouse_softc *sc = wsmouse_cd.cd_devs[minor(dev)]; 519 int error; 520 521 if (sc->sc_dying) 522 return (EIO); 523 524 #ifdef DIAGNOSTIC 525 if (sc->sc_base.me_evp == NULL) { 526 printf("wsmouseread: evp == NULL\n"); 527 return (EINVAL); 528 } 529 #endif 530 531 sc->sc_refcnt++; 532 error = wsevent_read(sc->sc_base.me_evp, uio, flags); 533 if (--sc->sc_refcnt < 0) { 534 wakeup(sc); 535 error = EIO; 536 } 537 return (error); 538 } 539 540 int 541 wsmouseioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) 542 { 543 return (wsmousedoioctl(wsmouse_cd.cd_devs[minor(dev)], 544 cmd, data, flag, p)); 545 } 546 547 /* A wrapper around the ioctl() workhorse to make reference counting easy. */ 548 int 549 wsmousedoioctl(struct device *dv, u_long cmd, caddr_t data, int flag, 550 struct proc *p) 551 { 552 struct wsmouse_softc *sc = (struct wsmouse_softc *)dv; 553 int error; 554 555 sc->sc_refcnt++; 556 error = wsmouse_do_ioctl(sc, cmd, data, flag, p); 557 if (--sc->sc_refcnt < 0) 558 wakeup(sc); 559 return (error); 560 } 561 562 int 563 wsmouse_do_ioctl(struct wsmouse_softc *sc, u_long cmd, caddr_t data, 564 int flag, struct proc *p) 565 { 566 int error; 567 568 if (sc->sc_dying) 569 return (EIO); 570 571 /* 572 * Try the generic ioctls that the wsmouse interface supports. 573 */ 574 switch (cmd) { 575 case FIONBIO: /* we will remove this someday (soon???) */ 576 return (0); 577 578 case FIOASYNC: 579 if (sc->sc_base.me_evp == NULL) 580 return (EINVAL); 581 sc->sc_base.me_evp->async = *(int *)data != 0; 582 return (0); 583 584 case FIOSETOWN: 585 if (sc->sc_base.me_evp == NULL) 586 return (EINVAL); 587 if (-*(int *)data != sc->sc_base.me_evp->io->p_pgid 588 && *(int *)data != sc->sc_base.me_evp->io->p_pid) 589 return (EPERM); 590 return (0); 591 592 case TIOCSPGRP: 593 if (sc->sc_base.me_evp == NULL) 594 return (EINVAL); 595 if (*(int *)data != sc->sc_base.me_evp->io->p_pgid) 596 return (EPERM); 597 return (0); 598 } 599 600 /* 601 * Try the mouse driver for WSMOUSEIO ioctls. It returns -1 602 * if it didn't recognize the request. 603 */ 604 error = (*sc->sc_accessops->ioctl)(sc->sc_accesscookie, cmd, 605 data, flag, p); 606 return (error); /* may be EPASSTHROUGH */ 607 } 608 609 int 610 wsmousepoll(dev_t dev, int events, struct proc *p) 611 { 612 struct wsmouse_softc *sc = wsmouse_cd.cd_devs[minor(dev)]; 613 614 if (sc->sc_base.me_evp == NULL) 615 return (EINVAL); 616 return (wsevent_poll(sc->sc_base.me_evp, events, p)); 617 } 618 619 int 620 wsmousekqfilter(dev_t dev, struct knote *kn) 621 { 622 struct wsmouse_softc *sc = wsmouse_cd.cd_devs[minor(dev)]; 623 624 if (sc->sc_base.me_evp == NULL) 625 return (1); 626 return (wsevent_kqfilter(sc->sc_base.me_evp, kn)); 627 } 628 629 #if NWSMUX > 0 630 int 631 wsmouse_mux_open(struct wsevsrc *me, struct wseventvar *evp) 632 { 633 struct wsmouse_softc *sc = (struct wsmouse_softc *)me; 634 635 if (sc->sc_base.me_evp != NULL) 636 return (EBUSY); 637 638 return wsmousedoopen(sc, evp); 639 } 640 641 int 642 wsmouse_mux_close(struct wsevsrc *me) 643 { 644 struct wsmouse_softc *sc = (struct wsmouse_softc *)me; 645 646 sc->sc_base.me_evp = NULL; 647 (*sc->sc_accessops->disable)(sc->sc_accesscookie); 648 649 return (0); 650 } 651 652 int 653 wsmouse_add_mux(int unit, struct wsmux_softc *muxsc) 654 { 655 struct wsmouse_softc *sc; 656 657 if (unit < 0 || unit >= wsmouse_cd.cd_ndevs || 658 (sc = wsmouse_cd.cd_devs[unit]) == NULL) 659 return (ENXIO); 660 661 if (sc->sc_base.me_parent != NULL || sc->sc_base.me_evp != NULL) 662 return (EBUSY); 663 664 return (wsmux_attach_sc(muxsc, &sc->sc_base)); 665 } 666 #endif /* NWSMUX > 0 */ 667