Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state
@ 2014-11-21 11:16 Marcin Kraglak
  2014-11-21 11:16 ` [PATCH 2/6] android/hal-bluetooth: Implement set_os_callouts Marcin Kraglak
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Marcin Kraglak @ 2014-11-21 11:16 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/bluetooth.c     | 24 ++++++++++++++++++++++++
 android/hal-bluetooth.c | 19 +++++++++++++++++--
 android/hal-msg.h       |  9 +++++++++
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index da549d7..947a83c 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -5134,6 +5134,27 @@ static void handle_le_test_mode_cmd(const void *buf, uint16_t len)
 							HAL_STATUS_FAILED);
 }
 
+static void handle_get_connection_state(const void *buf, uint16_t len)
+{
+	const struct hal_cmd_get_connection_state *cmd = buf;
+	struct hal_rsp_get_connection_state rsp;
+	char address[18];
+	bdaddr_t bdaddr;
+
+	android2bdaddr(cmd->bdaddr, &bdaddr);
+	ba2str(&bdaddr, address);
+
+	DBG("%s", address);
+
+	/* TODO */
+
+	rsp.connection_state = 0;
+
+	ipc_send_rsp_full(hal_ipc, HAL_SERVICE_ID_BLUETOOTH,
+				HAL_OP_GET_CONNECTION_STATE, sizeof(rsp), &rsp,
+				-1);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_ENABLE */
 	{ handle_enable_cmd, false, 0 },
@@ -5184,6 +5205,9 @@ static const struct ipc_handler cmd_handlers[] = {
 					sizeof(struct hal_cmd_dut_mode_send) },
 	/* HAL_OP_LE_TEST_MODE */
 	{ handle_le_test_mode_cmd, true, sizeof(struct hal_cmd_le_test_mode) },
+	/* HAL_OP_GET_CONNECTION_STATE */
+	{ handle_get_connection_state, false,
+				sizeof(struct hal_cmd_get_connection_state) },
 };
 
 bool bt_bluetooth_register(struct ipc *ipc, uint8_t mode)
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 68811df..defaef1 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -957,11 +957,26 @@ static int config_hci_snoop_log(uint8_t enable)
 #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
 static int get_connection_state(const bt_bdaddr_t *bd_addr)
 {
+	struct hal_cmd_get_connection_state cmd;
+	struct hal_rsp_get_connection_state rsp;
+	size_t rsp_len = sizeof(rsp);
+	bt_status_t status;
+
 	DBG("bdaddr: %s", bdaddr2str(bd_addr));
 
-	/* TODO: implement */
+	if (!interface_ready())
+		return 0;
 
-	return BT_STATUS_UNSUPPORTED;
+	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
+
+	status = hal_ipc_cmd(HAL_SERVICE_ID_BLUETOOTH,
+			HAL_OP_GET_CONNECTION_STATE, sizeof(cmd), &cmd,
+			&rsp_len, &rsp, NULL);
+
+	if (status != BT_STATUS_SUCCESS)
+		return 0;
+
+	return rsp.connection_state;
 }
 
 static int set_os_callouts(bt_os_callouts_t *callouts)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index ca512d4..6a5a81c 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -252,6 +252,15 @@ struct hal_cmd_le_test_mode {
 	uint8_t  data[0];
 } __attribute__((packed));
 
+#define HAL_OP_GET_CONNECTION_STATE	0x15
+struct hal_cmd_get_connection_state {
+	uint8_t  bdaddr[6];
+} __attribute__((packed));
+
+struct hal_rsp_get_connection_state {
+	int32_t connection_state;
+} __attribute__((packed));
+
 /* Bluetooth Socket HAL api */
 
 #define HAL_SOCK_RFCOMM		0x01
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] android/hal-bluetooth: Implement set_os_callouts
  2014-11-21 11:16 [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state Marcin Kraglak
@ 2014-11-21 11:16 ` Marcin Kraglak
  2014-11-21 11:16 ` [PATCH 3/6] android/hal-bluetooth: Implement read_energy_info Marcin Kraglak
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Marcin Kraglak @ 2014-11-21 11:16 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/hal-bluetooth.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index defaef1..50e3f07 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -30,6 +30,7 @@
 #include "hal-utils.h"
 
 static const bt_callbacks_t *bt_hal_cbacks = NULL;
+static const bt_os_callouts_t *bt_os_callouts = NULL;
 
 #define enum_prop_to_hal(prop, hal_prop, type) do { \
 	static type e; \
@@ -981,9 +982,14 @@ static int get_connection_state(const bt_bdaddr_t *bd_addr)
 
 static int set_os_callouts(bt_os_callouts_t *callouts)
 {
-	DBG("callouts: %p", callouts);
+	DBG("");
 
-	/* TODO: implement */
+	/* TODO investigate how expose callouts for daemon */
+
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
+
+	bt_os_callouts = callouts;
 
 	return BT_STATUS_SUCCESS;
 }
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] android/hal-bluetooth: Implement read_energy_info
  2014-11-21 11:16 [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state Marcin Kraglak
  2014-11-21 11:16 ` [PATCH 2/6] android/hal-bluetooth: Implement set_os_callouts Marcin Kraglak
