Message ID | 1b2a8e408573624a7b5e5e792c7e89c8315811e3.1741190102.git.pav@iki.fi (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [BlueZ,1/3] btdev: pass sent SCO data to bthost | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/BuildEll | success | Build ELL PASS |
tedd_an/BluezMake | success | Bluez Make PASS |
tedd_an/MakeCheck | success | Bluez Make Check PASS |
tedd_an/MakeDistcheck | success | Make Distcheck PASS |
tedd_an/CheckValgrind | success | Check Valgrind PASS |
tedd_an/CheckSmatch | warning | CheckSparse WARNING emulator/btdev.c:450:29: warning: Variable length array is used.emulator/bthost.c:628:28: warning: Variable length array is used.emulator/bthost.c:826:28: warning: Variable length array is used.tools/sco-tester.c: note: in included file:./lib/bluetooth.h:232:15: warning: array of flexible structures./lib/bluetooth.h:237:31: warning: array of flexible structures |
tedd_an/bluezmakeextell | success | Make External ELL PASS |
tedd_an/ScanBuild | success | Scan Build PASS |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=940626 ---Test result--- Test Summary: CheckPatch PENDING 0.28 seconds GitLint PENDING 0.22 seconds BuildEll PASS 20.47 seconds BluezMake PASS 1583.23 seconds MakeCheck PASS 14.16 seconds MakeDistcheck PASS 162.66 seconds CheckValgrind PASS 219.55 seconds CheckSmatch WARNING 287.84 seconds bluezmakeextell PASS 99.66 seconds IncrementalBuild PENDING 0.29 seconds ScanBuild PASS 875.85 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: CheckSmatch - WARNING Desc: Run smatch tool with source Output: emulator/btdev.c:450:29: warning: Variable length array is used.emulator/bthost.c:628:28: warning: Variable length array is used.emulator/bthost.c:826:28: warning: Variable length array is used.tools/sco-tester.c: note: in included file:./lib/bluetooth.h:232:15: warning: array of flexible structures./lib/bluetooth.h:237:31: warning: array of flexible structures ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: --- Regards, Linux Bluetooth
Hi Pauli, On Wed, Mar 5, 2025 at 10:58 AM Pauli Virtanen <pav@iki.fi> wrote: > > Actually send SCO data to the linked connection, if any. > --- > emulator/btdev.c | 38 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/emulator/btdev.c b/emulator/btdev.c > index ec52c5242..c44b52c49 100644 > --- a/emulator/btdev.c > +++ b/emulator/btdev.c > @@ -2807,6 +2807,10 @@ static int cmd_enhanced_setup_sync_conn_complete(struct btdev *dev, > done: > send_event(dev, BT_HCI_EVT_SYNC_CONN_COMPLETE, &cc, sizeof(cc)); > > + if (conn) > + send_event(conn->link->dev, BT_HCI_EVT_SYNC_CONN_COMPLETE, > + &cc, sizeof(cc)); > + > return 0; > } > > @@ -2853,6 +2857,10 @@ static int cmd_setup_sync_conn_complete(struct btdev *dev, const void *data, > done: > send_event(dev, BT_HCI_EVT_SYNC_CONN_COMPLETE, &cc, sizeof(cc)); > > + if (conn) > + send_event(conn->link->dev, BT_HCI_EVT_SYNC_CONN_COMPLETE, > + &cc, sizeof(cc)); Great work, this might be handy for adding tests for SCO data. > return 0; > } > > @@ -7655,6 +7663,33 @@ static void send_acl(struct btdev *dev, const void *data, uint16_t len) > send_packet(conn->link->dev, iov, 3); > } > > +static void send_sco(struct btdev *dev, const void *data, uint16_t len) > +{ > + struct bt_hci_sco_hdr hdr; > + struct iovec iov[2]; > + struct btdev_conn *conn; > + uint8_t pkt_type = BT_H4_SCO_PKT; > + > + /* Packet type */ > + iov[0].iov_base = &pkt_type; > + iov[0].iov_len = sizeof(pkt_type); > + > + iov[1].iov_base = (void *) (data); > + iov[1].iov_len = len; > + > + memcpy(&hdr, data, sizeof(hdr)); > + > + conn = queue_find(dev->conns, match_handle, > + UINT_TO_PTR(acl_handle(hdr.handle))); > + if (!conn) > + return; > + > + /* TODO: flow control */ > + > + if (conn->link) > + send_packet(conn->link->dev, iov, 2); > +} > + > static void send_iso(struct btdev *dev, const void *data, uint16_t len) > { > struct bt_hci_acl_hdr *hdr; > @@ -7702,6 +7737,9 @@ void btdev_receive_h4(struct btdev *btdev, const void *data, uint16_t len) > case BT_H4_ACL_PKT: > send_acl(btdev, data + 1, len - 1); > break; > + case BT_H4_SCO_PKT: > + send_sco(btdev, data + 1, len - 1); > + break; Ive done something very similar but adding support for Sync Flow Control, might be a good idea to rebase once we are done with enabling that in the kernel so we can start adding more tests to sco-tester. > case BT_H4_ISO_PKT: > send_iso(btdev, data + 1, len - 1); > break; > -- > 2.48.1 > >
diff --git a/emulator/btdev.c b/emulator/btdev.c index ec52c5242..c44b52c49 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -2807,6 +2807,10 @@ static int cmd_enhanced_setup_sync_conn_complete(struct btdev *dev, done: send_event(dev, BT_HCI_EVT_SYNC_CONN_COMPLETE, &cc, sizeof(cc)); + if (conn) + send_event(conn->link->dev, BT_HCI_EVT_SYNC_CONN_COMPLETE, + &cc, sizeof(cc)); + return 0; } @@ -2853,6 +2857,10 @@ static int cmd_setup_sync_conn_complete(struct btdev *dev, const void *data, done: send_event(dev, BT_HCI_EVT_SYNC_CONN_COMPLETE, &cc, sizeof(cc)); + if (conn) + send_event(conn->link->dev, BT_HCI_EVT_SYNC_CONN_COMPLETE, + &cc, sizeof(cc)); + return 0; } @@ -7655,6 +7663,33 @@ static void send_acl(struct btdev *dev, const void *data, uint16_t len) send_packet(conn->link->dev, iov, 3); } +static void send_sco(struct btdev *dev, const void *data, uint16_t len) +{ + struct bt_hci_sco_hdr hdr; + struct iovec iov[2]; + struct btdev_conn *conn; + uint8_t pkt_type = BT_H4_SCO_PKT; + + /* Packet type */ + iov[0].iov_base = &pkt_type; + iov[0].iov_len = sizeof(pkt_type); + + iov[1].iov_base = (void *) (data); + iov[1].iov_len = len; + + memcpy(&hdr, data, sizeof(hdr)); + + conn = queue_find(dev->conns, match_handle, + UINT_TO_PTR(acl_handle(hdr.handle))); + if (!conn) + return; + + /* TODO: flow control */ + + if (conn->link) + send_packet(conn->link->dev, iov, 2); +} + static void send_iso(struct btdev *dev, const void *data, uint16_t len) { struct bt_hci_acl_hdr *hdr; @@ -7702,6 +7737,9 @@ void btdev_receive_h4(struct btdev *btdev, const void *data, uint16_t len) case BT_H4_ACL_PKT: send_acl(btdev, data + 1, len - 1); break; + case BT_H4_SCO_PKT: + send_sco(btdev, data + 1, len - 1); + break; case BT_H4_ISO_PKT: send_iso(btdev, data + 1, len - 1); break;