mbox series

[BlueZ,0/2] l2test fix+feature

Message ID 20230323102732.566440-1-simon.mikuda@streamunlimited.com
Headers show
Series l2test fix+feature | expand

Message

Simon Mikuda March 23, 2023, 10:27 a.m. UTC
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(-)

Comments

Luiz Augusto von Dentz March 23, 2023, 5:20 p.m. UTC | #1
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
>