@ 2014-11-21 11:16 ` Marcin Kraglak
  2014-11-21 11:16 ` [PATCH 4/6] android/client: Add read_energy_info command Marcin Kraglak
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Marcin Kraglak @ 2014-11-21 11:16 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/bluetooth.c     | 12 ++++++++++++
 android/hal-bluetooth.c | 26 ++++++++++++++++++++++++--
 android/hal-msg.h       | 12 ++++++++++++
 3 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 947a83c..ca3dd24 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -5155,6 +5155,16 @@ static void handle_get_connection_state(const void *buf, uint16_t len)
 				-1);
 }
 
+static void handle_read_energy_info(const void *buf, uint16_t len)
+{
+	DBG("");
+
+	/* TODO */
+
+	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_BLUETOOTH, HAL_OP_READ_ENERGY_INFO,
+							HAL_STATUS_UNSUPPORTED);
+}
+
 static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_ENABLE */
 	{ handle_enable_cmd, false, 0 },
@@ -5208,6 +5218,8 @@ static const struct ipc_handler cmd_handlers[] = {
 	/* HAL_OP_GET_CONNECTION_STATE */
 	{ handle_get_connection_state, false,
 				sizeof(struct hal_cmd_get_connection_state) },
+	/* HAL_OP_READ_ENERGY_INFO */
+	{ handle_read_energy_info, false, 0 },
 };
 
 bool bt_bluetooth_register(struct ipc *ipc, uint8_t mode)
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index 50e3f07..9685499 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -350,6 +350,24 @@ static void handle_le_test_mode(void *buf, uint16_t len, int fd)
 		bt_hal_cbacks->le_test_mode_cb(ev->status, ev->num_packets);
 }
 
+static void handle_energy_info(void *buf, uint16_t len, int fd)
+{
+	struct hal_ev_energy_info *ev = buf;
+	bt_activity_energy_info info;
+
+	DBG("");
+
+	info.ctrl_state = ev->ctrl_state;
+	info.energy_used = ev->energy_used;
+	info.idle_time = ev->idle_time;
+	info.rx_time = ev->rx_time;
+	info.status = ev->status;
+	info.tx_time = ev->status;
+
+	if (bt_hal_cbacks->energy_info_cb)
+		bt_hal_cbacks->energy_info_cb(&info);
+}
+
 /*
  * handlers will be called from notification thread context,
  * index in table equals to 'opcode - HAL_MINIMUM_EVENT'
@@ -387,6 +405,8 @@ static const struct hal_ipc_handler ev_handlers[] = {
 				sizeof(struct hal_ev_dut_mode_receive) },
 	/* HAL_EV_LE_TEST_MODE */
 	{ handle_le_test_mode, false, sizeof(struct hal_ev_le_test_mode) },
