summaryrefslogtreecommitdiff
path: root/monitor/sdp.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2018-11-01 15:55:12 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2018-11-02 13:09:27 +0200
commit2657fed2cec1551c6d5987aadf5586cb249e3ba5 (patch)
tree8d74e615c696ff38fbe16d20e7c8dc1e1bd485d1 /monitor/sdp.c
parentb18f628f613eda2a6fb013541fb8bb6eaee38cd2 (diff)
downloadbluez-2657fed2cec1551c6d5987aadf5586cb249e3ba5.tar.gz
monitor: Decode error response
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)
Diffstat (limited to 'monitor/sdp.c')
-rw-r--r--monitor/sdp.c20
1 files changed, 19 insertions, 1 deletions
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)