* [PATCH BlueZ 0/2] l2test fix+feature
@ 2023-03-23 10:27 Simon Mikuda
2023-03-23 10:27 ` [PATCH BlueZ 1/2] l2test: Enable hex input for PSM Simon Mikuda
2023-03-23 10:27 ` [PATCH BlueZ 2/2] l2test: Fix setting mode for BR/EDR l2cap socket Simon Mikuda
0 siblings, 2 replies; 10+ messages in thread
From: Simon Mikuda @ 2023-03-23 10:27 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
Hello!
Added fix setting socket BT_MODE
Also added minor feature enabling hex input to PSM (e.g. 0x1001)
Best regards.
Simon Mikuda (2):
l2test: Enable hex input for PSM
l2test: Fix setting mode for BR/EDR l2cap socket
lib/l2cap.h | 2 ++
tools/l2test.c | 27 +++++++++++++++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH BlueZ 1/2] l2test: Enable hex input for PSM
2023-03-23 10:27 [PATCH BlueZ 0/2] l2test fix+feature Simon Mikuda
@ 2023-03-23 10:27 ` Simon Mikuda
2023-03-23 11:42 ` l2test fix+feature bluez.test.bot
2023-03-23 17:20 ` [PATCH BlueZ 1/2] l2test: Enable hex input for PSM Luiz Augusto von Dentz
2023-03-23 10:27 ` [PATCH BlueZ 2/2] l2test: Fix setting mode for BR/EDR l2cap socket Simon Mikuda
1 sibling, 2 replies; 10+ messages in thread
From: Simon Mikuda @ 2023-03-23 10:27 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
---
tools/l2test.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/l2test.c b/tools/l2test.c
index 5aae4b687..595f1dab2 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -1416,7 +1416,10 @@ int main(int argc, char *argv[])
break;
case 'P':
- psm = atoi(optarg);
+ if (!strncasecmp(optarg, "0x", 2))
+ psm = strtoul(&optarg[2], NULL, 16);
+ else
+ psm = atoi(optarg);
break;
case 'I':
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH BlueZ 2/2] l2test: Fix setting mode for BR/EDR l2cap socket
2023-03-23 10:27 [PATCH BlueZ 0/2] l2test fix+feature Simon Mikuda
2023-03-23 10:27 ` [PATCH BlueZ 1/2] l2test: Enable hex input for PSM Simon Mikuda
@ 2023-03-23 10:27 ` Simon Mikuda
1 sibling, 0 replies; 10+ messages in thread
From: Simon Mikuda @ 2023-03-23 10:27 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
BT_MODE_* enums are used only for socket SOL_BLUETOOTH, option BT_MODE
Otherwise we should use L2CAP_MODE_* enums.
---
lib/l2cap.h | 2 ++
tools/l2test.c | 22 +++++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/lib/l2cap.h b/lib/l2cap.h
index 9197800df..62cc04b57 100644
--- a/lib/l2cap.h
+++ b/lib/l2cap.h
@@ -184,6 +184,8 @@ typedef struct {
#define L2CAP_MODE_FLOWCTL 0x02
#define L2CAP_MODE_ERTM 0x03
#define L2CAP_MODE_STREAMING 0x04
+#define L2CAP_MODE_LE_FLOWCTL 0x80
+#define L2CAP_MODE_ECRED 0x81
#define L2CAP_SERVTYPE_NOTRAFFIC 0x00
#define L2CAP_SERVTYPE_BESTEFFORT 0x01
diff --git a/tools/l2test.c b/tools/l2test.c
index 595f1dab2..61b2e778e 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -155,6 +155,24 @@ static struct lookup_table bdaddr_types[] = {
{ NULL, 0 },
};
+static int bt_mode_to_l2cap_mode(int mode)
+{
+ switch (mode) {
+ case BT_MODE_BASIC:
+ return L2CAP_MODE_BASIC;
+ case BT_MODE_ERTM:
+ return L2CAP_MODE_ERTM;
+ case BT_MODE_STREAMING:
+ return L2CAP_MODE_STREAMING;
+ case BT_MODE_LE_FLOWCTL:
+ return L2CAP_MODE_LE_FLOWCTL;
+ case BT_MODE_EXT_FLOWCTL:
+ return L2CAP_MODE_FLOWCTL;
+ default:
+ return mode;
+ }
+}
+
static int get_lookup_flag(struct lookup_table *table, char *name)
{
int i;
@@ -287,9 +305,11 @@ static int getopts(int sk, struct l2cap_options *opts, bool connected)
static int setopts(int sk, struct l2cap_options *opts)
{
- if (bdaddr_type == BDADDR_BREDR)
+ if (bdaddr_type == BDADDR_BREDR) {
+ opts->mode = bt_mode_to_l2cap_mode(opts->mode);
return setsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, opts,
sizeof(*opts));
+ }
if (opts->mode) {
if (setsockopt(sk, SOL_BLUETOOTH, BT_MODE, &opts->mode,
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* RE: l2test fix+feature
2023-03-23 10:27 ` [PATCH BlueZ 1/2] l2test: Enable hex input for PSM Simon Mikuda
@ 2023-03-23 11:42 ` bluez.test.bot
2023-03-23 17:20 ` [PATCH BlueZ 1/2] l2test: Enable hex input for PSM Luiz Augusto von Dentz
1 sibling, 0 replies; 10+ messages in thread
From: bluez.test.bot @ 2023-03-23 11:42 UTC (permalink / raw)
To: linux-bluetooth, simon.mikuda
[-- Attachment #1: Type: text/plain, Size: 2011 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=733107
---Test result---
Test Summary:
CheckPatch FAIL 1.31 seconds
GitLint PASS 0.68 seconds
BuildEll PASS 26.34 seconds
BluezMake PASS 752.58 seconds
MakeCheck PASS 11.03 seconds
MakeDistcheck PASS 147.91 seconds
CheckValgrind PASS 240.89 seconds
CheckSmatch PASS 320.56 seconds
bluezmakeextell PASS 97.38 seconds
IncrementalBuild PASS 1229.04 seconds
ScanBuild PASS 972.80 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,2/2] l2test: Fix setting mode for BR/EDR l2cap socket
ERROR:SWITCH_CASE_INDENT_LEVEL: switch and case should be at the same indent
#108: FILE: tools/l2test.c:160:
+ switch (mode) {
+ case BT_MODE_BASIC:
[...]
+ case BT_MODE_ERTM:
[...]
+ case BT_MODE_STREAMING:
[...]
+ case BT_MODE_LE_FLOWCTL:
[...]
+ case BT_MODE_EXT_FLOWCTL:
[...]
+ default:
/github/workspace/src/src/13185459.patch total: 1 errors, 0 warnings, 44 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13185459.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH BlueZ 1/2] l2test: Enable hex input for PSM
2023-03-23 10:27 ` [PATCH BlueZ 1/2] l2test: Enable hex input for PSM Simon Mikuda
2023-03-23 11:42 ` l2test fix+feature bluez.test.bot
@ 2023-03-23 17:20 ` Luiz Augusto von Dentz
2023-03-28 5:26 ` [PATCH BlueZ v2 0/2] " Simon Mikuda
1 sibling, 1 reply; 10+ messages in thread
From: Luiz Augusto von Dentz @ 2023-03-23 17:20 UTC (permalink / raw)
To: Simon Mikuda; +Cc: linux-bluetooth
Hi Simon,
On Thu, Mar 23, 2023 at 3:39 AM Simon Mikuda
<simon.mikuda@streamunlimited.com> wrote:
>
> ---
> tools/l2test.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/l2test.c b/tools/l2test.c
> index 5aae4b687..595f1dab2 100644
> --- a/tools/l2test.c
> +++ b/tools/l2test.c
> @@ -1416,7 +1416,10 @@ int main(int argc, char *argv[])
> break;
>
> case 'P':
> - psm = atoi(optarg);
> + if (!strncasecmp(optarg, "0x", 2))
> + psm = strtoul(&optarg[2], NULL, 16);
strtoul should be able to autodetect the base and parse 0x if you give
0 as base:
https://linux.die.net/man/3/strtoul
> + else
> + psm = atoi(optarg);
> break;
>
> case 'I':
> --
> 2.34.1
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH BlueZ v2 0/2] l2test: Enable hex input for PSM
2023-03-23 17:20 ` [PATCH BlueZ 1/2] l2test: Enable hex input for PSM Luiz Augusto von Dentz
@ 2023-03-28 5:26 ` Simon Mikuda
2023-03-28 5:26 ` [PATCH BlueZ v2 1/2] " Simon Mikuda
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Simon Mikuda @ 2023-03-28 5:26 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
Thanks for review. I'm sending updated patches.
Simon Mikuda (2):
l2test: Enable hex input for PSM
l2test: Fix setting mode for BR/EDR l2cap socket
lib/l2cap.h | 2 ++
tools/l2test.c | 24 ++++++++++++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH BlueZ v2 1/2] l2test: Enable hex input for PSM
2023-03-28 5:26 ` [PATCH BlueZ v2 0/2] " Simon Mikuda
@ 2023-03-28 5:26 ` Simon Mikuda
2023-03-28 6:57 ` bluez.test.bot
2023-03-28 5:26 ` [PATCH BlueZ v2 2/2] l2test: Fix setting mode for BR/EDR l2cap socket Simon Mikuda
2023-03-28 20:50 ` [PATCH BlueZ v2 0/2] l2test: Enable hex input for PSM patchwork-bot+bluetooth
2 siblings, 1 reply; 10+ messages in thread
From: Simon Mikuda @ 2023-03-28 5:26 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
---
tools/l2test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/l2test.c b/tools/l2test.c
index 5aae4b687..232247b78 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -1416,7 +1416,7 @@ int main(int argc, char *argv[])
break;
case 'P':
- psm = atoi(optarg);
+ psm = strtoul(optarg, NULL, 0);
break;
case 'I':
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH BlueZ v2 2/2] l2test: Fix setting mode for BR/EDR l2cap socket
2023-03-28 5:26 ` [PATCH BlueZ v2 0/2] " Simon Mikuda
2023-03-28 5:26 ` [PATCH BlueZ v2 1/2] " Simon Mikuda
@ 2023-03-28 5:26 ` Simon Mikuda
2023-03-28 20:50 ` [PATCH BlueZ v2 0/2] l2test: Enable hex input for PSM patchwork-bot+bluetooth
2 siblings, 0 replies; 10+ messages in thread
From: Simon Mikuda @ 2023-03-28 5:26 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Simon Mikuda
BT_MODE_* enums are used only for socket SOL_BLUETOOTH, option BT_MODE
Otherwise we should use L2CAP_MODE_* enums.
---
lib/l2cap.h | 2 ++
tools/l2test.c | 22 +++++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/lib/l2cap.h b/lib/l2cap.h
index 9197800df..62cc04b57 100644
--- a/lib/l2cap.h
+++ b/lib/l2cap.h
@@ -184,6 +184,8 @@ typedef struct {
#define L2CAP_MODE_FLOWCTL 0x02
#define L2CAP_MODE_ERTM 0x03
#define L2CAP_MODE_STREAMING 0x04
+#define L2CAP_MODE_LE_FLOWCTL 0x80
+#define L2CAP_MODE_ECRED 0x81
#define L2CAP_SERVTYPE_NOTRAFFIC 0x00
#define L2CAP_SERVTYPE_BESTEFFORT 0x01
diff --git a/tools/l2test.c b/tools/l2test.c
index 232247b78..e86ac917c 100644
--- a/tools/l2test.c
+++ b/tools/l2test.c
@@ -155,6 +155,24 @@ static struct lookup_table bdaddr_types[] = {
{ NULL, 0 },
};
+static int bt_mode_to_l2cap_mode(int mode)
+{
+ switch (mode) {
+ case BT_MODE_BASIC:
+ return L2CAP_MODE_BASIC;
+ case BT_MODE_ERTM:
+ return L2CAP_MODE_ERTM;
+ case BT_MODE_STREAMING:
+ return L2CAP_MODE_STREAMING;
+ case BT_MODE_LE_FLOWCTL:
+ return L2CAP_MODE_LE_FLOWCTL;
+ case BT_MODE_EXT_FLOWCTL:
+ return L2CAP_MODE_FLOWCTL;
+ default:
+ return mode;
+ }
+}
+
static int get_lookup_flag(struct lookup_table *table, char *name)
{
int i;
@@ -287,9 +305,11 @@ static int getopts(int sk, struct l2cap_options *opts, bool connected)
static int setopts(int sk, struct l2cap_options *opts)
{
- if (bdaddr_type == BDADDR_BREDR)
+ if (bdaddr_type == BDADDR_BREDR) {
+ opts->mode = bt_mode_to_l2cap_mode(opts->mode);
return setsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, opts,
sizeof(*opts));
+ }
if (opts->mode) {
if (setsockopt(sk, SOL_BLUETOOTH, BT_MODE, &opts->mode,
--
2.34.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* RE: l2test: Enable hex input for PSM
2023-03-28 5:26 ` [PATCH BlueZ v2 1/2] " Simon Mikuda
@ 2023-03-28 6:57 ` bluez.test.bot
0 siblings, 0 replies; 10+ messages in thread
From: bluez.test.bot @ 2023-03-28 6:57 UTC (permalink / raw)
To: linux-bluetooth, simon.mikuda
[-- Attachment #1: Type: text/plain, Size: 2017 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=734449
---Test result---
Test Summary:
CheckPatch FAIL 1.32 seconds
GitLint PASS 0.68 seconds
BuildEll PASS 27.26 seconds
BluezMake PASS 1033.05 seconds
MakeCheck PASS 11.60 seconds
MakeDistcheck PASS 153.92 seconds
CheckValgrind PASS 251.46 seconds
CheckSmatch PASS 335.56 seconds
bluezmakeextell PASS 101.56 seconds
IncrementalBuild PASS 1774.04 seconds
ScanBuild PASS 1067.84 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v2,2/2] l2test: Fix setting mode for BR/EDR l2cap socket
ERROR:SWITCH_CASE_INDENT_LEVEL: switch and case should be at the same indent
#110: FILE: tools/l2test.c:160:
+ switch (mode) {
+ case BT_MODE_BASIC:
[...]
+ case BT_MODE_ERTM:
[...]
+ case BT_MODE_STREAMING:
[...]
+ case BT_MODE_LE_FLOWCTL:
[...]
+ case BT_MODE_EXT_FLOWCTL:
[...]
+ default:
/github/workspace/src/src/13190513.patch total: 1 errors, 0 warnings, 44 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/src/13190513.patch has style problems, please review.
NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH BlueZ v2 0/2] l2test: Enable hex input for PSM
2023-03-28 5:26 ` [PATCH BlueZ v2 0/2] " Simon Mikuda
2023-03-28 5:26 ` [PATCH BlueZ v2 1/2] " Simon Mikuda
2023-03-28 5:26 ` [PATCH BlueZ v2 2/2] l2test: Fix setting mode for BR/EDR l2cap socket Simon Mikuda
@ 2023-03-28 20:50 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+bluetooth @ 2023-03-28 20:50 UTC (permalink / raw)
To: Simon Mikuda; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 28 Mar 2023 07:26:17 +0200 you wrote:
> Thanks for review. I'm sending updated patches.
>
> Simon Mikuda (2):
> l2test: Enable hex input for PSM
> l2test: Fix setting mode for BR/EDR l2cap socket
>
> lib/l2cap.h | 2 ++
> tools/l2test.c | 24 ++++++++++++++++++++++--
> 2 files changed, 24 insertions(+), 2 deletions(-)
Here is the summary with links:
- [BlueZ,v2,1/2] l2test: Enable hex input for PSM
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=cedace72c3f7
- [BlueZ,v2,2/2] l2test: Fix setting mode for BR/EDR l2cap socket
(no matching commit)
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] 10+ messages in thread
end of thread, other threads:[~2023-03-28 20:50 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23 10:27 [PATCH BlueZ 0/2] l2test fix+feature Simon Mikuda
2023-03-23 10:27 ` [PATCH BlueZ 1/2] l2test: Enable hex input for PSM Simon Mikuda
2023-03-23 11:42 ` l2test fix+feature bluez.test.bot
2023-03-23 17:20 ` [PATCH BlueZ 1/2] l2test: Enable hex input for PSM Luiz Augusto von Dentz
2023-03-28 5:26 ` [PATCH BlueZ v2 0/2] " Simon Mikuda
2023-03-28 5:26 ` [PATCH BlueZ v2 1/2] " Simon Mikuda
2023-03-28 6:57 ` bluez.test.bot
2023-03-28 5:26 ` [PATCH BlueZ v2 2/2] l2test: Fix setting mode for BR/EDR l2cap socket Simon Mikuda
2023-03-28 20:50 ` [PATCH BlueZ v2 0/2] l2test: Enable hex input for PSM patchwork-bot+bluetooth
2023-03-23 10:27 ` [PATCH BlueZ 2/2] l2test: Fix setting mode for BR/EDR l2cap socket Simon Mikuda
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.