From 97d492f2393ba7b599c5597dd9a4b1b46ddc9e5b Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 29 May 2013 10:56:41 +0300 Subject: [PATCH] emulator: Return used L2CAP ident value from bthost_l2cap_cmd() --- emulator/bthost.c | 6 ++++-- emulator/bthost.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/emulator/bthost.c b/emulator/bthost.c index 221ab8e95..5e3592be6 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -257,7 +257,7 @@ static void send_acl(struct bthost *bthost, uint16_t handle, uint16_t cid, free(pkt_data); } -void bthost_l2cap_cmd(struct bthost *bthost, uint16_t handle, uint8_t code, +uint8_t bthost_l2cap_cmd(struct bthost *bthost, uint16_t handle, uint8_t code, uint8_t ident, const void *data, uint16_t len) { static uint8_t next_ident = 1; @@ -269,7 +269,7 @@ void bthost_l2cap_cmd(struct bthost *bthost, uint16_t handle, uint8_t code, pkt_data = malloc(pkt_len); if (!pkt_data) - return; + return 0; if (!ident) { ident = next_ident++; @@ -288,6 +288,8 @@ void bthost_l2cap_cmd(struct bthost *bthost, uint16_t handle, uint8_t code, send_acl(bthost, handle, 0x0001, pkt_data, pkt_len); free(pkt_data); + + return ident; } static void send_command(struct bthost *bthost, uint16_t opcode, diff --git a/emulator/bthost.h b/emulator/bthost.h index 5a75d9ecf..777dfb4f8 100644 --- a/emulator/bthost.h +++ b/emulator/bthost.h @@ -51,7 +51,7 @@ void bthost_set_connect_cb(struct bthost *bthost, bthost_new_conn_cb cb, void bthost_hci_connect(struct bthost *bthost, const uint8_t *bdaddr); -void bthost_l2cap_cmd(struct bthost *bthost, uint16_t handle, uint8_t code, +uint8_t bthost_l2cap_cmd(struct bthost *bthost, uint16_t handle, uint8_t code, uint8_t ident, const void *data, uint16_t len); void bthost_write_scan_enable(struct bthost *bthost, uint8_t scan); -- 2.47.3