Hi,

I still think it makes little sense to support reset_resume()
in btusb, but if you really want to, you can try this patch.

        HTH
                Oliver
>From 3776765dbd08701c30f45c1849691a16c1077cc3 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneu...@suse.de>
Date: Wed, 12 Mar 2014 12:01:13 +0100
Subject: [PATCH] btusb: implement reset_resume()

This implements reset_resume() to the extent that this is possible
for btusb. It can be done if the HCI is down. In the other cases
the host would be thrown out of the network.

Signed-off-by: Oliver Neukum <oneu...@suse.de>
---
 drivers/bluetooth/btusb.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index baeaaed..e56fa2a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1670,6 +1670,25 @@ done:
 
        return err;
 }
+
+static int btusb_reset_resume(struct usb_interface *intf)
+{
+       struct btusb_data *data = usb_get_intfdata(intf);
+       struct hci_dev *hdev = data->hdev;
+
+       /*
+        * the interface can be recovered only if the HCI
+        * is not part of a network because the synchronization
+        * is lost as the device is reset
+        */
+       if (test_bit(HCI_RUNNING, &hdev->flags))
+               return -EIO;
+
+       if (hdev->setup)
+               return (hdev->setup)(hdev);
+       else
+               return 0;
+}
 #endif
 
 static struct usb_driver btusb_driver = {
@@ -1679,6 +1698,7 @@ static struct usb_driver btusb_driver = {
 #ifdef CONFIG_PM
        .suspend        = btusb_suspend,
        .resume         = btusb_resume,
+       .reset_resume   = btusb_reset_resume,
 #endif
        .id_table       = btusb_table,
        .supports_autosuspend = 1,
-- 
1.8.4.5



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to