From ef2d3dd3d2b2878a09d0fdabb65bf144aa1a5a3f Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 23 Oct 2013 10:14:58 +0300 Subject: [PATCH] android: Add stubs for daemon-side HID support --- Makefile.android | 1 + android/Android.mk | 1 + android/hid.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ android/hid.h | 24 +++++++++++++++++++++++ android/main.c | 5 +++++ 5 files changed, 79 insertions(+) create mode 100644 android/hid.c create mode 100644 android/hid.h diff --git a/Makefile.android b/Makefile.android index 052d755a8..90d59731b 100644 --- a/Makefile.android +++ b/Makefile.android @@ -9,6 +9,7 @@ android_bluetoothd_SOURCES = android/main.c \ src/shared/util.h src/shared/util.c \ src/shared/mgmt.h src/shared/mgmt.c \ android/adapter.h android/adapter.c \ + android/hid.h android/hid.c \ android/ipc.h android/ipc.c android_bluetoothd_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@ diff --git a/android/Android.mk b/android/Android.mk index c4b062169..bad5ebcd1 100644 --- a/android/Android.mk +++ b/android/Android.mk @@ -16,6 +16,7 @@ LOCAL_SRC_FILES := \ main.c \ log.c \ adapter.c \ + hid.c \ ipc.c ipc.h \ ../src/shared/mgmt.c \ ../src/shared/util.c \ diff --git a/android/hid.c b/android/hid.c new file mode 100644 index 000000000..72eef0d41 --- /dev/null +++ b/android/hid.c @@ -0,0 +1,48 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * + * 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 + * + */ + +#include + +#include + +#include "log.h" +#include "hal-msg.h" +#include "ipc.h" +#include "hid.h" + +void bt_hid_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf, uint16_t len) +{ + uint8_t status = HAL_ERROR_FAILED; + + switch (opcode) { + case HAL_MSG_OP_BT_HID_CONNECT: + break; + case HAL_MSG_OP_BT_HID_DISCONNECT: + break; + default: + DBG("Unhandled command, opcode 0x%x", opcode); + break; + } + + ipc_send_error(io, HAL_SERVICE_ID_BLUETOOTH, status); +} diff --git a/android/hid.h b/android/hid.h new file mode 100644 index 000000000..1247488f2 --- /dev/null +++ b/android/hid.h @@ -0,0 +1,24 @@ +/* + * + * BlueZ - Bluetooth protocol stack for Linux + * + * Copyright (C) 2013 Intel Corporation. All rights reserved. + * + * + * 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 + * + */ + +void bt_hid_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf, uint16_t len); diff --git a/android/main.c b/android/main.c index 988d08b69..5e297f7e2 100644 --- a/android/main.c +++ b/android/main.c @@ -49,6 +49,7 @@ #include "src/shared/mgmt.h" #include "adapter.h" +#include "hid.h" #include "hal-msg.h" #include "ipc.h" @@ -162,6 +163,10 @@ static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond, bt_adapter_handle_cmd(hal_cmd_io, msg->opcode, msg->payload, msg->len); break; + case HAL_SERVICE_ID_HIDHOST: + bt_hid_handle_cmd(hal_cmd_io, msg->opcode, msg->payload, + msg->len); + break; default: ipc_send_error(hal_cmd_io, msg->service_id, HAL_ERROR_FAILED); break; -- 2.47.3