diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2012-11-25 10:19:40 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-11-25 10:19:40 +0100 |
commit | 56e4798e1e4e5833fce922bb78de42713a6e4982 (patch) | |
tree | d044428fc511530fed7e2902be7dfd168dfedd94 /drivers | |
parent | 9b4d69cf8d3cce3fe366ebc130482436e6362e07 (diff) |
qmimodem: Print error string instead of code if available
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/qmimodem/qmi.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index ab34a8e1..b2f2276a 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -540,9 +540,16 @@ static void __debug_msg(const char dir, const void *buf, size_t len, if (tlv->type == 0x02 && tlv_length == QMI_RESULT_CODE_SIZE) { const struct qmi_result_code *result = ptr + offset + QMI_TLV_HDR_SIZE; - - str += sprintf(str, " {type=%d,error=%d}", tlv->type, - GUINT16_FROM_LE(result->error)); + uint16_t error = GUINT16_FROM_LE(result->error); + const char *error_str; + + error_str = __error_to_string(error); + if (error_str) + str += sprintf(str, " {type=%d,error=%s}", + tlv->type, error_str); + else + str += sprintf(str, " {type=%d,error=%d}", + tlv->type, error); } else { str += sprintf(str, " {type=%d,len=%d}", tlv->type, tlv_length); |