OSDN Git Service

Initial Contribution
[android-x86/external-bluetooth-bluez.git] / utils / hcid / main.c
index f75f6c1..77b3912 100644 (file)
 
 #include <glib.h>
 
+#ifdef ANDROID_EXPAND_NAME
+#include <cutils/properties.h>
+#endif
+
 #include <dbus/dbus.h>
 
 #include "hcid.h"
@@ -324,6 +328,10 @@ static char *expand_name(char *dst, int size, char *str, int dev_id)
        register int sp, np, olen;
        char *opt, buf[10];
 
+#ifdef ANDROID_EXPAND_NAME
+       char value[PROPERTY_VALUE_MAX];
+#endif
+
        if (!str && !dst)
                return NULL;
 
@@ -343,6 +351,23 @@ static char *expand_name(char *dst, int size, char *str, int dev_id)
                                opt = hcid.host_name;
                                break;
 
+#ifdef ANDROID_EXPAND_NAME
+                       case 'b':
+                               property_get("ro.product.brand", value, "");
+                               opt = value;
+                               break;
+
+                       case 'm':
+                               property_get("ro.product.model", value, "");
+                               opt = value;
+                               break;
+
+                       case 'n':
+                               property_get("ro.product.name", value, "");
+                               opt = value;
+                               break;
+#endif
+
                        case '%':
                                dst[np++] = str[sp++];
                                /* fall through */
@@ -791,6 +816,13 @@ int main(int argc, char *argv[])
        int opt, daemonize = 1, debug = 0, sdp = 1, experimental = 0;
        GKeyFile *config;
 
+#ifdef ANDROID_SET_AID_AND_CAP
+       /* Unfortunately Android's init.rc does not yet support applying
+        * capabilities. So we must do it in-process. */
+       void *android_set_aid_and_cap(void);
+       android_set_aid_and_cap();
+#endif
+
        /* Default HCId settings */
        memset(&hcid, 0, sizeof(hcid));
        hcid.auto_init   = 1;
@@ -928,7 +960,9 @@ int main(int argc, char *argv[])
         * the plugins might wanna expose some paths on the bus. However the
         * best order of how to init various subsystems of the Bluetooth
         * daemon needs to be re-worked. */
+#if 0
        plugin_init(config);
+#endif
 
        init_security_data();
 
@@ -948,7 +982,9 @@ int main(int argc, char *argv[])
 
        hcid_dbus_unregister();
 
+#if 0
        plugin_cleanup();
+#endif
 
        stop_sdp_server();