Re: [PATCH BlueZ 1/4] monitor: Decode error response

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
On Thu, Nov 1, 2018 at 4:17 PM Luiz Augusto von Dentz
<luiz.dentz@xxxxxxxxx> wrote:
>
> From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
>
> This adds decoding for the error code in the error response:
>
> > test-sdp: User Data RX
>       Channel: 0 len 7 [PSM 1 mode 0] {chan 0}
>       SDP: Error Response (0x01) tid 2 len 2
>         Error code: Invalid Continuation State (0x0005)
> ---
>  monitor/sdp.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/monitor/sdp.c b/monitor/sdp.c
> index 36708f426..1df26a0ca 100644
> --- a/monitor/sdp.c
> +++ b/monitor/sdp.c
> @@ -532,6 +532,24 @@ static uint16_t common_rsp(const struct l2cap_frame *frame,
>         return bytes;
>  }
>
> +static const char *error_str(uint16_t code)
> +{
> +       switch (code) {
> +       case 0x0001:
> +               return "Invalid Version";
> +       case 0x0002:
> +               return "Invalid Record Handle";
> +       case 0x0003:
> +               return "Invalid Syntax";
> +       case 0x0004:
> +               return "Invalid PDU Size";
> +       case 0x0005:
> +               return "Invalid Continuation State";
> +       default:
> +               return "Unknown";
> +       }
> +}
> +
>  static void error_rsp(const struct l2cap_frame *frame, struct tid_data *tid)
>  {
>         uint16_t error;
> @@ -546,7 +564,7 @@ static void error_rsp(const struct l2cap_frame *frame, struct tid_data *tid)
>
>         error = get_be16(frame->data);
>
> -       print_field("Error code: 0x%2.2x", error);
> +       print_field("Error code: %s (0x%4.4x)", error_str(error), error);
>  }
>
>  static void service_req(const struct l2cap_frame *frame, struct tid_data *tid)
> --
> 2.17.2

Applied.

-- 
Luiz Augusto von Dentz



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux