OSDN Git Service

android/hal-ipc: Allow to pass custom path to IPC
authorSzymon Janc <szymon.janc@tieto.com>
Tue, 20 May 2014 10:07:54 +0000 (12:07 +0200)
committerSzymon Janc <szymon.janc@tieto.com>
Thu, 12 Jun 2014 11:04:30 +0000 (13:04 +0200)
android/hal-bluetooth.c
android/hal-ipc.c
android/hal-ipc.h

index e9a677a..c2a1085 100644 (file)
@@ -420,7 +420,7 @@ static int init(bt_callbacks_t *callbacks)
        hal_ipc_register(HAL_SERVICE_ID_BLUETOOTH, ev_handlers,
                                sizeof(ev_handlers)/sizeof(ev_handlers[0]));
 
-       if (!hal_ipc_init()) {
+       if (!hal_ipc_init(BLUEZ_HAL_SK_PATH, sizeof(BLUEZ_HAL_SK_PATH))) {
                bt_hal_cbacks = NULL;
                return BT_STATUS_FAIL;
        }
index 8f5babe..81d3a1b 100644 (file)
@@ -229,7 +229,7 @@ static int accept_connection(int sk)
        return new_sk;
 }
 
-bool hal_ipc_init(void)
+bool hal_ipc_init(const char *path, size_t size)
 {
        struct sockaddr_un addr;
        int sk;
@@ -246,7 +246,7 @@ bool hal_ipc_init(void)
        memset(&addr, 0, sizeof(addr));
        addr.sun_family = AF_UNIX;
 
-       memcpy(addr.sun_path, BLUEZ_HAL_SK_PATH, sizeof(BLUEZ_HAL_SK_PATH));
+       memcpy(addr.sun_path, path, size);
 
        if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
                err = errno;
index 2fbf30f..0d16cdb 100644 (file)
@@ -21,7 +21,7 @@ struct hal_ipc_handler {
        size_t data_len;
 };
 
-bool hal_ipc_init(void);
+bool hal_ipc_init(const char *path, size_t size);
 void hal_ipc_cleanup(void);
 
 int hal_ipc_cmd(uint8_t service_id, uint8_t opcode, uint16_t len, void *param,