USB autosuspend causing trouble with bluetooth

From: Kirill Elagin
Date: Sun Jan 18 2015 - 08:31:07 EST


Hello,

Recently I started having issues with my Apple Magic Trackpad and I
realised that the problem was with autosuspend. Whenever I have `auto`
in `power/control` of my BT adapter, `btmon` shows no packets,
nothing. As soon as I `echo on`, all the missing packets arrive.

The situation looks very similar to this thread:
https://lkml.org/lkml/2014/4/2/574.
As suggested, I tried `hci-tester` and Iâm attaching the complete
output, but, I guess, the interesting part is that with `on` in
`power/control` I get:

~~~~
Inquiry (LIAC) Passed 10.254 seconds
~~~~

and with `auto` I get:

~~~~
Inquiry (LIAC) Timed out 30.365 seconds
~~~~

This is Acer 4810TG laptop with BCM2046. The kernel is 3.17.7, but Iâm
pretty sure I was also seeing this on 3.18.1. Bluez is 5.25.


P.S. Please, CC me as Iâm not a subscriber.
ââ# ./tools/hci-tester

Reset - init
Reset - setup
Reset - setup complete
Reset - run
Reset - test passed
Reset - teardown
Reset - teardown complete
Reset - done

Read Local Version Information - init
Read Local Version Information - setup
Read Local Version Information - setup complete
Read Local Version Information - run
Read Local Version Information - test passed
Read Local Version Information - teardown
Read Local Version Information - teardown complete
Read Local Version Information - done

Read Local Supported Commands - init
Read Local Supported Commands - setup
Read Local Supported Commands - setup complete
Read Local Supported Commands - run
Read Local Supported Commands - test passed
Read Local Supported Commands - teardown
Read Local Supported Commands - teardown complete
Read Local Supported Commands - done

Read Local Supported Features - init
Read Local Supported Features - setup
Read Local Supported Features - setup complete
Read Local Supported Features - run
Read Local Supported Features - test passed
Read Local Supported Features - teardown
Read Local Supported Features - teardown complete
Read Local Supported Features - done

Read Local Extended Features - init
Read Local Extended Features - setup
Read Local Extended Features - setup complete
Read Local Extended Features - run
Read Local Extended Features - test passed
Read Local Extended Features - teardown
Read Local Extended Features - teardown complete
Read Local Extended Features - done

Read Buffer Size - init
Read Buffer Size - setup
Read Buffer Size - setup complete
Read Buffer Size - run
Read Buffer Size - test passed
Read Buffer Size - teardown
Read Buffer Size - teardown complete
Read Buffer Size - done

Read Country Code - init
Read Country Code - setup
Read Country Code - setup complete
Read Country Code - run
HCI command failed (0x01)
Read Country Code - test failed
Read Country Code - teardown
Read Country Code - teardown complete
Read Country Code - done

Read BD_ADDR - init
Read BD_ADDR - setup
Read BD_ADDR - setup complete
Read BD_ADDR - run
Read BD_ADDR - test passed
Read BD_ADDR - teardown
Read BD_ADDR - teardown complete
Read BD_ADDR - done

Read Local Supported Codecs - init
Read Local Supported Codecs - setup
Read Local Supported Codecs - setup complete
Read Local Supported Codecs - run
HCI command failed (0x01)
Read Local Supported Codecs - test failed
Read Local Supported Codecs - teardown
Read Local Supported Codecs - teardown complete
Read Local Supported Codecs - done

LE Read White List Size - init
LE Read White List Size - setup
LE Read White List Size - setup complete
LE Read White List Size - run
HCI command failed (0x01)
LE Read White List Size - test failed
LE Read White List Size - teardown
LE Read White List Size - teardown complete
LE Read White List Size - done

LE Clear White List - init
LE Clear White List - setup
LE Clear White List - setup complete
LE Clear White List - run
HCI command failed (0x01)
LE Clear White List - test failed
LE Clear White List - teardown
LE Clear White List - teardown complete
LE Clear White List - done

Inquiry (LIAC) - init
Inquiry (LIAC) - setup
Inquiry (LIAC) - setup complete
Inquiry (LIAC) - run
Inquiry (LIAC) - test passed
Inquiry (LIAC) - teardown
Inquiry (LIAC) - teardown complete
Inquiry (LIAC) - done

Create Connection - init
Failed to setup lower tester user channel
Create Connection - pre setup failed
Create Connection - done

TP/DSU/BV-02-C Reset in Advertising State - init
Failed to setup upper tester user channel
TP/DSU/BV-02-C Reset in Advertising State - pre setup failed
TP/DSU/BV-02-C Reset in Advertising State - done


