public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Run hid2hci after resuming from suspend
@ 2008-10-22 20:54 Mario Limonciello
  2008-10-23  4:44 ` Marcel Holtmann
  0 siblings, 1 reply; 4+ messages in thread
From: Mario Limonciello @ 2008-10-22 20:54 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org


[-- Attachment #1.1: Type: text/plain, Size: 295 bytes --]

Hello,

This patch adds support for the hid2hci command to be ran upon resuming
from suspend.  At least the USB adapters I've been operating with that
need to switch modes need to do so upon resume.

Regards
-- 
Mario Limonciello
*Dell | Linux Engineering*
mario_limonciello@dell.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: hid2hci_pm-utils.patch --]
[-- Type: text/x-patch; name="hid2hci_pm-utils.patch", Size: 3302 bytes --]

diff -Nur -x '*.orig' -x '*~' bluez-4.12/scripts/hid2hci.pm-utils bluez-4.12.new/scripts/hid2hci.pm-utils
--- bluez-4.12/scripts/hid2hci.pm-utils	1969-12-31 18:00:00.000000000 -0600
+++ bluez-4.12.new/scripts/hid2hci.pm-utils	2008-10-22 15:37:00.000000000 -0500
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Switch all devices that were in a HID mode to HCI mode
+# after a resume
+
+. "${PM_FUNCTIONS}"
+
+[ -f /etc/default/bluetooth ] || exit $NA
+
+. /etc/default/bluetooth
+
+hid2hci()
+{
+	if [ "$HID2HCI_ENABLED" = "1" ] && [ -x /usr/sbin/hid2hci ]; then
+		/usr/sbin/hid2hci --tohci
+        fi
+}
+
+case "$1" in
+	thaw|resume)
+		hid2hci
+		;;
+	*) exit $NA
+		;;
+esac
diff -Nur -x '*.orig' -x '*~' bluez-4.12/scripts/Makefile.am bluez-4.12.new/scripts/Makefile.am
--- bluez-4.12/scripts/Makefile.am	2008-10-07 13:28:29.000000000 -0500
+++ bluez-4.12.new/scripts/Makefile.am	2008-10-22 15:37:00.000000000 -0500
@@ -9,7 +9,7 @@
 udev_SCRIPTS = bluetooth_serial
 endif
 
-EXTRA_DIST = bluetooth.rules bluetooth_serial bluetooth.init bluetooth.default
+EXTRA_DIST = bluetooth.rules bluetooth_serial bluetooth.init bluetooth.default hid2hci.pm-utils
 
 MAINTAINERCLEANFILES = Makefile.in
 
@@ -24,3 +24,12 @@
 	@rm -f $(DESTDIR)$(sysconfdir)/init.d/bluetooth
 	@rm -f $(DESTDIR)$(sysconfdir)/default/bluetooth
 endif
+
+if HID2HCI
+install-data-local:
+	$(mkinstalldirs) $(DESTDIR)/$(libexecdir)/pm-utils/sleep.d
+	$(INSTALL) -D -m 744 $(srcdir)/hid2hci.pm-utils $(DESTDIR)$(libexecdir)/pm-utils/sleep.d/48hid2hci
+
+uninstall-local:
+	@rm -f $(DESTDIR)$(libexecdir)/pm-utils/sleep.d/48hid2hci
+endif
diff -Nur -x '*.orig' -x '*~' bluez-4.12/scripts/Makefile.in bluez-4.12.new/scripts/Makefile.in
--- bluez-4.12/scripts/Makefile.in	2008-10-07 13:28:29.000000000 -0500
+++ bluez-4.12.new/scripts/Makefile.in	2008-10-22 15:37:20.000000000 -0500
@@ -192,7 +192,7 @@
 @PCMCIARULES_TRUE@rules_DATA = bluetooth.rules
 @PCMCIARULES_TRUE@udevdir = $(libexecdir)/udev
 @PCMCIARULES_TRUE@udev_SCRIPTS = bluetooth_serial
-EXTRA_DIST = bluetooth.rules bluetooth_serial bluetooth.init bluetooth.default
+EXTRA_DIST = bluetooth.rules bluetooth_serial bluetooth.init bluetooth.default hid2hci.pm-utils
 MAINTAINERCLEANFILES = Makefile.in
 all: all-am
 
@@ -335,6 +335,8 @@
 	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
 @INITSCRIPTS_FALSE@uninstall-local:
 @INITSCRIPTS_FALSE@install-data-local:
+@HID2HCI_FALSE@uninstall-local:
+@HID2HCI_FALSE@install-data-local:
 clean: clean-am
 
 clean-am: clean-generic clean-libtool mostlyclean-am
@@ -416,6 +418,13 @@
 @INITSCRIPTS_TRUE@uninstall-local:
 @INITSCRIPTS_TRUE@	@rm -f $(DESTDIR)$(sysconfdir)/init.d/bluetooth
 @INITSCRIPTS_TRUE@	@rm -f $(DESTDIR)$(sysconfdir)/default/bluetooth
+
+@HID2HCI_TRUE@install-data-local:
+@HID2HCI_TRUE@	$(mkinstalldirs) $(DESTDIR)/$(libexecdir)/pm-utils/sleep.d
+@HID2HCI_TRUE@	$(INSTALL) -D -m 744 $(srcdir)/hid2hci.pm-utils $(DESTDIR)$(libexecdir)/pm-utils/sleep.d/48hid2hci
+
+@HID2HCI_TRUE@uninstall-local:
+@HID2HCI_TRUE@	@rm -f $(DESTDIR)$(libexecdir)/pm-utils/sleep.d/48hid2hci
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

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

end of thread, other threads:[~2008-10-24  8:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-22 20:54 [PATCH] Run hid2hci after resuming from suspend Mario Limonciello
2008-10-23  4:44 ` Marcel Holtmann
2008-10-23 16:29   ` Mario Limonciello
2008-10-24  8:06     ` Bastien Nocera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox