aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2012-03-19 18:44:22 -0300
committerJoão Paulo Rechi Vita <jprvita@openbossa.org>2012-06-19 14:47:04 -0300
commit39abd87d541ed840443f8848b05cd8125be756b8 (patch)
treeb79a8e557eb5c71b6edf5c0030a4ea28ff7302f5
parent52bcf407876b0d9c45eba44a297592b1f7594337 (diff)
downloadbluez-39abd87d541ed840443f8848b05cd8125be756b8.tar.gz
bluez-39abd87d541ed840443f8848b05cd8125be756b8.tar.xz
bluez-39abd87d541ed840443f8848b05cd8125be756b8.zip
hog: Register HID over GATT device driver
-rw-r--r--Makefile.am5
-rw-r--r--acinclude.m41
-rw-r--r--input/hog_device.h25
-rw-r--r--input/main.c13
-rw-r--r--input/manager.c34
-rw-r--r--input/manager.h3
6 files changed, 81 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 1c214c69..9a5d81d5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -188,6 +188,11 @@ builtin_sources += input/main.c \
input/fakehid.c input/fakehid.h
endif
+if HOGPLUGIN
+builtin_modules += hog
+builtin_sources += input/hog_device.h
+endif
+
if SERIALPLUGIN
builtin_modules += serial
builtin_sources += serial/main.c \
diff --git a/acinclude.m4 b/acinclude.m4
index 6505ad3a..9b7cc9b8 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -398,4 +398,5 @@ AC_DEFUN([AC_ARG_BLUEZ], [
AM_CONDITIONAL(DBUSOOBPLUGIN, test "${dbusoob_enable}" = "yes")
AM_CONDITIONAL(WIIMOTEPLUGIN, test "${wiimote_enable}" = "yes")
AM_CONDITIONAL(GATTMODULES, test "${gatt_enable}" = "yes")
+ AM_CONDITIONAL(HOGPLUGIN, test "${gatt_enable}" = "yes" && test "${input_enable}" = "yes")
])
diff --git a/input/hog_device.h b/input/hog_device.h
new file mode 100644
index 00000000..a0158eab
--- /dev/null
+++ b/input/hog_device.h
@@ -0,0 +1,25 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2012 Marcel Holtmann <marcel@holtmann.org>
+ * Copyright (C) 2012 Instituto Nokia de Tecnologia - INdT
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#define HOG_UUID "00001812-0000-1000-8000-00805f9b34fb"
diff --git a/input/main.c b/input/main.c
index da09b86e..2aac3dbe 100644
--- a/input/main.c
+++ b/input/main.c
@@ -84,3 +84,16 @@ static void input_exit(void)
BLUETOOTH_PLUGIN_DEFINE(input, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
input_init, input_exit)
+
+static int hog_init(void)
+{
+ return hog_manager_init();
+}
+
+static void hog_exit(void)
+{
+ hog_manager_exit();
+}
+
+BLUETOOTH_PLUGIN_DEFINE(hog, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
+ hog_init, hog_exit)
diff --git a/input/manager.c b/input/manager.c
index 5cc552be..8da9f641 100644
--- a/input/manager.c
+++ b/input/manager.c
@@ -40,6 +40,7 @@
#include "../src/device.h"
#include "device.h"
+#include "hog_device.h"
#include "server.h"
#include "manager.h"
@@ -195,3 +196,36 @@ void input_manager_exit(void)
connection = NULL;
}
+
+static int hog_device_probe(struct btd_device *device, GSList *uuids)
+{
+ const char *path = device_get_path(device);
+
+ DBG("path %s", path);
+
+ return 0;
+}
+
+static void hog_device_remove(struct btd_device *device)
+{
+ const gchar *path = device_get_path(device);
+
+ DBG("path %s", path);
+}
+
+static struct btd_device_driver hog_driver = {
+ .name = "input-hog",
+ .uuids = BTD_UUIDS(HOG_UUID),
+ .probe = hog_device_probe,
+ .remove = hog_device_remove,
+};
+
+int hog_manager_init(void)
+{
+ return btd_register_device_driver(&hog_driver);
+}
+
+void hog_manager_exit(void)
+{
+ btd_unregister_device_driver(&hog_driver);
+}
diff --git a/input/manager.h b/input/manager.h
index 7b93c5b4..468de647 100644
--- a/input/manager.h
+++ b/input/manager.h
@@ -23,3 +23,6 @@
int input_manager_init(DBusConnection *conn, GKeyFile *config);
void input_manager_exit(void);
+
+int hog_manager_init(void);
+void hog_manager_exit(void);