Test Summary
------------
Reset Passed 0.007 seconds
Read Local Version Information Passed 0.007 seconds
Read Local Supported Commands Passed 0.011 seconds
Read Local Supported Features Passed 0.008 seconds
Read Local Extended Features Passed 0.010 seconds
Read Buffer Size Passed 0.008 seconds
Read Country Code Failed 0.008 seconds
Read BD_ADDR Passed 0.007 seconds
Read Local Supported Codecs Failed 0.009 seconds
LE Read White List Size Failed 0.007 seconds
LE Clear White List Failed 0.009 seconds
Inquiry (LIAC) Passed 10.254 seconds
Create Connection Not Run
TP/DSU/BV-02-C Reset in Advertising State Not Run

Total: 14, Passed: 8 (57.1%), Failed: 4, Not Run: 2
Overall execution time: 10.4 seconds
â# ./tools/hci-tester

Reset - init
Reset - setup
Reset - setup complete
Reset - run
Reset - test passed
Reset - teardown
Reset - teardown complete
Reset - done

Read Local Version Information - init
Read Local Version Information - setup
Read Local Version Information - setup complete
Read Local Version Information - run
Read Local Version Information - test passed
Read Local Version Information - teardown
Read Local Version Information - teardown complete
Read Local Version Information - done

Read Local Supported Commands - init
Read Local Supported Commands - setup
Read Local Supported Commands - setup complete
Read Local Supported Commands - run
Read Local Supported Commands - test passed
Read Local Supported Commands - teardown
Read Local Supported Commands - teardown complete
Read Local Supported Commands - done

Read Local Supported Features - init
Read Local Supported Features - setup
Read Local Supported Features - setup complete
Read Local Supported Features - run
Read Local Supported Features - test passed
Read Local Supported Features - teardown
Read Local Supported Features - teardown complete
Read Local Supported Features - done

Read Local Extended Features - init
Read Local Extended Features - setup
Read Local Extended Features - setup complete
Read Local Extended Features - run
Read Local Extended Features - test passed
Read Local Extended Features - teardown
Read Local Extended Features - teardown complete
Read Local Extended Features - done

Read Buffer Size - init
Read Buffer Size - setup
Read Buffer Size - setup complete
Read Buffer Size - run
Read Buffer Size - test passed
Read Buffer Size - teardown
Read Buffer Size - teardown complete
Read Buffer Size - done

Read Country Code - init
Read Country Code - setup
Read Country Code - setup complete
Read Country Code - run
HCI command failed (0x01)
Read Country Code - test failed
Read Country Code - teardown
Read Country Code - teardown complete
Read Country Code - done

Read BD_ADDR - init
Read BD_ADDR - setup
Read BD_ADDR - setup complete
Read BD_ADDR - run
Read BD_ADDR - test passed
Read BD_ADDR - teardown
Read BD_ADDR - teardown complete
Read BD_ADDR - done

Read Local Supported Codecs - init
Read Local Supported Codecs - setup
Read Local Supported Codecs - setup complete
Read Local Supported Codecs - run
HCI command failed (0x01)
Read Local Supported Codecs - test failed
Read Local Supported Codecs - teardown
Read Local Supported Codecs - teardown complete
Read Local Supported Codecs - done

LE Read White List Size - init
LE Read White List Size - setup
LE Read White List Size - setup complete
LE Read White List Size - run
HCI command failed (0x01)
LE Read White List Size - test failed
LE Read White List Size - teardown
LE Read White List Size - teardown complete
LE Read White List Size - done

LE Clear White List - init
LE Clear White List - setup
LE Clear White List - setup complete
LE Clear White List - run
HCI command failed (0x01)
LE Clear White List - test failed
LE Clear White List - teardown
LE Clear White List - teardown complete
LE Clear White List - done

Inquiry (LIAC) - init
Inquiry (LIAC) - setup
Inquiry (LIAC) - setup complete
Inquiry (LIAC) - run
Inquiry (LIAC) - test timed out
Inquiry (LIAC) - teardown
Inquiry (LIAC) - teardown complete
Inquiry (LIAC) - done

Create Connection - init
Failed to setup lower tester user channel
Create Connection - pre setup failed
Create Connection - done

TP/DSU/BV-02-C Reset in Advertising State - init
Failed to setup upper tester user channel
TP/DSU/BV-02-C Reset in Advertising State - pre setup failed
TP/DSU/BV-02-C Reset in Advertising State - done


Test Summary
------------
Reset Passed 0.066 seconds
Read Local Version Information Passed 0.008 seconds
Read Local Supported Commands Passed 0.016 seconds
Read Local Supported Features Passed 0.009 seconds
Read Local Extended Features Passed 0.010 seconds
Read Buffer Size Passed 0.008 seconds
Read Country Code Failed 0.008 seconds
Read BD_ADDR Passed 0.007 seconds
Read Local Supported Codecs Failed 0.007 seconds
LE Read White List Size Failed 0.008 seconds
LE Clear White List Failed 0.009 seconds
Inquiry (LIAC) Timed out 30.365 seconds
Create Connection Not Run
TP/DSU/BV-02-C Reset in Advertising State Not Run

Total: 14, Passed: 7 (50.0%), Failed: 5, Not Run: 2
Overall execution time: 30.5 seconds