2014-07-24 11:32:54

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH] android/client: Set default handsfree mode for host

From: Andrei Emeltchenko <[email protected]>

For testing set default handsfree mode to HF
---
android/cutils/properties.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/android/cutils/properties.h b/android/cutils/properties.h
index ef40f01..8b3d84d 100644
--- a/android/cutils/properties.h
+++ b/android/cutils/properties.h
@@ -31,6 +31,7 @@
#define PROPERTY_VALUE_MAX 32

#define BLUETOOTH_MODE_PROPERTY_NAME "persist.sys.bluetooth.mode"
+#define BLUETOOTH_MODE_PROPERTY_HANDSFREE "persist.sys.bluetooth.handsfree"

static inline int property_get(const char *key, char *value,
const char *default_value)
@@ -40,6 +41,9 @@ static inline int property_get(const char *key, char *value,
if (!strcmp(key, BLUETOOTH_MODE_PROPERTY_NAME))
prop = getenv("BLUETOOTH_MODE");

+ if (!strcmp(key, BLUETOOTH_MODE_PROPERTY_HANDSFREE))
+ prop = "hfp";
+
if (!prop)
prop = default_value;

--
1.9.1



2014-07-28 10:46:23

by Szymon Janc

[permalink] [raw]
Subject: Re: [PATCH] android/client: Set default handsfree mode for host

Hi Andrei,

On Thursday 24 of July 2014 14:32:54 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <[email protected]>
>
> For testing set default handsfree mode to HF
> ---
> android/cutils/properties.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/android/cutils/properties.h b/android/cutils/properties.h
> index ef40f01..8b3d84d 100644
> --- a/android/cutils/properties.h
> +++ b/android/cutils/properties.h
> @@ -31,6 +31,7 @@
> #define PROPERTY_VALUE_MAX 32
>
> #define BLUETOOTH_MODE_PROPERTY_NAME "persist.sys.bluetooth.mode"
> +#define BLUETOOTH_MODE_PROPERTY_HANDSFREE "persist.sys.bluetooth.handsfree"
>
> static inline int property_get(const char *key, char *value,
> const char *default_value)
> @@ -40,6 +41,9 @@ static inline int property_get(const char *key, char *value,
> if (!strcmp(key, BLUETOOTH_MODE_PROPERTY_NAME))
> prop = getenv("BLUETOOTH_MODE");
>
> + if (!strcmp(key, BLUETOOTH_MODE_PROPERTY_HANDSFREE))
> + prop = "hfp";

I'd prefer to not have this hardcoded. So please use getenv() for getting
handsfree mode (similar to what is now with bluetooth mode).

This will allow for easy testing of all configurations on Linux host.

> +
> if (!prop)
> prop = default_value;
>
>

--
Best regards,
Szymon Janc