+	/* HAL_EV_ENERGY_INFO */
+	{ handle_energy_info, false, sizeof(struct hal_ev_energy_info) },
 };
 
 static uint8_t get_mode(void)
@@ -998,9 +1018,11 @@ static int read_energy_info(void)
 {
 	DBG("");
 
-	/* TODO: implement */
+	if (!interface_ready())
+		return BT_STATUS_NOT_READY;
 
-	return BT_STATUS_UNSUPPORTED;
+	return hal_ipc_cmd(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_READ_ENERGY_INFO, 0,
+							NULL, NULL, NULL, NULL);
 }
 #endif
 
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 6a5a81c..9baa2d9 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -261,6 +261,8 @@ struct hal_rsp_get_connection_state {
 	int32_t connection_state;
 } __attribute__((packed));
 
+#define HAL_OP_READ_ENERGY_INFO		0x16
+
 /* Bluetooth Socket HAL api */
 
 #define HAL_SOCK_RFCOMM		0x01
@@ -1348,6 +1350,16 @@ struct hal_ev_le_test_mode {
 	uint16_t num_packets;
 } __attribute__((packed));
 
+#define HAL_EV_ENERGY_INFO		0x8c
+struct hal_ev_energy_info {
+	uint8_t status;
+	uint8_t ctrl_state;
+	uint64_t tx_time;
+	uint64_t rx_time;
+	uint64_t idle_time;
+	uint64_t energy_used;
+} __attribute__((packed));
+
 #define HAL_HIDHOST_STATE_CONNECTED		0x00
 #define HAL_HIDHOST_STATE_CONNECTING	0x01
 #define HAL_HIDHOST_STATE_DISCONNECTED	0x02
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] android/client: Add read_energy_info command
  2014-11-21 11:16 [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state Marcin Kraglak
  2014-11-21 11:16 ` [PATCH 2/6] android/hal-bluetooth: Implement set_os_callouts Marcin Kraglak
  2014-11-21 11:16 ` [PATCH 3/6] android/hal-bluetooth: Implement read_energy_info Marcin Kraglak
@ 2014-11-21 11:16 ` Marcin Kraglak
  2014-11-21 11:16 ` [PATCH 5/6] android/client: Print data from energy_info_cb Marcin Kraglak
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Marcin Kraglak @ 2014-11-21 11:16 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/client/if-bt.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 2b9c455..f74a56a 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -397,6 +397,14 @@ static void enable_p(int argc, const char **argv)
 
 	EXEC(if_bluetooth->enable);
 }
