From: Luiz Augusto von Dentz <[email protected]>
This patchset creates a bunch of local headers necessary to implement the
android HAL, the headers are modified so just the bare minimal to build
is implemented.
This effort is an attempt to enable the possibility to compile and test
the HAL interface in non-android environment by linking with
libbt-internal.la, for android build and environment nothing changes.
Luiz Augusto von Dentz (9):
android: Add hardware/hardware.h
android: Add hardware/bluetooth.h
android: Add hardware/bt_sock.h
android: Add cutils/log.h
android: Add cutils/properties.h
build: Enable building HAL as libbt-internal.la
android: Fix building with local cutils/log.h
android: Fix build error when compiling with autotools
android: Fix build error with autotools
Makefile.android | 6 +
android/cutils/log.h | 34 ++++
android/cutils/properties.h | 65 ++++++
android/hal_bluetooth.c | 53 +++--
android/hal_bt_sock.c | 4 +-
android/hardware/bluetooth.h | 468 +++++++++++++++++++++++++++++++++++++++++++
android/hardware/bt_sock.h | 58 ++++++
android/hardware/hardware.h | 227 +++++++++++++++++++++
8 files changed, 887 insertions(+), 28 deletions(-)
create mode 100644 android/cutils/log.h
create mode 100644 android/cutils/properties.h
create mode 100644 android/hardware/bluetooth.h
create mode 100644 android/hardware/bt_sock.h
create mode 100644 android/hardware/hardware.h
--
1.8.3.1
Hi all,
On Thu, Oct 17, 2013 at 06:57:29AM -0400, Anderson Lizardo wrote:
> Hi Luiz,
>
> On Thu, Oct 17, 2013 at 4:55 AM, Luiz Augusto von Dentz
> <[email protected]> wrote:
> > From: Luiz Augusto von Dentz <[email protected]>
> >
> > android/hal_bt_sock.c: In function 'btsock_listen_rfcomm':
> > android/hal_bt_sock.c:30:47: error: expected ')' before '__func__'
> > ALOGD(__func__);
>
> You can implement ALOGD() using vfprintf() (just like DBG(), but which
> uses vsyslog() instead) and avoid this commit.
I agree here, we are anyway implementing ALOGD, let's implement it
correctly.
Best regards
Andrei Emeltchenko
Hi Luiz,
On Thu, Oct 17, 2013 at 4:55 AM, Luiz Augusto von Dentz
<[email protected]> wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> android/hal_bt_sock.c: In function 'btsock_listen_rfcomm':
> android/hal_bt_sock.c:30:47: error: expected ')' before '__func__'
> ALOGD(__func__);
You can implement ALOGD() using vfprintf() (just like DBG(), but which
uses vsyslog() instead) and avoid this commit.
> ---
> android/hal_bluetooth.c | 52 ++++++++++++++++++++++++-------------------------
> android/hal_bt_sock.c | 2 +-
> 2 files changed, 27 insertions(+), 27 deletions(-)
>
> diff --git a/android/hal_bluetooth.c b/android/hal_bluetooth.c
> index 9bb9dcf..cf8f3ae 100644
> --- a/android/hal_bluetooth.c
> +++ b/android/hal_bluetooth.c
> @@ -44,7 +44,7 @@ static bool start_bt_daemon(void)
> {
> int tries = 40; /* wait 4 seconds for completion */
>
> - ALOGD(__func__);
> + ALOGD("%s",__func__);
In any case, several lines here are missing the space after ",".
Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
Hi Luiz,
On Thu, Oct 17, 2013 at 11:55:28AM +0300, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> CC android/android_libbt_internal_la-hal_bluetooth.lo
> android/hal_bluetooth.c:26:28: fatal error: cutils/sockets.h: No such file or directory
> #include <cutils/sockets.h>
> ^
>
> Apparently sockets.h is not used for anything, so for now remove it and
> once it is actually necessary add local cutils/sockets.h so it can be
> build with autotools as well.
I assume this header was needed when we had socket based logging.
Ack
Best regards
Andrei Emeltchenko
> ---
> android/hal_bluetooth.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/android/hal_bluetooth.c b/android/hal_bluetooth.c
> index cf8f3ae..e6b6210 100644
> --- a/android/hal_bluetooth.c
> +++ b/android/hal_bluetooth.c
> @@ -23,7 +23,6 @@
> #include <hardware/bluetooth.h>
> #include <hardware/bt_sock.h>
>
> -#include <cutils/sockets.h>
> #include <cutils/properties.h>
>
> #define LOG_TAG "BlueZ"
> --
> 1.8.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Luiz Augusto von Dentz <[email protected]>
---
android/hardware/bluetooth.h | 468 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 468 insertions(+)
create mode 100644 android/hardware/bluetooth.h
diff --git a/android/hardware/bluetooth.h b/android/hardware/bluetooth.h
new file mode 100644
index 0000000..2741332
--- /dev/null
+++ b/android/hardware/bluetooth.h
@@ -0,0 +1,468 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_INCLUDE_BLUETOOTH_H
+#define ANDROID_INCLUDE_BLUETOOTH_H
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <hardware/hardware.h>
+
+__BEGIN_DECLS
+
+/**
+ * The Bluetooth Hardware Module ID
+ */
+
+#define BT_HARDWARE_MODULE_ID "bluetooth"
+#define BT_STACK_MODULE_ID "bluetooth"
+#define BT_STACK_TEST_MODULE_ID "bluetooth_test"
+
+
+/* Bluetooth profile interface IDs */
+
+#define BT_PROFILE_HANDSFREE_ID "handsfree"
+#define BT_PROFILE_ADVANCED_AUDIO_ID "a2dp"
+#define BT_PROFILE_HEALTH_ID "health"
+#define BT_PROFILE_SOCKETS_ID "socket"
+#define BT_PROFILE_HIDHOST_ID "hidhost"
+#define BT_PROFILE_PAN_ID "pan"
+
+#define BT_PROFILE_GATT_ID "gatt"
+#define BT_PROFILE_AV_RC_ID "avrcp"
+
+/** Bluetooth Address */
+typedef struct {
+ uint8_t address[6];
+} __attribute__((packed))bt_bdaddr_t;
+
+/** Bluetooth Device Name */
+typedef struct {
+ uint8_t name[249];
+} __attribute__((packed))bt_bdname_t;
+
+/** Bluetooth Adapter Visibility Modes*/
+typedef enum {
+ BT_SCAN_MODE_NONE,
+ BT_SCAN_MODE_CONNECTABLE,
+ BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE
+} bt_scan_mode_t;
+
+/** Bluetooth Adapter State */
+typedef enum {
+ BT_STATE_OFF,
+ BT_STATE_ON
+} bt_state_t;
+
+/** Bluetooth Error Status */
+/** We need to build on this */
+
+typedef enum {
+ BT_STATUS_SUCCESS,
+ BT_STATUS_FAIL,
+ BT_STATUS_NOT_READY,
+ BT_STATUS_NOMEM,
+ BT_STATUS_BUSY,
+ BT_STATUS_DONE, /* request already completed */
+ BT_STATUS_UNSUPPORTED,
+ BT_STATUS_PARM_INVALID,
+ BT_STATUS_UNHANDLED,
+ BT_STATUS_AUTH_FAILURE,
+ BT_STATUS_RMT_DEV_DOWN
+
+} bt_status_t;
+
+/** Bluetooth PinKey Code */
+typedef struct {
+ uint8_t pin[16];
+} __attribute__((packed))bt_pin_code_t;
+
+/** Bluetooth Adapter Discovery state */
+typedef enum {
+ BT_DISCOVERY_STOPPED,
+ BT_DISCOVERY_STARTED
+} bt_discovery_state_t;
+
+/** Bluetooth ACL connection state */
+typedef enum {
+ BT_ACL_STATE_CONNECTED,
+ BT_ACL_STATE_DISCONNECTED
+} bt_acl_state_t;
+
+/** Bluetooth 128-bit UUID */
+typedef struct {
+ uint8_t uu[16];
+} bt_uuid_t;
+
+/** Bluetooth SDP service record */
+typedef struct
+{
+ bt_uuid_t uuid;
+ uint16_t channel;
+ char name[256]; // what's the maximum length
+} bt_service_record_t;
+
+
+/** Bluetooth Remote Version info */
+typedef struct
+{
+ int version;
+ int sub_ver;
+ int manufacturer;
+} bt_remote_version_t;
+
+/* Bluetooth Adapter and Remote Device property types */
+typedef enum {
+ /* Properties common to both adapter and remote device */
+ /**
+ * Description - Bluetooth Device Name
+ * Access mode - Adapter name can be GET/SET. Remote device can be GET
+ * Data type - bt_bdname_t
+ */
+ BT_PROPERTY_BDNAME = 0x1,
+ /**
+ * Description - Bluetooth Device Address
+ * Access mode - Only GET.
+ * Data type - bt_bdaddr_t
+ */
+ BT_PROPERTY_BDADDR,
+ /**
+ * Description - Bluetooth Service 128-bit UUIDs
+ * Access mode - Only GET.
+ * Data type - Array of bt_uuid_t (Array size inferred from property length).
+ */
+ BT_PROPERTY_UUIDS,
+ /**
+ * Description - Bluetooth Class of Device as found in Assigned Numbers
+ * Access mode - Only GET.
+ * Data type - uint32_t.
+ */
+ BT_PROPERTY_CLASS_OF_DEVICE,
+ /**
+ * Description - Device Type - BREDR, BLE or DUAL Mode
+ * Access mode - Only GET.
+ * Data type - bt_device_type_t
+ */
+ BT_PROPERTY_TYPE_OF_DEVICE,
+ /**
+ * Description - Bluetooth Service Record
+ * Access mode - Only GET.
+ * Data type - bt_service_record_t
+ */
+ BT_PROPERTY_SERVICE_RECORD,
+
+ /* Properties unique to adapter */
+ /**
+ * Description - Bluetooth Adapter scan mode
+ * Access mode - GET and SET
+ * Data type - bt_scan_mode_t.
+ */
+ BT_PROPERTY_ADAPTER_SCAN_MODE,
+ /**
+ * Description - List of bonded devices
+ * Access mode - Only GET.
+ * Data type - Array of bt_bdaddr_t of the bonded remote devices
+ * (Array size inferred from property length).
+ */
+ BT_PROPERTY_ADAPTER_BONDED_DEVICES,
+ /**
+ * Description - Bluetooth Adapter Discovery timeout (in seconds)
+ * Access mode - GET and SET
+ * Data type - uint32_t
+ */
+ BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
+
+ /* Properties unique to remote device */
+ /**
+ * Description - User defined friendly name of the remote device
+ * Access mode - GET and SET
+ * Data type - bt_bdname_t.
+ */
+ BT_PROPERTY_REMOTE_FRIENDLY_NAME,
+ /**
+ * Description - RSSI value of the inquired remote device
+ * Access mode - Only GET.
+ * Data type - int32_t.
+ */
+ BT_PROPERTY_REMOTE_RSSI,
+ /**
+ * Description - Remote version info
+ * Access mode - SET/GET.
+ * Data type - bt_remote_version_t.
+ */
+
+ BT_PROPERTY_REMOTE_VERSION_INFO,
+
+ BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP = 0xFF,
+} bt_property_type_t;
+
+/** Bluetooth Adapter Property data structure */
+typedef struct
+{
+ bt_property_type_t type;
+ int len;
+ void *val;
+} bt_property_t;
+
+/** Bluetooth Device Type */
+typedef enum {
+ BT_DEVICE_DEVTYPE_BREDR = 0x1,
+ BT_DEVICE_DEVTYPE_BLE,
+ BT_DEVICE_DEVTYPE_DUAL
+} bt_device_type_t;
+/** Bluetooth Bond state */
+typedef enum {
+ BT_BOND_STATE_NONE,
+ BT_BOND_STATE_BONDING,
+ BT_BOND_STATE_BONDED
+} bt_bond_state_t;
+
+/** Bluetooth SSP Bonding Variant */
+typedef enum {
+ BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+ BT_SSP_VARIANT_PASSKEY_ENTRY,
+ BT_SSP_VARIANT_CONSENT,
+ BT_SSP_VARIANT_PASSKEY_NOTIFICATION
+} bt_ssp_variant_t;
+
+#define BT_MAX_NUM_UUIDS 32
+
+/** Bluetooth Interface callbacks */
+
+/** Bluetooth Enable/Disable Callback. */
+typedef void (*adapter_state_changed_callback)(bt_state_t state);
+
+/** GET/SET Adapter Properties callback */
+/* TODO: For the GET/SET property APIs/callbacks, we may need a session
+ * identifier to associate the call with the callback. This would be needed
+ * whenever more than one simultaneous instance of the same adapter_type
+ * is get/set.
+ *
+ * If this is going to be handled in the Java framework, then we do not need
+ * to manage sessions here.
+ */
+typedef void (*adapter_properties_callback)(bt_status_t status,
+ int num_properties,
+ bt_property_t *properties);
+
+/** GET/SET Remote Device Properties callback */
+/** TODO: For remote device properties, do not see a need to get/set
+ * multiple properties - num_properties shall be 1
+ */
+typedef void (*remote_device_properties_callback)(bt_status_t status,
+ bt_bdaddr_t *bd_addr,
+ int num_properties,
+ bt_property_t *properties);
+
+/** New device discovered callback */
+/** If EIR data is not present, then BD_NAME and RSSI shall be NULL and -1
+ * respectively */
+typedef void (*device_found_callback)(int num_properties,
+ bt_property_t *properties);
+
+/** Discovery state changed callback */
+typedef void (*discovery_state_changed_callback)(bt_discovery_state_t state);
+
+/** Bluetooth Legacy PinKey Request callback */
+typedef void (*pin_request_callback)(bt_bdaddr_t *remote_bd_addr,
+ bt_bdname_t *bd_name, uint32_t cod);
+
+/** Bluetooth SSP Request callback - Just Works & Numeric Comparison*/
+/** pass_key - Shall be 0 for BT_SSP_PAIRING_VARIANT_CONSENT &
+ * BT_SSP_PAIRING_PASSKEY_ENTRY */
+/* TODO: Passkey request callback shall not be needed for devices with display
+ * capability. We still need support this in the stack for completeness */
+typedef void (*ssp_request_callback)(bt_bdaddr_t *remote_bd_addr,
+ bt_bdname_t *bd_name,
+ uint32_t cod,
+ bt_ssp_variant_t pairing_variant,
+ uint32_t pass_key);
+
+/** Bluetooth Bond state changed callback */
+/* Invoked in response to create_bond, cancel_bond or remove_bond */
+typedef void (*bond_state_changed_callback)(bt_status_t status,
+ bt_bdaddr_t *remote_bd_addr,
+ bt_bond_state_t state);
+
+/** Bluetooth ACL connection state changed callback */
+typedef void (*acl_state_changed_callback)(bt_status_t status, bt_bdaddr_t *remote_bd_addr,
+ bt_acl_state_t state);
+
+typedef enum {
+ ASSOCIATE_JVM,
+ DISASSOCIATE_JVM
+} bt_cb_thread_evt;
+
+/** Thread Associate/Disassociate JVM Callback */
+/* Callback that is invoked by the callback thread to allow upper layer to attach/detach to/from
+ * the JVM */
+typedef void (*callback_thread_event)(bt_cb_thread_evt evt);
+
+/** Bluetooth Test Mode Callback */
+/* Receive any HCI event from controller. Must be in DUT Mode for this callback to be received */
+typedef void (*dut_mode_recv_callback)(uint16_t opcode, uint8_t *buf, uint8_t len);
+
+/* LE Test mode callbacks
+* This callback shall be invoked whenever the le_tx_test, le_rx_test or le_test_end is invoked
+* The num_packets is valid only for le_test_end command */
+typedef void (*le_test_mode_callback)(bt_status_t status, uint16_t num_packets);
+/** TODO: Add callbacks for Link Up/Down and other generic
+ * notifications/callbacks */
+
+/** Bluetooth DM callback structure. */
+typedef struct {
+ /** set to sizeof(bt_callbacks_t) */
+ size_t size;
+ adapter_state_changed_callback adapter_state_changed_cb;
+ adapter_properties_callback adapter_properties_cb;
+ remote_device_properties_callback remote_device_properties_cb;
+ device_found_callback device_found_cb;
+ discovery_state_changed_callback discovery_state_changed_cb;
+ pin_request_callback pin_request_cb;
+ ssp_request_callback ssp_request_cb;
+ bond_state_changed_callback bond_state_changed_cb;
+ acl_state_changed_callback acl_state_changed_cb;
+ callback_thread_event thread_evt_cb;
+ dut_mode_recv_callback dut_mode_recv_cb;
+ le_test_mode_callback le_test_mode_cb;
+} bt_callbacks_t;
+
+/** NOTE: By default, no profiles are initialized at the time of init/enable.
+ * Whenever the application invokes the 'init' API of a profile, then one of
+ * the following shall occur:
+ *
+ * 1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the
+ * profile as enabled. Subsequently, when the application invokes the
+ * Bluetooth 'enable', as part of the enable sequence the profile that were
+ * marked shall be enabled by calling appropriate stack APIs. The
+ * 'adapter_properties_cb' shall return the list of UUIDs of the
+ * enabled profiles.
+ *
+ * 2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the stack
+ * profile API to initialize the profile and trigger a
+ * 'adapter_properties_cb' with the current list of UUIDs including the
+ * newly added profile's UUID.
+ *
+ * The reverse shall occur whenever the profile 'cleanup' APIs are invoked
+ */
+
+/** Represents the standard Bluetooth DM interface. */
+typedef struct {
+ /** set to sizeof(bt_interface_t) */
+ size_t size;
+ /**
+ * Opens the interface and provides the callback routines
+ * to the implemenation of this interface.
+ */
+ int (*init)(bt_callbacks_t* callbacks );
+
+ /** Enable Bluetooth. */
+ int (*enable)(void);
+
+ /** Disable Bluetooth. */
+ int (*disable)(void);
+
+ /** Closes the interface. */
+ void (*cleanup)(void);
+
+ /** Get all Bluetooth Adapter properties at init */
+ int (*get_adapter_properties)(void);
+
+ /** Get Bluetooth Adapter property of 'type' */
+ int (*get_adapter_property)(bt_property_type_t type);
+
+ /** Set Bluetooth Adapter property of 'type' */
+ /* Based on the type, val shall be one of
+ * bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc
+ */
+ int (*set_adapter_property)(const bt_property_t *property);
+
+ /** Get all Remote Device properties */
+ int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
+
+ /** Get Remote Device property of 'type' */
+ int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
+ bt_property_type_t type);
+
+ /** Set Remote Device property of 'type' */
+ int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
+ const bt_property_t *property);
+
+ /** Get Remote Device's service record for the given UUID */
+ int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
+ bt_uuid_t *uuid);
+
+ /** Start SDP to get remote services */
+ int (*get_remote_services)(bt_bdaddr_t *remote_addr);
+
+ /** Start Discovery */
+ int (*start_discovery)(void);
+
+ /** Cancel Discovery */
+ int (*cancel_discovery)(void);
+
+ /** Create Bluetooth Bonding */
+ int (*create_bond)(const bt_bdaddr_t *bd_addr);
+
+ /** Remove Bond */
+ int (*remove_bond)(const bt_bdaddr_t *bd_addr);
+
+ /** Cancel Bond */
+ int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
+
+ /** BT Legacy PinKey Reply */
+ /** If accept==FALSE, then pin_len and pin_code shall be 0x0 */
+ int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
+ uint8_t pin_len, bt_pin_code_t *pin_code);
+
+ /** BT SSP Reply - Just Works, Numeric Comparison and Passkey
+ * passkey shall be zero for BT_SSP_VARIANT_PASSKEY_COMPARISON &
+ * BT_SSP_VARIANT_CONSENT
+ * For BT_SSP_VARIANT_PASSKEY_ENTRY, if accept==FALSE, then passkey
+ * shall be zero */
+ int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
+ uint8_t accept, uint32_t passkey);
+
+ /** Get Bluetooth profile interface */
+ const void* (*get_profile_interface) (const char *profile_id);
+
+ /** Bluetooth Test Mode APIs - Bluetooth must be enabled for these APIs */
+ /* Configure DUT Mode - Use this mode to enter/exit DUT mode */
+ int (*dut_mode_configure)(uint8_t enable);
+
+ /* Send any test HCI (vendor-specific) command to the controller. Must be in DUT Mode */
+ int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
+ /** BLE Test Mode APIs */
+ /* opcode MUST be one of: LE_Receiver_Test, LE_Transmitter_Test, LE_Test_End */
+ int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
+
+} bt_interface_t;
+
+/** TODO: Need to add APIs for Service Discovery, Service authorization and
+ * connection management. Also need to add APIs for configuring
+ * properties of remote bonded devices such as name, UUID etc. */
+
+typedef struct {
+ struct hw_device_t common;
+ const bt_interface_t* (*get_bluetooth_interface)();
+} bluetooth_device_t;
+
+typedef bluetooth_device_t bluetooth_module_t;
+__END_DECLS
+
+#endif /* ANDROID_INCLUDE_BLUETOOTH_H */
--
1.8.3.1
From: Luiz Augusto von Dentz <[email protected]>
CC android/android_libbt_internal_la-hal_bluetooth.lo
android/hal_bluetooth.c:26:28: fatal error: cutils/sockets.h: No such file or directory
#include <cutils/sockets.h>
^
Apparently sockets.h is not used for anything, so for now remove it and
once it is actually necessary add local cutils/sockets.h so it can be
build with autotools as well.
---
android/hal_bluetooth.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/android/hal_bluetooth.c b/android/hal_bluetooth.c
index cf8f3ae..e6b6210 100644
--- a/android/hal_bluetooth.c
+++ b/android/hal_bluetooth.c
@@ -23,7 +23,6 @@
#include <hardware/bluetooth.h>
#include <hardware/bt_sock.h>
-#include <cutils/sockets.h>
#include <cutils/properties.h>
#define LOG_TAG "BlueZ"
--
1.8.3.1
From: Luiz Augusto von Dentz <[email protected]>
---
android/cutils/properties.h | 65 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 android/cutils/properties.h
diff --git a/android/cutils/properties.h b/android/cutils/properties.h
new file mode 100644
index 0000000..a9f7554
--- /dev/null
+++ b/android/cutils/properties.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2006 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CUTILS_PROPERTIES_H
+#define __CUTILS_PROPERTIES_H
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PROPERTY_KEY_MAX 32
+#define PROPERTY_VALUE_MAX 92
+
+/* property_get: returns the length of the value which will never be
+** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated.
+** (the length does not include the terminating zero).
+**
+** If the property read fails or returns an empty value, the default
+** value is used (if nonnull).
+*/
+static inline int property_get(const char *key, char *value,
+ const char *default_value)
+{
+ const char *env;
+
+ env = getenv(key);
+ if (!env)
+ env = default_value;
+
+ if (!value)
+ return 0;
+
+ strncpy(value, env, PROPERTY_VALUE_MAX);
+
+ return strlen(value);
+}
+
+/* property_set: returns 0 on success, < 0 on failure
+*/
+static inline int property_set(const char *key, const char *value)
+{
+ return setenv(key, value, 0);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--
1.8.3.1
From: Luiz Augusto von Dentz <[email protected]>
---
Makefile.android | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Makefile.android b/Makefile.android
index 4d7da39..6d7437d 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -10,6 +10,12 @@ android_bluetoothd_SOURCES = android/main.c \
src/shared/mgmt.h src/shared/mgmt.c
android_bluetoothd_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@
+
+noinst_LTLIBRARIES += android/libbt-internal.la
+
+android_libbt_internal_la_SOURCES = android/hal.h android/hal_bluetooth.c \
+ android/hal_bt_sock.c
+android_libbt_internal_la_CPPFLAGS = -I$(srcdir)/android
endif
EXTRA_DIST += android/Android.mk android/log.c
--
1.8.3.1
From: Luiz Augusto von Dentz <[email protected]>
android/hal_bt_sock.c:82:21: error: no previous declaration for 'bt_get_sock_interface' [-Werror=missing-declarations]
btsock_interface_t *bt_get_sock_interface(void)
---
android/hal_bt_sock.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/android/hal_bt_sock.c b/android/hal_bt_sock.c
index 318c9c9..2a59e7e 100644
--- a/android/hal_bt_sock.c
+++ b/android/hal_bt_sock.c
@@ -23,6 +23,8 @@
#define LOG_TAG "BlueZ"
#include <cutils/log.h>
+#include "hal.h"
+
static bt_status_t btsock_listen_rfcomm(const char *service_name,
const uint8_t *uuid, int chan,
int *sock, int flags)
--
1.8.3.1
From: Luiz Augusto von Dentz <[email protected]>
---
android/cutils/log.h | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 android/cutils/log.h
diff --git a/android/cutils/log.h b/android/cutils/log.h
new file mode 100644
index 0000000..ecdc585
--- /dev/null
+++ b/android/cutils/log.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This is a temporary hack to enable logging from cutils.
+ */
+
+#ifndef _CUTILS_LOG_H
+#define _CUTILS_LOG_H
+
+#include <stdio.h>
+#define ALOG(level, ...) \
+ ((void)printf("cutils:" level "/" LOG_TAG ": " __VA_ARGS__))
+#define ALOGV(...) ALOG("V", __VA_ARGS__)
+#define ALOGD(...) ALOG("D", __VA_ARGS__)
+#define ALOGI(...) ALOG("I", __VA_ARGS__)
+#define ALOGW(...) ALOG("W", __VA_ARGS__)
+#define ALOGE(...) ALOG("E", __VA_ARGS__)
+#define LOG_ALWAYS_FATAL(...) do { ALOGE(__VA_ARGS__); exit(1); } while (0)
+
+#endif // _CUTILS_LOG_H
--
1.8.3.1
From: Luiz Augusto von Dentz <[email protected]>
android/hal_bt_sock.c: In function 'btsock_listen_rfcomm':
android/hal_bt_sock.c:30:47: error: expected ')' before '__func__'
ALOGD(__func__);
---
android/hal_bluetooth.c | 52 ++++++++++++++++++++++++-------------------------
android/hal_bt_sock.c | 2 +-
2 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/android/hal_bluetooth.c b/android/hal_bluetooth.c
index 9bb9dcf..cf8f3ae 100644
--- a/android/hal_bluetooth.c
+++ b/android/hal_bluetooth.c
@@ -44,7 +44,7 @@ static bool start_bt_daemon(void)
{
int tries = 40; /* wait 4 seconds for completion */
- ALOGD(__func__);
+ ALOGD("%s",__func__);
/* Start Android Bluetooth daemon service */
property_set("ctl.start", SERVICE_NAME);
@@ -69,7 +69,7 @@ static bool start_bt_daemon(void)
static int init(bt_callbacks_t *callbacks)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (interface_ready())
return BT_STATUS_SUCCESS;
@@ -87,14 +87,14 @@ static int init(bt_callbacks_t *callbacks)
static int enable(void)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
return BT_STATUS_UNSUPPORTED;
}
static int disable(void)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -104,7 +104,7 @@ static int disable(void)
static void cleanup(void)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return;
@@ -114,7 +114,7 @@ static void cleanup(void)
static int get_adapter_properties(void)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -124,7 +124,7 @@ static int get_adapter_properties(void)
static int get_adapter_property(bt_property_type_t type)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -134,7 +134,7 @@ static int get_adapter_property(bt_property_type_t type)
static int set_adapter_property(const bt_property_t *property)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -147,7 +147,7 @@ static int set_adapter_property(const bt_property_t *property)
static int get_remote_device_properties(bt_bdaddr_t *remote_addr)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -158,7 +158,7 @@ static int get_remote_device_properties(bt_bdaddr_t *remote_addr)
static int get_remote_device_property(bt_bdaddr_t *remote_addr,
bt_property_type_t type)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -169,7 +169,7 @@ static int get_remote_device_property(bt_bdaddr_t *remote_addr,
static int set_remote_device_property(bt_bdaddr_t *remote_addr,
const bt_property_t *property)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -179,7 +179,7 @@ static int set_remote_device_property(bt_bdaddr_t *remote_addr,
static int get_remote_service_record(bt_bdaddr_t *remote_addr, bt_uuid_t *uuid)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -189,7 +189,7 @@ static int get_remote_service_record(bt_bdaddr_t *remote_addr, bt_uuid_t *uuid)
static int get_remote_services(bt_bdaddr_t *remote_addr)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -199,7 +199,7 @@ static int get_remote_services(bt_bdaddr_t *remote_addr)
static int start_discovery(void)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -209,7 +209,7 @@ static int start_discovery(void)
static int cancel_discovery(void)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -219,7 +219,7 @@ static int cancel_discovery(void)
static int create_bond(const bt_bdaddr_t *bd_addr)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -232,7 +232,7 @@ static int create_bond(const bt_bdaddr_t *bd_addr)
static int cancel_bond(const bt_bdaddr_t *bd_addr)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -242,7 +242,7 @@ static int cancel_bond(const bt_bdaddr_t *bd_addr)
static int remove_bond(const bt_bdaddr_t *bd_addr)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -253,7 +253,7 @@ static int remove_bond(const bt_bdaddr_t *bd_addr)
static int pin_reply(const bt_bdaddr_t *bd_addr, uint8_t accept,
uint8_t pin_len, bt_pin_code_t *pin_code)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -264,7 +264,7 @@ static int pin_reply(const bt_bdaddr_t *bd_addr, uint8_t accept,
static int ssp_reply(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
uint8_t accept, uint32_t passkey)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -277,7 +277,7 @@ static int ssp_reply(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
static const void *get_profile_interface(const char *profile_id)
{
- ALOGD("%s: %s", __func__, profile_id);
+ ALOGD("%s: %s",__func__, profile_id);
if (!interface_ready())
return NULL;
@@ -290,7 +290,7 @@ static const void *get_profile_interface(const char *profile_id)
static int dut_mode_configure(uint8_t enable)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -300,7 +300,7 @@ static int dut_mode_configure(uint8_t enable)
static int dut_mode_send(uint16_t opcode, uint8_t *buf, uint8_t len)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
if (!interface_ready())
return BT_STATUS_NOT_READY;
@@ -336,14 +336,14 @@ static const bt_interface_t bluetooth_if = {
static const bt_interface_t *get_bluetooth_interface(void)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
return &bluetooth_if;
}
static int close_bluetooth(struct hw_device_t *device)
{
- ALOGD(__func__);
+ ALOGD("%s",__func__);
cleanup();
@@ -355,7 +355,7 @@ static int open_bluetooth(const struct hw_module_t *module, char const *name,
{
bluetooth_device_t *dev = malloc(sizeof(bluetooth_device_t));
- ALOGD(__func__);
+ ALOGD("%s",__func__);
memset(dev, 0, sizeof(bluetooth_device_t));
dev->common.tag = HARDWARE_DEVICE_TAG;
diff --git a/android/hal_bt_sock.c b/android/hal_bt_sock.c
index 3a6d173..318c9c9 100644
--- a/android/hal_bt_sock.c
+++ b/android/hal_bt_sock.c
@@ -27,7 +27,7 @@ static bt_status_t btsock_listen_rfcomm(const char *service_name,
const uint8_t *uuid, int chan,
int *sock, int flags)
{
- ALOGD(__func__);
+ ALOGD("%s", __func__);
return BT_STATUS_UNSUPPORTED;
}
--
1.8.3.1
From: Luiz Augusto von Dentz <[email protected]>
---
android/hardware/bt_sock.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 android/hardware/bt_sock.h
diff --git a/android/hardware/bt_sock.h b/android/hardware/bt_sock.h
new file mode 100644
index 0000000..a4aa046
--- /dev/null
+++ b/android/hardware/bt_sock.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_INCLUDE_BT_SOCK_H
+#define ANDROID_INCLUDE_BT_SOCK_H
+
+__BEGIN_DECLS
+
+#define BTSOCK_FLAG_ENCRYPT 1
+#define BTSOCK_FLAG_AUTH (1 << 1)
+
+typedef enum {
+ BTSOCK_RFCOMM = 1,
+ BTSOCK_SCO = 2,
+ BTSOCK_L2CAP = 3
+} btsock_type_t;
+
+/** Represents the standard BT SOCKET interface. */
+typedef struct {
+ short size;
+ bt_bdaddr_t bd_addr;
+ int channel;
+ int status;
+} __attribute__((packed)) sock_connect_signal_t;
+
+typedef struct {
+
+ /** set to size of this struct*/
+ size_t size;
+ /**
+ * listen to a rfcomm uuid or channel. It returns the socket fd from which
+ * btsock_connect_signal can be read out when a remote device connected
+ */
+ bt_status_t (*listen)(btsock_type_t type, const char* service_name, const uint8_t* service_uuid, int channel, int* sock_fd, int flags);
+ /*
+ * connect to a rfcomm uuid channel of remote device, It returns the socket fd from which
+ * the btsock_connect_signal and a new socket fd to be accepted can be read out when connected
+ */
+ bt_status_t (*connect)(const bt_bdaddr_t *bd_addr, btsock_type_t type, const uint8_t* uuid, int channel, int* sock_fd, int flags);
+
+} btsock_interface_t;
+
+__END_DECLS
+
+#endif /* ANDROID_INCLUDE_BT_SOCK_H */
--
1.8.3.1
From: Luiz Augusto von Dentz <[email protected]>
---
android/hardware/hardware.h | 227 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 227 insertions(+)
create mode 100644 android/hardware/hardware.h
diff --git a/android/hardware/hardware.h b/android/hardware/hardware.h
new file mode 100644
index 0000000..c7e8cc7
--- /dev/null
+++ b/android/hardware/hardware.h
@@ -0,0 +1,227 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_INCLUDE_HARDWARE_HARDWARE_H
+#define ANDROID_INCLUDE_HARDWARE_HARDWARE_H
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+/*
+ * Value for the hw_module_t.tag field
+ */
+
+#define MAKE_TAG_CONSTANT(A,B,C,D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
+
+#define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
+#define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
+
+#define HARDWARE_MAKE_API_VERSION(maj,min) \
+ ((((maj) & 0xff) << 8) | ((min) & 0xff))
+
+#define HARDWARE_MAKE_API_VERSION_2(maj,min,hdr) \
+ ((((maj) & 0xff) << 24) | (((min) & 0xff) << 16) | ((hdr) & 0xffff))
+#define HARDWARE_API_VERSION_2_MAJ_MIN_MASK 0xffff0000
+#define HARDWARE_API_VERSION_2_HEADER_MASK 0x0000ffff
+
+
+/*
+ * The current HAL API version.
+ *
+ * All module implementations must set the hw_module_t.hal_api_version field
+ * to this value when declaring the module with HAL_MODULE_INFO_SYM.
+ *
+ * Note that previous implementations have always set this field to 0.
+ * Therefore, libhardware HAL API will always consider versions 0.0 and 1.0
+ * to be 100% binary compatible.
+ *
+ */
+#define HARDWARE_HAL_API_VERSION HARDWARE_MAKE_API_VERSION(1, 0)
+
+/*
+ * Helper macros for module implementors.
+ *
+ * The derived modules should provide convenience macros for supported
+ * versions so that implementations can explicitly specify module/device
+ * versions at definition time.
+ *
+ * Use this macro to set the hw_module_t.module_api_version field.
+ */
+#define HARDWARE_MODULE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min)
+#define HARDWARE_MODULE_API_VERSION_2(maj,min,hdr) HARDWARE_MAKE_API_VERSION_2(maj,min,hdr)
+
+/*
+ * Use this macro to set the hw_device_t.version field
+ */
+#define HARDWARE_DEVICE_API_VERSION(maj,min) HARDWARE_MAKE_API_VERSION(maj,min)
+#define HARDWARE_DEVICE_API_VERSION_2(maj,min,hdr) HARDWARE_MAKE_API_VERSION_2(maj,min,hdr)
+
+struct hw_module_t;
+struct hw_module_methods_t;
+struct hw_device_t;
+
+/**
+ * Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
+ * and the fields of this data structure must begin with hw_module_t
+ * followed by module specific information.
+ */
+typedef struct hw_module_t {
+ /** tag must be initialized to HARDWARE_MODULE_TAG */
+ uint32_t tag;
+
+ /**
+ * The API version of the implemented module. The module owner is
+ * responsible for updating the version when a module interface has
+ * changed.
+ *
+ * The derived modules such as gralloc and audio own and manage this field.
+ * The module user must interpret the version field to decide whether or
+ * not to inter-operate with the supplied module implementation.
+ * For example, SurfaceFlinger is responsible for making sure that
+ * it knows how to manage different versions of the gralloc-module API,
+ * and AudioFlinger must know how to do the same for audio-module API.
+ *
+ * The module API version should include a major and a minor component.
+ * For example, version 1.0 could be represented as 0x0100. This format
+ * implies that versions 0x0100-0x01ff are all API-compatible.
+ *
+ * In the future, libhardware will expose a hw_get_module_version()
+ * (or equivalent) function that will take minimum/maximum supported
+ * versions as arguments and would be able to reject modules with
+ * versions outside of the supplied range.
+ */
+ uint16_t module_api_version;
+#define version_major module_api_version
+ /**
+ * version_major/version_minor defines are supplied here for temporary
+ * source code compatibility. They will be removed in the next version.
+ * ALL clients must convert to the new version format.
+ */
+
+ /**
+ * The API version of the HAL module interface. This is meant to
+ * version the hw_module_t, hw_module_methods_t, and hw_device_t
+ * structures and definitions.
+ *
+ * The HAL interface owns this field. Module users/implementations
+ * must NOT rely on this value for version information.
+ *
+ * Presently, 0 is the only valid value.
+ */
+ uint16_t hal_api_version;
+#define version_minor hal_api_version
+
+ /** Identifier of module */
+ const char *id;
+
+ /** Name of this module */
+ const char *name;
+
+ /** Author/owner/implementor of the module */
+ const char *author;
+
+ /** Modules methods */
+ struct hw_module_methods_t* methods;
+
+ /** module's dso */
+ void* dso;
+
+ /** padding to 128 bytes, reserved for future use */
+ uint32_t reserved[32-7];
+
+} hw_module_t;
+
+typedef struct hw_module_methods_t {
+ /** Open a specific device */
+ int (*open)(const struct hw_module_t* module, const char* id,
+ struct hw_device_t** device);
+
+} hw_module_methods_t;
+
+/**
+ * Every device data structure must begin with hw_device_t
+ * followed by module specific public methods and attributes.
+ */
+typedef struct hw_device_t {
+ /** tag must be initialized to HARDWARE_DEVICE_TAG */
+ uint32_t tag;
+
+ /**
+ * Version of the module-specific device API. This value is used by
+ * the derived-module user to manage different device implementations.
+ *
+ * The module user is responsible for checking the module_api_version
+ * and device version fields to ensure that the user is capable of
+ * communicating with the specific module implementation.
+ *
+ * One module can support multiple devices with different versions. This
+ * can be useful when a device interface changes in an incompatible way
+ * but it is still necessary to support older implementations at the same
+ * time. One such example is the Camera 2.0 API.
+ *
+ * This field is interpreted by the module user and is ignored by the
+ * HAL interface itself.
+ */
+ uint32_t version;
+
+ /** reference to the module this device belongs to */
+ struct hw_module_t* module;
+
+ /** padding reserved for future use */
+ uint32_t reserved[12];
+
+ /** Close this device */
+ int (*close)(struct hw_device_t* device);
+
+} hw_device_t;
+
+/**
+ * Name of the hal_module_info
+ */
+#define HAL_MODULE_INFO_SYM HMI
+
+/**
+ * Name of the hal_module_info as a string
+ */
+#define HAL_MODULE_INFO_SYM_AS_STR "HMI"
+
+/**
+ * Get the module info associated with a module by id.
+ *
+ * @return: 0 == success, <0 == error and *module == NULL
+ */
+int hw_get_module(const char *id, const struct hw_module_t **module);
+
+/**
+ * Get the module info associated with a module instance by class 'class_id'
+ * and instance 'inst'.
+ *
+ * Some modules types necessitate multiple instances. For example audio supports
+ * multiple concurrent interfaces and thus 'audio' is the module class
+ * and 'primary' or 'a2dp' are module interfaces. This implies that the files
+ * providing these modules would be named audio.primary.<variant>.so and
+ * audio.a2dp.<variant>.so
+ *
+ * @return: 0 == success, <0 == error and *module == NULL
+ */
+int hw_get_module_by_class(const char *class_id, const char *inst,
+ const struct hw_module_t **module);
+
+__END_DECLS
+
+#endif /* ANDROID_INCLUDE_HARDWARE_HARDWARE_H */
--
1.8.3.1