[PATCH BlueZ v3 3/6] hog: Add suspend/resume callbacks declaration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch declares the callbacks functions that intend to be used
by the suspend back-ends.
---
 profiles/input/hog_manager.c   | 12 +++++++++++-
 profiles/input/suspend-dummy.c | 10 +++++++++-
 profiles/input/suspend.h       |  5 ++++-
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/profiles/input/hog_manager.c b/profiles/input/hog_manager.c
index 8ddaf2f..6d173cc 100644
--- a/profiles/input/hog_manager.c
+++ b/profiles/input/hog_manager.c
@@ -42,6 +42,16 @@
 
 static gboolean suspend_supported = FALSE;
 
+static void suspend_callback(void)
+{
+	DBG("Suspending ...");
+}
+
+static void resume_callback(void)
+{
+	DBG("Resuming ...");
+}
+
 static int hog_device_probe(struct btd_profile *p, struct btd_device *device,
 								GSList *uuids)
 {
@@ -72,7 +82,7 @@ static int hog_manager_init(void)
 {
 	int err;
 
-	err = suspend_init();
+	err = suspend_init(suspend_callback, resume_callback);
 	if (err < 0)
 		DBG("Suspend: %s(%d)", strerror(-err), -err);
 	else
diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dummy.c
index 0a97158..282d3fb 100644
--- a/profiles/input/suspend-dummy.c
+++ b/profiles/input/suspend-dummy.c
@@ -26,10 +26,18 @@
 #include <config.h>
 #endif
 
+#include <stdlib.h>
+
 #include "suspend.h"
 
-int suspend_init(void)
+static suspend_event suspend_cb = NULL;
+static resume_event resume_cb = NULL;
+
+int suspend_init(suspend_event suspend, resume_event resume)
 {
+	suspend_cb = suspend;
+	resume_cb = resume;
+
 	return 0;
 }
 
diff --git a/profiles/input/suspend.h b/profiles/input/suspend.h
index 3f37a29..bfee3cf 100644
--- a/profiles/input/suspend.h
+++ b/profiles/input/suspend.h
@@ -22,5 +22,8 @@
  *
  */
 
-int suspend_init(void);
+typedef void (*suspend_event) (void);
+typedef void (*resume_event) (void);
+
+int suspend_init(suspend_event suspend, resume_event resume);
 void suspend_exit(void);
-- 
1.7.12

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


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux