[PATCH 07/11] android/hal-bluetooth: Add support for sending configuration

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

 



---
 android/hal-bluetooth.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 44eddbd..275ea52 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -31,6 +31,10 @@
 
 #define MODE_PROPERTY_NAME "persist.sys.bluetooth.mode"
 
+#define CONFIG_PROP_VENDOR "ro.product.manufacturer"
+#define CONFIG_PROP_NAME "ro.product.name"
+#define CONFIG_PROP_MODEL "ro.product.model"
+
 static const bt_callbacks_t *bt_hal_cbacks = NULL;
 
 #define enum_prop_to_hal(prop, hal_prop, type) do { \
@@ -405,6 +409,37 @@ static uint8_t get_mode(void)
 	return HAL_MODE_DEFAULT;
 }
 
+static int send_configuration(void)
+{
+	char buf[IPC_MTU];
+	struct hal_cmd_configuration *cmd = (void *) buf;
+	char prop[PROPERTY_VALUE_MAX];
+
+	cmd->num = 0;
+
+	if (property_get(CONFIG_PROP_VENDOR, prop, NULL) > 0) {
+		strcpy((char *) cmd->props[cmd->num].val, prop);
+		cmd->props[cmd->num].type = HAL_CONFIG_VENDOR;
+		cmd->num++;
+	}
+
+	if (property_get(CONFIG_PROP_NAME, prop, NULL) > 0) {
+		strcpy((char *) cmd->props[cmd->num].val, prop);
+		cmd->props[cmd->num].type = HAL_CONFIG_NAME;
+		cmd->num++;
+	}
+
+	if (property_get(CONFIG_PROP_MODEL, prop, NULL) > 0) {
+		strcpy((char *) cmd->props[cmd->num].val, prop);
+		cmd->props[cmd->num].type = HAL_CONFIG_MODEL;
+		cmd->num++;
+	}
+
+	return hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_CONFIGURATION,
+				sizeof(*cmd) + cmd->num * sizeof(cmd->props[0]),
+				cmd, NULL, NULL, NULL);
+}
+
 static int init(bt_callbacks_t *callbacks)
 {
 	struct hal_cmd_register_module cmd;
@@ -437,6 +472,12 @@ static int init(bt_callbacks_t *callbacks)
 		return BT_STATUS_FAIL;
 	}
 
+	status = send_configuration();
+	if (status != BT_STATUS_SUCCESS) {
+		error("Failed to send configuration");
+		goto fail;
+	}
+
 	cmd.service_id = HAL_SERVICE_ID_BLUETOOTH;
 	cmd.mode = get_mode();
 
-- 
1.9.3

--
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