summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorplunky <plunky@NetBSD.org>2006-09-11 21:59:09 +0000
committerplunky <plunky@NetBSD.org>2006-09-11 21:59:09 +0000
commit4b5125cac5210c5f9dbeea992e0ed98a8167700a (patch)
treeff68f0e8cb013c07e432e7e70c0e1f24f588cfe8 /sys/dev
parent26b97f3a178ae3ed2c29aad0dcd8ce37021f5781 (diff)
btsco.c:
- sco_getopt(..., SO_SCO_MTU, ...) expects the address of a uint16_t, not an int. So change sc_mtu's type to uint16_t. - Try a little harder to ensure btsco_round_blocksize() does not return zero. Prevents a subsequent panic in audio_init_ringbuffer(). from scw@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/bluetooth/btsco.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/bluetooth/btsco.c b/sys/dev/bluetooth/btsco.c
index 73ff962178a..eb7357adafe 100644
--- a/sys/dev/bluetooth/btsco.c
+++ b/sys/dev/bluetooth/btsco.c
@@ -1,4 +1,4 @@
-/* $NetBSD: btsco.c,v 1.3 2006/09/10 15:45:56 plunky Exp $ */
+/* $NetBSD: btsco.c,v 1.4 2006/09/11 21:59:09 plunky Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.3 2006/09/10 15:45:56 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.4 2006/09/11 21:59:09 plunky Exp $");
#include <sys/param.h>
#include <sys/audioio.h>
@@ -97,7 +97,7 @@ struct btsco_softc {
uint16_t sc_state; /* link state */
struct sco_pcb *sc_sco; /* SCO handle */
struct sco_pcb *sc_sco_l; /* SCO listen handle */
- int sc_mtu; /* SCO mtu */
+ uint16_t sc_mtu; /* SCO mtu */
uint8_t sc_channel; /* RFCOMM channel */
int sc_err; /* stored error */
@@ -770,8 +770,11 @@ btsco_round_blocksize(void *hdl, int bs, int mode, const audio_params_t *param)
{
struct btsco_softc *sc = hdl;
- if (sc->sc_mtu > 0)
+ if (sc->sc_mtu > 0) {
bs = (bs / sc->sc_mtu) * sc->sc_mtu;
+ if (bs == 0)
+ bs = sc->sc_mtu;
+ }
DPRINTF("%s mode=0x%x, bs=%d, sc_mtu=%d\n",
device_xname((struct device *)sc), mode, bs, sc->sc_mtu);