diff options
author | Lukasz Rymanowski <lukasz.rymanowski@tieto.com> | 2014-04-23 18:53:27 +0200 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-04-24 10:32:47 +0200 |
commit | 1090705817b07722c56af4b2dd9d3f1022b5338a (patch) | |
tree | 15cf2836c0e6224e61f78c928f833df5f6a6b0b9 /android/hal-bluetooth.c | |
parent | 8e363b81db4389dfce12aff75f4617e886a6b920 (diff) | |
download | bluez-1090705817b07722c56af4b2dd9d3f1022b5338a.tar.gz |
android/bluetooth: Make possible to start BlueZ in a single mode
This patch adds possibility to start BlueZ in LE or BR/EDR mode
when having dual mode chip below.
Diffstat (limited to 'android/hal-bluetooth.c')
-rw-r--r-- | android/hal-bluetooth.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c index 48d5ea296..1fa10e0cf 100644 --- a/android/hal-bluetooth.c +++ b/android/hal-bluetooth.c @@ -29,6 +29,8 @@ #include "hal-ipc.h" #include "hal-utils.h" +#define MODE_PROPERTY_NAME "persist.sys.bluetooth.mode" + static const bt_callbacks_t *bt_hal_cbacks = NULL; #define enum_prop_to_hal(prop, hal_prop, type) do { \ @@ -412,6 +414,21 @@ static const struct hal_ipc_handler ev_handlers[] = { } }; +static uint8_t get_mode(void) +{ + char value[PROPERTY_VALUE_MAX]; + + if (property_get(MODE_PROPERTY_NAME, value, "") > 0 && + (!strcasecmp(value, "bredr"))) + return HAL_MODE_BREDR; + + if (property_get(MODE_PROPERTY_NAME, value, "") > 0 && + (!strcasecmp(value, "le"))) + return HAL_MODE_LE; + + return HAL_MODE_DEFAULT; +} + static int init(bt_callbacks_t *callbacks) { struct hal_cmd_register_module cmd; @@ -433,7 +450,7 @@ static int init(bt_callbacks_t *callbacks) } cmd.service_id = HAL_SERVICE_ID_BLUETOOTH; - cmd.mode = HAL_MODE_DEFAULT; + cmd.mode = get_mode(); status = hal_ipc_cmd(HAL_SERVICE_ID_CORE, HAL_OP_REGISTER_MODULE, sizeof(cmd), &cmd, NULL, NULL, NULL); |