Diff between 870fdb247dc64ebfc970f127b8f77f449976e7e4 and 97d492f2393ba7b599c5597dd9a4b1b46ddc9e5b

Changed Files

File Additions Deletions Status
emulator/bthost.c +4 -2 modified
emulator/bthost.h +1 -1 modified

Full Patch

diff --git a/emulator/bthost.c b/emulator/bthost.c
index 221ab8e..5e3592b 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 5a75d9e..777dfb4 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);