+#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
+static void read_energy_info_p(int argc, const char **argv)
+{
+	RETURN_IF_NULL(if_bluetooth);
+
+	EXEC(if_bluetooth->read_energy_info);
+}
+#endif
 
 static void disable_p(int argc, const char **argv)
 {
@@ -878,6 +886,7 @@ static struct method methods[] = {
 	STD_METHOD(cancel_discovery),
 #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
 	STD_METHODCH(create_bond, "<addr> [<transport>]"),
+	STD_METHOD(read_energy_info),
 #else
 	STD_METHODCH(create_bond, "<addr>"),
 #endif
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] android/client: Print data from energy_info_cb
  2014-11-21 11:16 [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state Marcin Kraglak
                   ` (2 preceding siblings ...)
  2014-11-21 11:16 ` [PATCH 4/6] android/client: Add read_energy_info command Marcin Kraglak
@ 2014-11-21 11:16 ` Marcin Kraglak
  2014-11-21 11:16 ` [PATCH 6/6] android/client: Add get_connection_state command Marcin Kraglak
  2014-11-24 14:36 ` [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state Szymon Janc
  5 siblings, 0 replies; 7+ messages in thread
From: Marcin Kraglak @ 2014-11-21 11:16 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/client/if-bt.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index f74a56a..4648f99 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -331,7 +331,12 @@ static void le_test_mode_cb(bt_status_t status, uint16_t num_packets)
 #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
 static void energy_info_cb(bt_activity_energy_info *energy_info)
 {
-	haltest_info("%s\n", __func__);
+	haltest_info("%s status=%s\n, ctrl_state=0x%02X, tx_time=0x%jx,"
+			"rx_time=0x%jx, idle_time=0x%jx, energu_used=0x%jx\n",
+			__func__, bt_status_t2str(energy_info->status),
+			energy_info->ctrl_state, energy_info->tx_time,
+			energy_info->rx_time, energy_info->idle_time,
+			energy_info->energy_used);
 }
 #endif
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] android/client: Add get_connection_state command
  2014-11-21 11:16 [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state Marcin Kraglak
                   ` (3 preceding siblings ...)
  2014-11-21 11:16 ` [PATCH 5/6] android/client: Print data from energy_info_cb Marcin Kraglak
@ 2014-11-21 11:16 ` Marcin Kraglak
  2014-11-24 14:36 ` [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state Szymon Janc
  5 siblings, 0 replies; 7+ messages in thread
From: Marcin Kraglak @ 2014-11-21 11:16 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/client/if-bt.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/android/client/if-bt.c b/android/client/if-bt.c
index 4648f99..b518177 100644
--- a/android/client/if-bt.c
+++ b/android/client/if-bt.c
@@ -409,6 +409,20 @@ static void read_energy_info_p(int argc, const char **argv)
 
 	EXEC(if_bluetooth->read_energy_info);
 }
+
+#define get_connection_state_c complete_addr_c
+
+static void get_connection_state_p(int argc, const char **argv)
+{
+	bt_bdaddr_t addr;
+
+	RETURN_IF_NULL(if_bluetooth);
+
+	VERIFY_ADDR_ARG(2, &addr);
+
+	haltest_info("if_bluetooth->get_connection_state : %d\n",
+				if_bluetooth->get_connection_state(&addr));
+}
 #endif
 
 static void disable_p(int argc, const char **argv)
@@ -892,6 +906,7 @@ static struct method methods[] = {
 #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
 	STD_METHODCH(create_bond, "<addr> [<transport>]"),
 	STD_METHOD(read_energy_info),
+	STD_METHODCH(get_connection_state, "<addr>"),
 #else
 	STD_METHODCH(create_bond, "<addr>"),
 #endif
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state
  2014-11-21 11:16 [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state Marcin Kraglak
                   ` (4 preceding siblings ...)
  2014-11-21 11:16 ` [PATCH 6/6] android/client: Add get_connection_state command Marcin Kraglak
@ 2014-11-24 14:36 ` Szymon Janc
  5 siblings, 0 replies; 7+ messages in thread
From: Szymon Janc @ 2014-11-24 14:36 UTC (permalink / raw)
  To: Marcin Kraglak; +Cc: linux-bluetooth

Hi Marcin,

On Friday 21 of November 2014 12:16:38 Marcin Kraglak wrote:
> ---
>  android/bluetooth.c     | 24 ++++++++++++++++++++++++
>  android/hal-bluetooth.c | 19 +++++++++++++++++--
>  android/hal-msg.h       |  9 +++++++++
>  3 files changed, 50 insertions(+), 2 deletions(-)
> 
> diff --git a/android/bluetooth.c b/android/bluetooth.c
> index da549d7..947a83c 100644
> --- a/android/bluetooth.c
> +++ b/android/bluetooth.c
> @@ -5134,6 +5134,27 @@ static void handle_le_test_mode_cmd(const void *buf, uint16_t len)
>  							HAL_STATUS_FAILED);
>  }
>  
> +static void handle_get_connection_state(const void *buf, uint16_t len)
> +{
> +	const struct hal_cmd_get_connection_state *cmd = buf;
> +	struct hal_rsp_get_connection_state rsp;
> +	char address[18];
> +	bdaddr_t bdaddr;
> +
> +	android2bdaddr(cmd->bdaddr, &bdaddr);
> +	ba2str(&bdaddr, address);
> +
> +	DBG("%s", address);
> +
> +	/* TODO */
> +
> +	rsp.connection_state = 0;
> +
> +	ipc_send_rsp_full(hal_ipc, HAL_SERVICE_ID_BLUETOOTH,
> +				HAL_OP_GET_CONNECTION_STATE, sizeof(rsp), &rsp,
> +				-1);
> +}
> +
>  static const struct ipc_handler cmd_handlers[] = {
>  	/* HAL_OP_ENABLE */
>  	{ handle_enable_cmd, false, 0 },
> @@ -5184,6 +5205,9 @@ static const struct ipc_handler cmd_handlers[] = {
>  					sizeof(struct hal_cmd_dut_mode_send) },
>  	/* HAL_OP_LE_TEST_MODE */
>  	{ handle_le_test_mode_cmd, true, sizeof(struct hal_cmd_le_test_mode) },
> +	/* HAL_OP_GET_CONNECTION_STATE */
> +	{ handle_get_connection_state, false,
> +				sizeof(struct hal_cmd_get_connection_state) },
>  };
>  
>  bool bt_bluetooth_register(struct ipc *ipc, uint8_t mode)
> diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
> index 68811df..defaef1 100644
> --- a/android/hal-bluetooth.c
> +++ b/android/hal-bluetooth.c
> @@ -957,11 +957,26 @@ static int config_hci_snoop_log(uint8_t enable)
>  #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
>  static int get_connection_state(const bt_bdaddr_t *bd_addr)
>  {
> +	struct hal_cmd_get_connection_state cmd;
> +	struct hal_rsp_get_connection_state rsp;
> +	size_t rsp_len = sizeof(rsp);
> +	bt_status_t status;
> +
>  	DBG("bdaddr: %s", bdaddr2str(bd_addr));
>  
> -	/* TODO: implement */
> +	if (!interface_ready())
> +		return 0;
>  
> -	return BT_STATUS_UNSUPPORTED;
> +	memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr));
> +
> +	status = hal_ipc_cmd(HAL_SERVICE_ID_BLUETOOTH,
> +			HAL_OP_GET_CONNECTION_STATE, sizeof(cmd), &cmd,
> +			&rsp_len, &rsp, NULL);
> +
> +	if (status != BT_STATUS_SUCCESS)
> +		return 0;
> +
> +	return rsp.connection_state;
>  }
>  
>  static int set_os_callouts(bt_os_callouts_t *callouts)
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index ca512d4..6a5a81c 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -252,6 +252,15 @@ struct hal_cmd_le_test_mode {
>  	uint8_t  data[0];
>  } __attribute__((packed));
>  
> +#define HAL_OP_GET_CONNECTION_STATE	0x15
> +struct hal_cmd_get_connection_state {
> +	uint8_t  bdaddr[6];
> +} __attribute__((packed));
> +
> +struct hal_rsp_get_connection_state {
> +	int32_t connection_state;
> +} __attribute__((packed));
> +
>  /* Bluetooth Socket HAL api */
>  
>  #define HAL_SOCK_RFCOMM		0x01

Patches 1 and 3-6 are now applied (after fixing build issues on Android KK).
Thanks.

But please send follow-up patch that updates android/hal-ipc-api.txt.
 

-- 
Best regards, 
Szymon Janc

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-11-24 14:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-21 11:16 [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state Marcin Kraglak
2014-11-21 11:16 ` [PATCH 2/6] android/hal-bluetooth: Implement set_os_callouts Marcin Kraglak
2014-11-21 11:16 ` [PATCH 3/6] android/hal-bluetooth: Implement read_energy_info Marcin Kraglak
2014-11-21 11:16 ` [PATCH 4/6] android/client: Add read_energy_info command Marcin Kraglak
2014-11-21 11:16 ` [PATCH 5/6] android/client: Print data from energy_info_cb Marcin Kraglak
2014-11-21 11:16 ` [PATCH 6/6] android/client: Add get_connection_state command Marcin Kraglak
2014-11-24 14:36 ` [PATCH 1/6] android/hal-bluetooth: Implement get_connection_state Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox