Bluetooth audio - crash on USB bluetooth dongle disconnect - solved

Vladimir Grebenschikov vova at fbsd.ru
Fri Oct 3 22:21:09 UTC 2008


В Fri, 03/10/2008 в 14:18 -0700, Maksim Yevmenkin пишет:

> one thing that is different from interrupt and bulk transfers is that
> ng_ubt(4) always has multiple outstanding incoming isoc transfers.
> when device is simply pulled out, there is not much driver can do. if
> i enable debugging i can see my transfer completion routine called
> with ioerror status or something like that. so, i suspect this is a
> cleanup issue. i'm not sure who supposed to do the cleanup in this
> case driver or stack.
> 
> in any case,  can you verify that ubt_reset() is called when device is
> pulled out? (it should be called as part of hook disconnect). 

Right guess, it does not called.

> if not - then please try to call ubt_reset() from ubt_detach() just before
> closing all the pipes.

Yes, it fixes crash, patch below.

Index: netgraph/bluetooth/drivers/ubt/ng_ubt.c
===================================================================
RCS file: /usr/ncvs/src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c,v
retrieving revision 1.35
diff -u -r1.35 ng_ubt.c
--- netgraph/bluetooth/drivers/ubt/ng_ubt.c	29 Jul 2008 00:17:53 -0000	1.35
+++ netgraph/bluetooth/drivers/ubt/ng_ubt.c	3 Oct 2008 22:13:46 -0000
@@ -803,6 +803,9 @@
 	struct ubt_softc *sc = device_get_softc(self);
 	int	i;
 
+	/* Reset queues and pipes */
+	ubt_reset(sc);
+	
 	/* Destroy Netgraph node */
 	if (sc->sc_node != NULL) {
 		NG_NODE_SET_PRIVATE(sc->sc_node, NULL);


> thanks,
> max
-- 
Vladimir B. Grebenschikov
vova at fbsd.ru


More information about the freebsd-bluetooth mailing list