l2test fix+feature
Subsystems (2)
cover l2test fix+feature
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(-)
Signature · 1 line
2.34.1
PATCH 1/2 l2test: Enable hex input for PSM
--- tools/l2test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/l2test.c +4 -1
@@ -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' :
Signature · 1 line
2.34.1
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
Luiz Augusto von Dentz
maintainerRe: [PATCH BlueZ 1/2] l2test: Enable hex input for PSM
In reply to Simon MikudaHi Simon,
Quoted 10 lines · Simon Mikuda
--- tools/l2test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/l2test.c +0
-0
tools/l2test.c int main(int argc, char *argv[]) · line 1420
Quoted 6 lines
tools/l2test.c +2
-1@@ -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:
Quoted 8 lines
tools/l2test.c +2
-1+else + psm =atoi (optarg);break ;case 'I' : --2.34.1
Signature · 1 line
Luiz Augusto von Dentz
v2 cover l2test: Enable hex input for PSM
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(-)
Signature · 1 line
2.34.1
PATCH v2 1/2 l2test: Enable hex input for PSM
--- tools/l2test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/l2test.c +1 -1
@@ -1416,7 +1416,7 @@ int main(int argc, char *argv[])break ;case 'P' : - psm =atoi (optarg); + psm =strtoul (optarg,NULL ,0 );break ;case 'I' :
Signature · 1 line
2.34.1
RE: l2test: Enable hex input for PSM
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
PATCH v2 2/2 l2test: Fix setting mode for BR/EDR l2cap socket
In reply to Simon MikudaBT_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(-)
lib/l2cap.h +2 -0
@@ -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
tools/l2test.c +21 -1
@@ -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,
Signature · 1 line
2.34.1
Re: [PATCH BlueZ v2 0/2] l2test: Enable hex input for PSM
In reply to Simon MikudaThis series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 9 lines · 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 socketlib/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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
PATCH 2/2 l2test: Fix setting mode for BR/EDR l2cap socket
In reply to Simon MikudaBT_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(-)
lib/l2cap.h +2 -0
@@ -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
tools/l2test.c +21 -1
@@ -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,
Signature · 1 line
2.34.1