* [PATCH BlueZ 0/1] isotest: Add defer setup support for Broadcast Receiver
@ 2023-08-23 15:11 Iulia Tanasescu
2023-08-23 15:11 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
2023-08-23 23:00 ` [PATCH BlueZ 0/1] " patchwork-bot+bluetooth
0 siblings, 2 replies; 5+ messages in thread
From: Iulia Tanasescu @ 2023-08-23 15:11 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
vlad.pruteanu, andrei.istodorescu, Iulia Tanasescu
This patch adds defer setup support for the Broadcast Receiver scenario.
In order to create a Broadcast Receiver with the defer setup option,
the -W command line parameter should be used, as described in
isotest.rst.
Iulia Tanasescu (1):
isotest: Add defer setup support for Broadcast Receiver
tools/isotest.c | 122 +++++++++++++++++++++++++++++++-----------------
1 file changed, 80 insertions(+), 42 deletions(-)
base-commit: 8eb1dee87e019f29b6c8233dfe0f9aef8ee44461
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH BlueZ 1/1] isotest: Add defer setup support for Broadcast Receiver
2023-08-23 15:11 [PATCH BlueZ 0/1] isotest: Add defer setup support for Broadcast Receiver Iulia Tanasescu
@ 2023-08-23 15:11 ` Iulia Tanasescu
2023-08-23 16:14 ` bluez.test.bot
2023-08-23 23:00 ` [PATCH BlueZ 0/1] " patchwork-bot+bluetooth
1 sibling, 1 reply; 5+ messages in thread
From: Iulia Tanasescu @ 2023-08-23 15:11 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
vlad.pruteanu, andrei.istodorescu, Iulia Tanasescu
This adds defer setup support for the Broadcast Receiver scenario.
In order to create a Broadcast Receiver with the defer setup option,
the -W command line parameter should be used, as described in
isotest.rst.
---
tools/isotest.c | 122 +++++++++++++++++++++++++++++++-----------------
1 file changed, 80 insertions(+), 42 deletions(-)
diff --git a/tools/isotest.c b/tools/isotest.c
index c71bc6fa0..68729d977 100644
--- a/tools/isotest.c
+++ b/tools/isotest.c
@@ -434,16 +434,60 @@ error:
}
-static void do_listen(char *filename, void (*handler)(int fd, int sk),
- char *peer)
+static int accept_conn(int sk, struct sockaddr_iso *addr, char *peer)
+{
+ socklen_t optlen;
+ int nsk, err, sk_err;
+ struct pollfd fds;
+ socklen_t len;
+
+ memset(addr, 0, sizeof(*addr) + sizeof(*addr->iso_bc));
+ optlen = sizeof(*addr);
+
+ if (peer)
+ optlen += sizeof(*addr->iso_bc);
+
+ nsk = accept(sk, (struct sockaddr *) addr, &optlen);
+ if (nsk < 0) {
+ syslog(LOG_ERR, "Accept failed: %s (%d)",
+ strerror(errno), errno);
+ return -1;
+ }
+
+ /* Check if connection was successful */
+ memset(&fds, 0, sizeof(fds));
+ fds.fd = nsk;
+ fds.events = POLLERR;
+
+ if (poll(&fds, 1, 0) > 0 && (fds.revents & POLLERR)) {
+ len = sizeof(sk_err);
+
+ if (getsockopt(nsk, SOL_SOCKET, SO_ERROR,
+ &sk_err, &len) < 0)
+ err = -errno;
+ else
+ err = -sk_err;
+
+ if (err < 0)
+ syslog(LOG_ERR, "Connection failed: %s (%d)",
+ strerror(-err), -err);
+
+ close(nsk);
+ return -1;
+ }
+
+ return nsk;
+}
+
+static void do_listen(char *filename,
+ void (*handler)(int fd, int sk, char *peer),
+ char *peer)
{
struct sockaddr_iso *addr = NULL;
socklen_t optlen;
int sk, nsk, fd = -1;
char ba[18];
- struct pollfd fds;
- int err, sk_err;
- socklen_t len;
+ int read_len;
if (filename) {
fd = open(filename, O_WRONLY | O_CREAT | O_APPEND, 0644);
@@ -519,41 +563,27 @@ static void do_listen(char *filename, void (*handler)(int fd, int sk),
syslog(LOG_INFO, "Waiting for connection %s...", peer ? peer : "");
- while (1) {
- memset(addr, 0, sizeof(*addr) + sizeof(*addr->iso_bc));
- optlen = sizeof(*addr);
-
- if (peer)
- optlen += sizeof(*addr->iso_bc);
-
- nsk = accept(sk, (struct sockaddr *) addr, &optlen);
- if (nsk < 0) {
- syslog(LOG_ERR, "Accept failed: %s (%d)",
- strerror(errno), errno);
+ /* Handle deferred setup */
+ if (defer_setup && peer) {
+ nsk = accept_conn(sk, addr, peer);
+ if (nsk < 0)
goto error;
- }
- /* Check if connection was successful */
- memset(&fds, 0, sizeof(fds));
- fds.fd = nsk;
- fds.events = POLLERR;
-
- if (poll(&fds, 1, 0) > 0 && (fds.revents & POLLERR)) {
- len = sizeof(sk_err);
-
- if (getsockopt(nsk, SOL_SOCKET, SO_ERROR,
- &sk_err, &len) < 0)
- err = -errno;
- else
- err = -sk_err;
+ close(sk);
+ sk = nsk;
- if (err < 0)
- syslog(LOG_ERR, "Connection failed: %s (%d)",
- strerror(-err), -err);
+ read_len = read(sk, buf, data_size);
+ if (read_len < 0)
+ syslog(LOG_ERR, "Initial read error: %s (%d)",
+ strerror(errno), errno);
+ else
+ syslog(LOG_INFO, "Initial bytes %d", read_len);
+ }
- close(nsk);
+ while (1) {
+ nsk = accept_conn(sk, addr, peer);
+ if (nsk < 0)
continue;
- }
if (fork()) {
/* Parent */
@@ -583,7 +613,7 @@ static void do_listen(char *filename, void (*handler)(int fd, int sk),
}
}
- handler(fd, nsk);
+ handler(fd, nsk, peer);
syslog(LOG_INFO, "Disconnect");
exit(0);
@@ -598,11 +628,11 @@ error:
exit(1);
}
-static void dump_mode(int fd, int sk)
+static void dump_mode(int fd, int sk, char *peer)
{
int len;
- if (defer_setup) {
+ if (defer_setup && !peer) {
len = read(sk, buf, data_size);
if (len < 0)
syslog(LOG_ERR, "Initial read error: %s (%d)",
@@ -625,14 +655,14 @@ static void dump_mode(int fd, int sk)
}
}
-static void recv_mode(int fd, int sk)
+static void recv_mode(int fd, int sk, char *peer)
{
struct timeval tv_beg, tv_end, tv_diff;
long total;
int len;
uint32_t seq;
- if (defer_setup) {
+ if (defer_setup && !peer) {
len = read(sk, buf, data_size);
if (len < 0)
syslog(LOG_ERR, "Initial read error: %s (%d)",
@@ -1446,7 +1476,11 @@ int main(int argc, char *argv[])
}
/* Child */
- dump_mode(-1, sk_arr[i]);
+ if (!strcmp(peer, "00:00:00:00:00:00"))
+ dump_mode(-1, sk_arr[i], peer);
+ else
+ dump_mode(-1, sk_arr[i], NULL);
+
exit(0);
}
@@ -1462,7 +1496,11 @@ int main(int argc, char *argv[])
sk = do_connect(argv[optind + i]);
if (sk < 0)
exit(1);
- dump_mode(-1, sk);
+
+ if (!strcmp(peer, "00:00:00:00:00:00"))
+ dump_mode(-1, sk, peer);
+ else
+ dump_mode(-1, sk, NULL);
}
break;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: isotest: Add defer setup support for Broadcast Receiver
2023-08-23 15:11 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
@ 2023-08-23 16:14 ` bluez.test.bot
0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2023-08-23 16:14 UTC (permalink / raw)
To: linux-bluetooth, iulia.tanasescu
[-- Attachment #1: Type: text/plain, Size: 947 bytes --]
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=778644
---Test result---
Test Summary:
CheckPatch PASS 0.58 seconds
GitLint PASS 0.34 seconds
BuildEll PASS 27.68 seconds
BluezMake PASS 903.00 seconds
MakeCheck PASS 12.11 seconds
MakeDistcheck PASS 159.22 seconds
CheckValgrind PASS 261.53 seconds
CheckSmatch PASS 349.90 seconds
bluezmakeextell PASS 104.95 seconds
IncrementalBuild PASS 729.79 seconds
ScanBuild PASS 1090.00 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH BlueZ 0/1] isotest: Add defer setup support for Broadcast Receiver
2023-08-23 15:11 [PATCH BlueZ 0/1] isotest: Add defer setup support for Broadcast Receiver Iulia Tanasescu
2023-08-23 15:11 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
@ 2023-08-23 23:00 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2023-08-23 23:00 UTC (permalink / raw)
To: Iulia Tanasescu
Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica,
silviu.barbulescu, vlad.pruteanu, andrei.istodorescu
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 23 Aug 2023 18:11:24 +0300 you wrote:
> This patch adds defer setup support for the Broadcast Receiver scenario.
>
> In order to create a Broadcast Receiver with the defer setup option,
> the -W command line parameter should be used, as described in
> isotest.rst.
>
> Iulia Tanasescu (1):
> isotest: Add defer setup support for Broadcast Receiver
>
> [...]
Here is the summary with links:
- [BlueZ,1/1] isotest: Add defer setup support for Broadcast Receiver
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8b2f002edeb3
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH BlueZ 0/1] isotest: Add defer setup support for Broadcast Receiver
@ 2023-08-02 14:44 Iulia Tanasescu
0 siblings, 0 replies; 5+ messages in thread
From: Iulia Tanasescu @ 2023-08-02 14:44 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
vlad.pruteanu, andrei.istodorescu, Iulia Tanasescu
This patch adds defer setup support for the Broadcast Receiver scenario.
In order to create a Broadcast Receiver with the defer setup option,
the -W command line parameter should be used, as described in
isotest.rst.
This implementation requires the kernel support introduced by
https://patchwork.kernel.org/project/bluetooth/patch/20230802143638.59945-2-iulia.tanasescu@nxp.com/
Iulia Tanasescu (1):
isotest: Add defer setup support for Broadcast Receiver
tools/isotest.c | 122 +++++++++++++++++++++++++++++++-----------------
1 file changed, 80 insertions(+), 42 deletions(-)
base-commit: 8eb1dee87e019f29b6c8233dfe0f9aef8ee44461
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-23 23:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23 15:11 [PATCH BlueZ 0/1] isotest: Add defer setup support for Broadcast Receiver Iulia Tanasescu
2023-08-23 15:11 ` [PATCH BlueZ 1/1] " Iulia Tanasescu
2023-08-23 16:14 ` bluez.test.bot
2023-08-23 23:00 ` [PATCH BlueZ 0/1] " patchwork-bot+bluetooth
-- strict thread matches above, loose matches on Subject: below --
2023-08-02 14:44 Iulia Tanasescu
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).