linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: set reset_resume handler
@ 2011-10-25  8:37 Jesse Sung
  2011-10-25  8:40 ` Oliver Neukum
  0 siblings, 1 reply; 6+ messages in thread
From: Jesse Sung @ 2011-10-25  8:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: 812132

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]


On some machines, it seems that usb hubs do not get power while
being suspended. We can get something like this in dmesg:
     usb usb2: root hub lost power or was reset

When this is the case, .reset_resume is called instead of .resume.
If .reset_resume is not set, bluetooth modules would stay in an unusable
state because the resume function is not called.

Signed-off-by: Wen-chien Jesse Sung <jesse.sung@canonical.com>
---
  drivers/bluetooth/btusb.c |    1 +
  1 files changed, 1 insertions(+), 0 deletions(-)



[-- Attachment #2: 0001-Bluetooth-set-reset_resume-handler.patch --]
[-- Type: text/x-patch, Size: 395 bytes --]

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index abfc4ee..db2a4d1 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -1220,6 +1220,7 @@ static struct usb_driver btusb_driver = {
 #ifdef CONFIG_PM
 	.suspend	= btusb_suspend,
 	.resume		= btusb_resume,
+	.reset_resume	= btusb_resume,
 #endif
 	.id_table	= btusb_table,
 	.supports_autosuspend = 1,


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: set reset_resume handler
  2011-10-25  8:37 [PATCH] Bluetooth: set reset_resume handler Jesse Sung
@ 2011-10-25  8:40 ` Oliver Neukum
  2011-10-25 11:20   ` Jesse Sung
  0 siblings, 1 reply; 6+ messages in thread
From: Oliver Neukum @ 2011-10-25  8:40 UTC (permalink / raw)
  To: Jesse Sung; +Cc: linux-bluetooth, 812132

Am Dienstag, 25. Oktober 2011, 10:37:38 schrieb Jesse Sung:
> 
> On some machines, it seems that usb hubs do not get power while
> being suspended. We can get something like this in dmesg:
>      usb usb2: root hub lost power or was reset
> 
> When this is the case, .reset_resume is called instead of .resume.
> If .reset_resume is not set, bluetooth modules would stay in an unusable
> state because the resume function is not called.

Have you experimentally verified that? This state of affairs is years
old and should result in a virtual unplug/replug cycle. What are you
seeing?

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: set reset_resume handler
  2011-10-25  8:40 ` Oliver Neukum
@ 2011-10-25 11:20   ` Jesse Sung
  2011-10-25 11:43     ` Oliver Neukum
  0 siblings, 1 reply; 6+ messages in thread
From: Jesse Sung @ 2011-10-25 11:20 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-bluetooth, 812132

On 10/25/2011 04:40 PM, Oliver Neukum wrote:
> Am Dienstag, 25. Oktober 2011, 10:37:38 schrieb Jesse Sung:
>>
>> On some machines, it seems that usb hubs do not get power while
>> being suspended. We can get something like this in dmesg:
>>       usb usb2: root hub lost power or was reset
>>
>> When this is the case, .reset_resume is called instead of .resume.
>> If .reset_resume is not set, bluetooth modules would stay in an unusable
>> state because the resume function is not called.
>
> Have you experimentally verified that? This state of affairs is years
> old and should result in a virtual unplug/replug cycle. What are you
> seeing?
>
> 	Regards
> 		Oliver

Hi Oliver,

Humm... You're right, there is an unplug-replug cycle, but bluetooth 
doesn't work until I restart bluetoothd. If the resume function is 
called through .reset_resume, then bluetooth works right after resume.

