* [PATCH 1/2] android/tester: Add missing break @ 2013-12-16 14:52 Andrei Emeltchenko 2013-12-16 14:52 ` [PATCH 2/2] android/tester: Enable bthost after device is enabled Andrei Emeltchenko 2013-12-17 7:51 ` [PATCH 1/2] android/tester: Add missing break Johan Hedberg 0 siblings, 2 replies; 6+ messages in thread From: Andrei Emeltchenko @ 2013-12-16 14:52 UTC (permalink / raw) To: linux-bluetooth From: Andrei Emeltchenko <andrei.emeltchenko@intel.com> --- android/android-tester.c | 1 + 1 file changed, 1 insertion(+) diff --git a/android/android-tester.c b/android/android-tester.c index eb938d0..2a8c8d0 100644 --- a/android/android-tester.c +++ b/android/android-tester.c @@ -487,6 +487,7 @@ static void adapter_state_changed_cb(bt_state_t state) tester_setup_complete(); else tester_setup_failed(); + break; default: break; } -- 1.8.3.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] android/tester: Enable bthost after device is enabled 2013-12-16 14:52 [PATCH 1/2] android/tester: Add missing break Andrei Emeltchenko @ 2013-12-16 14:52 ` Andrei Emeltchenko 2013-12-17 7:50 ` Johan Hedberg 2013-12-17 7:51 ` [PATCH 1/2] android/tester: Add missing break Johan Hedberg 1 sibling, 1 reply; 6+ messages in thread From: Andrei Emeltchenko @ 2013-12-16 14:52 UTC (permalink / raw) To: linux-bluetooth From: Andrei Emeltchenko <andrei.emeltchenko@intel.com> This puts bthost to connectible mode allowing us to use powered setup for connect to emulated device. --- android/android-tester.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/android/android-tester.c b/android/android-tester.c index 2a8c8d0..d0d3690 100644 --- a/android/android-tester.c +++ b/android/android-tester.c @@ -33,10 +33,15 @@ #include "src/shared/mgmt.h" #include "src/shared/hciemu.h" +#include "emulator/bthost.h" +#include "monitor/bt.h" + #include <hardware/hardware.h> #include <hardware/bluetooth.h> #include <hardware/bt_sock.h> +#include "utils.h" + #define adapter_props adapter_prop_bdaddr, adapter_prop_bdname, \ adapter_prop_uuids, adapter_prop_cod, \ adapter_prop_type, adapter_prop_scan_mode, \ @@ -463,6 +468,42 @@ failed: close(fd); } +static void client_connectable_complete(uint16_t opcode, uint8_t status, + const void *param, uint8_t len, + void *user_data) +{ + switch (opcode) { + case BT_HCI_CMD_WRITE_SCAN_ENABLE: + case BT_HCI_CMD_LE_SET_ADV_ENABLE: + break; + default: + return; + } + + tester_print("Client set connectable status 0x%02x", status); + + if (status) + tester_setup_failed(); + else + tester_setup_complete(); +} + +static void setup_powered_client(void) +{ + struct test_data *data = tester_get_data(); + struct bthost *bthost; + + tester_print("Controller powered on"); + + bthost = hciemu_client_get_host(data->hciemu); + bthost_set_cmd_complete_cb(bthost, client_connectable_complete, data); + + if (data->hciemu_type == HCIEMU_TYPE_LE) + bthost_set_adv_enable(bthost, 0x01); + else + bthost_write_scan_enable(bthost, 0x03); +} + static void adapter_state_changed_cb(bt_state_t state) { enum hal_bluetooth_callbacks_id hal_cb; @@ -484,7 +525,7 @@ static void adapter_state_changed_cb(bt_state_t state) break; case adapter_test_setup_mode: if (state == BT_STATE_ON) - tester_setup_complete(); + setup_powered_client(); else tester_setup_failed(); break; -- 1.8.3.2 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] android/tester: Enable bthost after device is enabled 2013-12-16 14:52 ` [PATCH 2/2] android/tester: Enable bthost after device is enabled Andrei Emeltchenko @ 2013-12-17 7:50 ` Johan Hedberg 2013-12-17 8:04 ` Andrei Emeltchenko 0 siblings, 1 reply; 6+ messages in thread From: Johan Hedberg @ 2013-12-17 7:50 UTC (permalink / raw) To: Andrei Emeltchenko; +Cc: linux-bluetooth Hi Andrei, On Mon, Dec 16, 2013, Andrei Emeltchenko wrote: > +static void client_connectable_complete(uint16_t opcode, uint8_t status, > + const void *param, uint8_t len, > + void *user_data) > +{ > + switch (opcode) { > + case BT_HCI_CMD_WRITE_SCAN_ENABLE: > + case BT_HCI_CMD_LE_SET_ADV_ENABLE: > + break; > + default: > + return; > + } > + > + tester_print("Client set connectable status 0x%02x", status); > + > + if (status) > + tester_setup_failed(); > + else > + tester_setup_complete(); > +} > + > +static void setup_powered_client(void) > +{ > + struct test_data *data = tester_get_data(); > + struct bthost *bthost; > + > + tester_print("Controller powered on"); > + > + bthost = hciemu_client_get_host(data->hciemu); > + bthost_set_cmd_complete_cb(bthost, client_connectable_complete, data); > + > + if (data->hciemu_type == HCIEMU_TYPE_LE) > + bthost_set_adv_enable(bthost, 0x01); > + else > + bthost_write_scan_enable(bthost, 0x03); > +} > + > static void adapter_state_changed_cb(bt_state_t state) > { > enum hal_bluetooth_callbacks_id hal_cb; > @@ -484,7 +525,7 @@ static void adapter_state_changed_cb(bt_state_t state) > break; > case adapter_test_setup_mode: > if (state == BT_STATE_ON) > - tester_setup_complete(); > + setup_powered_client(); > else > tester_setup_failed(); > break; You seem to have copied this from l2cap-tester without understanding why the naming of these functions are as they are. The "client" in the names are for testing client sockets (as opposed to server ones). However, you're calling these for every test case, including the server tests (the ones with _listen in them), which doesn't seem right. If you're the server you don't need to make the bthost side connectable. Johan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] android/tester: Enable bthost after device is enabled 2013-12-17 7:50 ` Johan Hedberg @ 2013-12-17 8:04 ` Andrei Emeltchenko 2013-12-17 8:20 ` Johan Hedberg 0 siblings, 1 reply; 6+ messages in thread From: Andrei Emeltchenko @ 2013-12-17 8:04 UTC (permalink / raw) To: linux-bluetooth Hi Johan, On Tue, Dec 17, 2013 at 09:50:57AM +0200, Johan Hedberg wrote: > Hi Andrei, > > On Mon, Dec 16, 2013, Andrei Emeltchenko wrote: > > +static void client_connectable_complete(uint16_t opcode, uint8_t status, > > + const void *param, uint8_t len, > > + void *user_data) > > +{ > > + switch (opcode) { > > + case BT_HCI_CMD_WRITE_SCAN_ENABLE: > > + case BT_HCI_CMD_LE_SET_ADV_ENABLE: > > + break; > > + default: > > + return; > > + } > > + > > + tester_print("Client set connectable status 0x%02x", status); > > + > > + if (status) > > + tester_setup_failed(); > > + else > > + tester_setup_complete(); > > +} > > + > > +static void setup_powered_client(void) > > +{ > > + struct test_data *data = tester_get_data(); > > + struct bthost *bthost; > > + > > + tester_print("Controller powered on"); > > + > > + bthost = hciemu_client_get_host(data->hciemu); > > + bthost_set_cmd_complete_cb(bthost, client_connectable_complete, data); > > + > > + if (data->hciemu_type == HCIEMU_TYPE_LE) > > + bthost_set_adv_enable(bthost, 0x01); > > + else > > + bthost_write_scan_enable(bthost, 0x03); > > +} > > + > > static void adapter_state_changed_cb(bt_state_t state) > > { > > enum hal_bluetooth_callbacks_id hal_cb; > > @@ -484,7 +525,7 @@ static void adapter_state_changed_cb(bt_state_t state) > > break; > > case adapter_test_setup_mode: > > if (state == BT_STATE_ON) > > - tester_setup_complete(); > > + setup_powered_client(); > > else > > tester_setup_failed(); > > break; > > You seem to have copied this from l2cap-tester without understanding why > the naming of these functions are as they are. The "client" in the names > are for testing client sockets (as opposed to server ones). However, > you're calling these for every test case, including the server tests > (the ones with _listen in them), which doesn't seem right. If you're the > server you don't need to make the bthost side connectable. So what is appropriate way of setting emulated remote device connectible? This actually does not hurt in every case. Best regards Andrei Emeltchenko ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] android/tester: Enable bthost after device is enabled 2013-12-17 8:04 ` Andrei Emeltchenko @ 2013-12-17 8:20 ` Johan Hedberg 0 siblings, 0 replies; 6+ messages in thread From: Johan Hedberg @ 2013-12-17 8:20 UTC (permalink / raw) To: Andrei Emeltchenko, linux-bluetooth Hi Andrei, On Tue, Dec 17, 2013, Andrei Emeltchenko wrote: > On Tue, Dec 17, 2013 at 09:50:57AM +0200, Johan Hedberg wrote: > > Hi Andrei, > > > > On Mon, Dec 16, 2013, Andrei Emeltchenko wrote: > > > +static void client_connectable_complete(uint16_t opcode, uint8_t status, > > > + const void *param, uint8_t len, > > > + void *user_data) > > > +{ > > > + switch (opcode) { > > > + case BT_HCI_CMD_WRITE_SCAN_ENABLE: > > > + case BT_HCI_CMD_LE_SET_ADV_ENABLE: > > > + break; > > > + default: > > > + return; > > > + } > > > + > > > + tester_print("Client set connectable status 0x%02x", status); > > > + > > > + if (status) > > > + tester_setup_failed(); > > > + else > > > + tester_setup_complete(); > > > +} > > > + > > > +static void setup_powered_client(void) > > > +{ > > > + struct test_data *data = tester_get_data(); > > > + struct bthost *bthost; > > > + > > > + tester_print("Controller powered on"); > > > + > > > + bthost = hciemu_client_get_host(data->hciemu); > > > + bthost_set_cmd_complete_cb(bthost, client_connectable_complete, data); > > > + > > > + if (data->hciemu_type == HCIEMU_TYPE_LE) > > > + bthost_set_adv_enable(bthost, 0x01); > > > + else > > > + bthost_write_scan_enable(bthost, 0x03); > > > +} > > > + > > > static void adapter_state_changed_cb(bt_state_t state) > > > { > > > enum hal_bluetooth_callbacks_id hal_cb; > > > @@ -484,7 +525,7 @@ static void adapter_state_changed_cb(bt_state_t state) > > > break; > > > case adapter_test_setup_mode: > > > if (state == BT_STATE_ON) > > > - tester_setup_complete(); > > > + setup_powered_client(); > > > else > > > tester_setup_failed(); > > > break; > > > > You seem to have copied this from l2cap-tester without understanding why > > the naming of these functions are as they are. The "client" in the names > > are for testing client sockets (as opposed to server ones). However, > > you're calling these for every test case, including the server tests > > (the ones with _listen in them), which doesn't seem right. If you're the > > server you don't need to make the bthost side connectable. > > So what is appropriate way of setting emulated remote device connectible? > This actually does not hurt in every case. The you shouldn't at least have "client" in the naming since this is in no way client-side specific. Johan ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] android/tester: Add missing break 2013-12-16 14:52 [PATCH 1/2] android/tester: Add missing break Andrei Emeltchenko 2013-12-16 14:52 ` [PATCH 2/2] android/tester: Enable bthost after device is enabled Andrei Emeltchenko @ 2013-12-17 7:51 ` Johan Hedberg 1 sibling, 0 replies; 6+ messages in thread From: Johan Hedberg @ 2013-12-17 7:51 UTC (permalink / raw) To: Andrei Emeltchenko; +Cc: linux-bluetooth Hi Andrei, On Mon, Dec 16, 2013, Andrei Emeltchenko wrote: > --- > android/android-tester.c | 1 + > 1 file changed, 1 insertion(+) This patch has been applied. Thanks. Johan ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-12-17 8:20 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-12-16 14:52 [PATCH 1/2] android/tester: Add missing break Andrei Emeltchenko 2013-12-16 14:52 ` [PATCH 2/2] android/tester: Enable bthost after device is enabled Andrei Emeltchenko 2013-12-17 7:50 ` Johan Hedberg 2013-12-17 8:04 ` Andrei Emeltchenko 2013-12-17 8:20 ` Johan Hedberg 2013-12-17 7:51 ` [PATCH 1/2] android/tester: Add missing break Johan Hedberg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox