Hi Brian, > >>>>> Kay, David, wouldn't be pinning of the parent device here be enough to > >>>>> get this done in a clean way? > >>>>> > >>>>> > >>>>> > >>>> If there's a way that the connection can be pinned until the child > >>>> devices go away, that definitely sounds cleaner to me. > >>>> > >>>> > >>> so I pushed some patches to bluetooth-testing tree that should fix this > >>> problem. They are not fully tested by me. Please test and report back > >>> the results. > >>> > >>> > >> Fails to compile if CONFIG_USB_HIDDEV=y : > >> > >> ERROR: "hiddev_disconnect" [net/bluetooth/hidp/hidp.ko] undefined! > >> > >> Ironically, the reference to hiddev_disconnect is fine if hiddev isn't > >> enabled because then hiddev.h supplies an empty static inline function. > >> > >> I'm going to test with a kernel without hiddev for now. > >> > > > > just take that piece out of the patch. It is not important. I just wanna > > now if the uevents are now coming in order. > > > > I just tried it without hiddev and observed that the input devices go > away, but the connection never gets deleted. Then when I turn my mouse > back on, bad stuff happens: I do have a typo here :( void hci_conn_hold_device(struct hci_conn *conn) { hci_conn_hold(conn); atomic_inc(&conn->devref); } EXPORT_SYMBOL(hci_conn_hold_device); void hci_conn_put_device(struct hci_conn *conn) { if (atomic_dec_and_test(&conn->refcnt)) hci_conn_del_sysfs(conn); hci_conn_put(conn); } EXPORT_SYMBOL(hci_conn_put_device); The atomic_dec_and_test() should operate on conn->devref. Can you change that and try again. Also if that doesn't help, remove the hci_conn_hold() and hci_conn_put() from the two functions above and try again. Regards Marcel -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html