Regards,
Jesse

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: set reset_resume handler
  2011-10-25 11:20   ` Jesse Sung
@ 2011-10-25 11:43     ` Oliver Neukum
  2011-10-25 14:48       ` Jesse Sung
  0 siblings, 1 reply; 6+ messages in thread
From: Oliver Neukum @ 2011-10-25 11:43 UTC (permalink / raw)
  To: Jesse Sung; +Cc: linux-bluetooth, 812132

Am Dienstag, 25. Oktober 2011, 13:20:13 schrieb Jesse Sung:
> On 10/25/2011 04:40 PM, Oliver Neukum wrote:
> > Am Dienstag, 25. Oktober 2011, 10:37:38 schrieb Jesse Sung:
> >>
> >> On some machines, it seems that usb hubs do not get power while
> >> being suspended. We can get something like this in dmesg:
> >>       usb usb2: root hub lost power or was reset
> >>
> >> When this is the case, .reset_resume is called instead of .resume.
> >> If .reset_resume is not set, bluetooth modules would stay in an unusable
> >> state because the resume function is not called.
> >
> > Have you experimentally verified that? This state of affairs is years
> > old and should result in a virtual unplug/replug cycle. What are you
> > seeing?
> >
> > 	Regards
> > 		Oliver
> 
> Hi Oliver,
> 
> Humm... You're right, there is an unplug-replug cycle, but bluetooth 
> doesn't work until I restart bluetoothd. If the resume function is 
> called through .reset_resume, then bluetooth works right after resume.

Hi

Yes, but we fail to indicate to user space that connections may have been
dropped. I doubt we can simply pretend the loss of power hasn't occured.
Have you tested what happens if you go to S3 while eg. a file is transfered
or audio played with your patch?

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: set reset_resume handler
  2011-10-25 11:43     ` Oliver Neukum
@ 2011-10-25 14:48       ` Jesse Sung
  2011-10-25 18:29         ` Oliver Neukum
  0 siblings, 1 reply; 6+ messages in thread
From: Jesse Sung @ 2011-10-25 14:48 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-bluetooth, 812132

On 10/25/2011 07:43 PM, Oliver Neukum wrote:
> Am Dienstag, 25. Oktober 2011, 13:20:13 schrieb Jesse Sung:
>> On 10/25/2011 04:40 PM, Oliver Neukum wrote:
>>> Am Dienstag, 25. Oktober 2011, 10:37:38 schrieb Jesse Sung:
>>>>
>>>> On some machines, it seems that usb hubs do not get power while
>>>> being suspended. We can get something like this in dmesg:
>>>>        usb usb2: root hub lost power or was reset
>>>>
>>>> When this is the case, .reset_resume is called instead of .resume.
>>>> If .reset_resume is not set, bluetooth modules would stay in an unusable
>>>> state because the resume function is not called.
>>>
>>> Have you experimentally verified that? This state of affairs is years
>>> old and should result in a virtual unplug/replug cycle. What are you
>>> seeing?
>>
>> Hi Oliver,
>>
>> Humm... You're right, there is an unplug-replug cycle, but bluetooth
>> doesn't work until I restart bluetoothd. If the resume function is
>> called through .reset_resume, then bluetooth works right after resume.
>
> Hi
>
> Yes, but we fail to indicate to user space that connections may have been
> dropped. I doubt we can simply pretend the loss of power hasn't occured.
> Have you tested what happens if you go to S3 while eg. a file is transfered
> or audio played with your patch?

Hi Oliver,

Indeed, loss of power event should not be ignored.

Just tested file transferring. If there's no active connection, 
everything goes fine. But if a file is transferring while going to S3, 
bluetooth is not working after resume. Use applet to disable and 
re-enable bluetooth makes it work again...

Wondering what is the right way to handle loss of power...

Regards,
Jesse

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bluetooth: set reset_resume handler
  2011-10-25 14:48       ` Jesse Sung
@ 2011-10-25 18:29         ` Oliver Neukum
  0 siblings, 0 replies; 6+ messages in thread
From: Oliver Neukum @ 2011-10-25 18:29 UTC (permalink / raw)
  To: Jesse Sung; +Cc: linux-bluetooth, 812132

Am Dienstag, 25. Oktober 2011, 16:48:59 schrieb Jesse Sung:

> Just tested file transferring. If there's no active connection, 
> everything goes fine. But if a file is transferring while going to S3, 
> bluetooth is not working after resume. Use applet to disable and 
> re-enable bluetooth makes it work again...
> 
> Wondering what is the right way to handle loss of power...

A virtual unplug/plug worked until now, even if it was inelegant.

	Regards
		Oliver

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-25 18:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-25  8:37 [PATCH] Bluetooth: set reset_resume handler Jesse Sung
2011-10-25  8:40 ` Oliver Neukum
2011-10-25 11:20   ` Jesse Sung
2011-10-25 11:43     ` Oliver Neukum
2011-10-25 14:48       ` Jesse Sung
2011-10-25 18:29         ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).