summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2019-10-09 13:29:07 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-02-03 13:26:40 -0800
commit382f004f31256f0789d7508f2dfe647f5cb3288d (patch)
tree5ce957fb7f7019d6a026f1d3232fb6e9dfcb4ebc
parentfc1e36b3005eae8c7461bcfddd18c8e9e7dc2609 (diff)
downloadbluez-382f004f31256f0789d7508f2dfe647f5cb3288d.tar.gz
tools/btproxy: Add support for ISO packets
This enables proxing ISO packets.
-rw-r--r--tools/btproxy.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/btproxy.c b/tools/btproxy.c
index fb67a5735..a98bbb73f 100644
--- a/tools/btproxy.c
+++ b/tools/btproxy.c
@@ -73,14 +73,14 @@ static void hexdump_print(const char *str, void *user_data)
}
struct proxy {
- /* Receive commands, ACL and SCO data */
+ /* Receive commands, ACL, SCO and ISO data */
int host_fd;
uint8_t host_buf[4096];
uint16_t host_len;
bool host_shutdown;
bool host_skip_first_zero;
- /* Receive events, ACL and SCO data */
+ /* Receive events, ACL, SCO and ISO data */
int dev_fd;
uint8_t dev_buf[4096];
uint16_t dev_len;
@@ -296,6 +296,7 @@ static void host_read_callback(int fd, uint32_t events, void *user_data)
struct bt_hci_cmd_hdr *cmd_hdr;
struct bt_hci_acl_hdr *acl_hdr;
struct bt_hci_sco_hdr *sco_hdr;
+ struct bt_hci_iso_hdr *iso_hdr;
ssize_t len;
uint16_t pktlen;
@@ -364,6 +365,13 @@ process_packet:
sco_hdr = (void *) (proxy->host_buf + 1);
pktlen = 1 + sizeof(*sco_hdr) + sco_hdr->dlen;
break;
+ case BT_H4_ISO_PKT:
+ if (proxy->host_len < 1 + sizeof(*iso_hdr))
+ return;
+
+ iso_hdr = (void *) (proxy->host_buf + 1);
+ pktlen = 1 + sizeof(*iso_hdr) + cpu_to_le16(iso_hdr->dlen);
+ break;
case 0xff:
/* Notification packet from /dev/vhci - ignore */
proxy->host_len = 0;
@@ -418,6 +426,7 @@ static void dev_read_callback(int fd, uint32_t events, void *user_data)
struct bt_hci_evt_hdr *evt_hdr;
struct bt_hci_acl_hdr *acl_hdr;
struct bt_hci_sco_hdr *sco_hdr;
+ struct bt_hci_iso_hdr *iso_hdr;
ssize_t len;
uint16_t pktlen;
@@ -476,6 +485,13 @@ process_packet:
sco_hdr = (void *) (proxy->dev_buf + 1);
pktlen = 1 + sizeof(*sco_hdr) + sco_hdr->dlen;
break;
+ case BT_H4_ISO_PKT:
+ if (proxy->dev_len < 1 + sizeof(*iso_hdr))
+ return;
+
+ iso_hdr = (void *) (proxy->dev_buf + 1);
+ pktlen = 1 + sizeof(*iso_hdr) + cpu_to_le16(iso_hdr->dlen);
+ break;
default:
fprintf(stderr, "Received unknown device packet type 0x%02x\n",
proxy->dev_buf[0]);