From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 6/6] tools/btproxy: Add support for ISO packets
Date: Tue, 28 Jan 2020 12:13:35 -0800 [thread overview]
Message-ID: <20200128201335.6165-6-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20200128201335.6165-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This enables proxing ISO packets.
---
tools/btproxy.c | 20 ++++++++++++++++++--
1 file 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]);
--
2.21.0
next prev parent reply other threads:[~2020-01-28 20:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-28 20:13 [PATCH BlueZ 1/6] monitor: Add support for decoding ISO related commands Luiz Augusto von Dentz
2020-01-28 20:13 ` [PATCH BlueZ 2/6] monitor: Add decoding of ISO related Link Layer PDUs Luiz Augusto von Dentz
2020-01-28 20:13 ` [PATCH BlueZ 3/6] monitor: Add support for ISO packets Luiz Augusto von Dentz
2020-01-28 20:13 ` [PATCH BlueZ 4/6] monitor: Add decoding for L2CAP Enhanced Credit Based PDUs Luiz Augusto von Dentz
2020-01-28 20:13 ` [PATCH BlueZ 5/6] emulator: Add initial support for BT 5.2 Luiz Augusto von Dentz
2020-01-28 20:13 ` Luiz Augusto von Dentz [this message]
2020-02-03 21:30 ` [PATCH BlueZ 1/6] monitor: Add support for decoding ISO related commands Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200128201335.6165-6-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).