Magellan Linux

Contents of /trunk/pm-utils/patches/pm-utils-1.4.1-bluetooth-sync.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1410 - (show annotations) (download)
Wed Jul 13 09:24:09 2011 UTC (12 years, 9 months ago) by niro
File size: 1504 byte(s)
-added patches for pm-utils
1 From 640b53438c20818b3e344343b58b1f1765606a85 Mon Sep 17 00:00:00 2001
2 From: Martin Pitt <martin.pitt@ubuntu.com>
3 Date: Mon, 31 Jan 2011 15:30:01 +0100
4 Subject: [PATCH] 49bluetooth: Wait for btusb module to get unused
5
6 The 49bluetooth hook disables /proc/acpi/ibm/bluetooth but this isn't
7 synchronous, i. e. it doesn't wait until the module usage count actually drops
8 to 0. Due to that, it's impossible to add btusb to SUSPEND_MODULES (on some
9 models/older kernels you need to do that to fix suspend problems), as at that
10 point the module is still in use.
11
12 On my system (ThinkPad X201) the module takes between 0.3 and 0.5 seconds to
13 unload, so use 100 ms wait steps with a timeout of 2 seconds.
14
15 Bug: https://bugs.freedesktop.org//show_bug.cgi?id=33759
16 Bug-Ubuntu: https://launchpad.net/bugs/698331
17 ---
18 pm/sleep.d/49bluetooth | 9 +++++++++
19 1 files changed, 9 insertions(+), 0 deletions(-)
20
21 diff --git a/pm/sleep.d/49bluetooth b/pm/sleep.d/49bluetooth
22 index d46ba49..0dc1909 100755
23 --- a/pm/sleep.d/49bluetooth
24 +++ b/pm/sleep.d/49bluetooth
25 @@ -12,6 +12,15 @@ suspend_bluetooth()
26 if grep -q enabled /proc/acpi/ibm/bluetooth; then
27 savestate ibm_bluetooth enable
28 echo disable > /proc/acpi/ibm/bluetooth
29 +
30 + # wait for up to 2 seconds for the module to actually get
31 + # unused
32 + TIMEOUT=20
33 + while [ $TIMEOUT -ge 0 ]; do
34 + [ `cat /sys/module/btusb/refcnt` = 0 ] && break
35 + TIMEOUT=$((TIMEOUT-1))
36 + sleep 0.1
37 + done
38 else
39 savestate ibm_bluetooth disable
40 fi
41 --
42 1.7.2.3
43