-/* $OpenBSD: bthidev.c,v 1.7 2010/07/02 15:01:10 blambert Exp $ */
+/* $OpenBSD: bthidev.c,v 1.8 2010/08/05 13:13:17 miod Exp $ */
/* $NetBSD: bthidev.c,v 1.16 2008/08/06 15:01:23 plunky Exp $ */
/*-
void bthidev_timeout(void *);
int bthidev_listen(struct bthidev_softc *);
int bthidev_connect(struct bthidev_softc *);
-int bthidev_output(struct bthidev *, uint8_t *, int);
+int bthidev_output(struct bthidev *, uint8_t *, int, int);
void bthidev_null(struct bthidev *, uint8_t *, int);
/* autoconf(9) glue */
}
int
-bthidev_output(struct bthidev *hidev, uint8_t *report, int rlen)
+bthidev_output(struct bthidev *hidev, uint8_t *report, int rlen, int nolock)
{
struct bthidev_softc *sc = (struct bthidev_softc *)hidev->sc_parent;
struct mbuf *m;
memcpy(mtod(m, uint8_t *) + 2, report, rlen);
m->m_pkthdr.len = m->m_len = rlen + 2;
- mutex_enter(&bt_lock);
+ if (!nolock)
+ mutex_enter(&bt_lock);
err = l2cap_send(sc->sc_int, m);
- mutex_exit(&bt_lock);
+ if (!nolock)
+ mutex_exit(&bt_lock);
return err;
}
-/* $OpenBSD: bthidev.h,v 1.3 2008/02/24 21:46:19 uwe Exp $ */
+/* $OpenBSD: bthidev.h,v 1.4 2010/08/05 13:13:17 miod Exp $ */
/* $NetBSD: bthidev.h,v 1.4 2007/11/03 17:41:03 plunky Exp $ */
/*-
void (*ba_feature) /* feature method */
(struct bthidev *, uint8_t *, int);
int (*ba_output) /* output method */
- (struct bthidev *, uint8_t *, int);
+ (struct bthidev *, uint8_t *, int, int);
};
#endif /* _KERNEL */
-/* $OpenBSD: btkbd.c,v 1.6 2010/07/31 16:04:50 miod Exp $ */
+/* $OpenBSD: btkbd.c,v 1.7 2010/08/05 13:13:17 miod Exp $ */
/* $NetBSD: btkbd.c,v 1.10 2008/09/09 03:54:56 cube Exp $ */
/*
struct bthidev sc_hidev; /* device */
struct hidkbd sc_kbd; /* keyboard state */
int (*sc_output) /* output method */
- (struct bthidev *, uint8_t *, int);
+ (struct bthidev *, uint8_t *, int, int);
+ int sc_inintr;
};
/* autoconf(9) methods */
if (hidkbd_set_leds(kbd, leds, &report) != 0) {
if (sc->sc_output != NULL)
(*sc->sc_output)(&sc->sc_hidev, &report,
- sizeof(report));
+ sizeof(report), sc->sc_inintr);
}
}
struct btkbd_softc *sc = (struct btkbd_softc *)self;
struct hidkbd *kbd = &sc->sc_kbd;
- if (kbd->sc_enabled != 0)
+ if (kbd->sc_enabled != 0) {
+ sc->sc_inintr = 1;
hidkbd_input(kbd, data, len);
+ sc->sc_inintr = 0;
+ }
}