Bluetooth: tester: Fix supported commands to use uint8_t array

Fixes endianess issues.

Change-Id: I9c308187d34a832cc875c9037235cedc8bee033c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
This commit is contained in:
Mariusz Skamra 2016-02-24 15:45:08 +01:00
parent 0abe6e85ba
commit c76bd33d61
2 changed files with 26 additions and 20 deletions

View file

@ -43,9 +43,11 @@ static void supported_commands(uint8_t *data, uint16_t len)
uint8_t buf[1];
struct core_read_supported_commands_rp *rp = (void *) buf;
buf[0] = BIT(CORE_READ_SUPPORTED_COMMANDS);
buf[0] |= BIT(CORE_READ_SUPPORTED_SERVICES);
buf[0] |= BIT(CORE_REGISTER_SERVICE);
memset(buf, 0, sizeof(buf));
tester_set_bit(buf, CORE_READ_SUPPORTED_COMMANDS);
tester_set_bit(buf, CORE_READ_SUPPORTED_SERVICES);
tester_set_bit(buf, CORE_REGISTER_SERVICE);
tester_send(BTP_SERVICE_ID_CORE, CORE_READ_SUPPORTED_COMMANDS,
BTP_INDEX_NONE, (uint8_t *) rp, sizeof(buf));
@ -56,9 +58,11 @@ static void supported_services(uint8_t *data, uint16_t len)
uint8_t buf[1];
struct core_read_supported_services_rp *rp = (void *) buf;
buf[0] = BIT(BTP_SERVICE_ID_CORE);
buf[0] |= BIT(BTP_SERVICE_ID_GAP);
buf[0] |= BIT(BTP_SERVICE_ID_GATT);
memset(buf, 0, sizeof(buf));
tester_set_bit(buf, BTP_SERVICE_ID_CORE);
tester_set_bit(buf, BTP_SERVICE_ID_GAP);
tester_set_bit(buf, BTP_SERVICE_ID_GATT);
tester_send(BTP_SERVICE_ID_CORE, CORE_READ_SUPPORTED_SERVICES,
BTP_INDEX_NONE, (uint8_t *) rp, sizeof(buf));

View file

@ -72,22 +72,24 @@ static struct bt_conn_cb conn_callbacks = {
static void supported_commands(uint8_t *data, uint16_t len)
{
uint16_t cmds;
uint8_t cmds[3];
struct gap_read_supported_commands_rp *rp = (void *) &cmds;
cmds = BIT(GAP_READ_SUPPORTED_COMMANDS);
cmds |= BIT(GAP_READ_CONTROLLER_INDEX_LIST);
cmds |= BIT(GAP_READ_CONTROLLER_INFO);
cmds |= BIT(GAP_SET_CONNECTABLE);
cmds |= BIT(GAP_SET_DISCOVERABLE);
cmds |= BIT(GAP_START_ADVERTISING);
cmds |= BIT(GAP_STOP_ADVERTISING);
cmds |= BIT(GAP_START_DISCOVERY);
cmds |= BIT(GAP_STOP_DISCOVERY);
cmds |= BIT(GAP_DISCONNECT);
cmds |= BIT(GAP_SET_IO_CAP);
cmds |= BIT(GAP_PAIR);
cmds |= BIT(GAP_PASSKEY_ENTRY);
memset(cmds, 0, sizeof(cmds));
tester_set_bit(cmds, GAP_READ_SUPPORTED_COMMANDS);
tester_set_bit(cmds, GAP_READ_CONTROLLER_INDEX_LIST);
tester_set_bit(cmds, GAP_READ_CONTROLLER_INFO);
tester_set_bit(cmds, GAP_SET_CONNECTABLE);
tester_set_bit(cmds, GAP_SET_DISCOVERABLE);
tester_set_bit(cmds, GAP_START_ADVERTISING);
tester_set_bit(cmds, GAP_STOP_ADVERTISING);
tester_set_bit(cmds, GAP_START_DISCOVERY);
tester_set_bit(cmds, GAP_STOP_DISCOVERY);
tester_set_bit(cmds, GAP_DISCONNECT);
tester_set_bit(cmds, GAP_SET_IO_CAP);
tester_set_bit(cmds, GAP_PAIR);
tester_set_bit(cmds, GAP_PASSKEY_ENTRY);
tester_send(BTP_SERVICE_ID_GAP, GAP_READ_SUPPORTED_COMMANDS,
CONTROLLER_INDEX, (uint8_t *) rp, sizeof(cmds));