Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-bluetooth-bluez: Commit

external/bluetooth/bluez


Commit MetaInfo

Revision169cdc40e92fe1cf2512a014ed7463a6da4b72b9 (tree)
Time2017-06-01 12:31:26
AuthorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

android: btattach: get options from properties

Since Android 7.0 the services can't accept arguments from cmdline.
To workaround it, let btattach get options from android properties.

Change Summary

Incremental Difference

--- a/android/Android.mk
+++ b/android/Android.mk
@@ -679,6 +679,7 @@ LOCAL_CFLAGS := $(BLUEZ_COMMON_CFLAGS)
679679
680680 LOCAL_MODULE_TAGS := optional
681681 LOCAL_MODULE := btattach
682+LOCAL_SHARED_LIBRARIES := libcutils
682683
683684 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/bluez/configure.ac
684685
--- a/tools/btattach.c
+++ b/tools/btattach.c
@@ -49,6 +49,10 @@
4949 #include "src/shared/tty.h"
5050 #include "src/shared/hci.h"
5151
52+#ifdef ANDROID
53+#include "cutils/properties.h"
54+#endif
55+
5256 static int open_serial(const char *path, unsigned int speed, bool flowctl)
5357 {
5458 struct termios ti;
@@ -235,6 +239,20 @@ int main(int argc, char *argv[])
235239 int exit_status, count = 0, proto_id = HCI_UART_H4;
236240 unsigned int speed = B115200;
237241
242+#ifdef ANDROID
243+ char pval[PROPERTY_VALUE_MAX];
244+ if (property_get("hal.bluetooth.uart", pval, NULL) > 0) {
245+ bredr_path = strdup(pval);
246+ }
247+ if (property_get("hal.bluetooth.uart.proto", pval, NULL) > 0) {
248+ proto = strdup(pval);
249+ }
250+ if (property_get("hal.bluetooth.uart.speed", pval, NULL) > 0) {
251+ unsigned int s = tty_get_speed(atoi(pval));
252+ if (s > 0) speed = s;
253+ }
254+#endif
255+
238256 for (;;) {
239257 int opt;
240258
Show on old repository browser