Commit c60b9881 authored by Jakob Bornecrantz's avatar Jakob Bornecrantz
Browse files

d/psmv: More verbose error handling

parent e5a9cbb2
Pipeline #76882 failed with stages
in 2 minutes and 28 seconds
...@@ -1176,10 +1176,13 @@ psmv_get_calibration_zcm1(struct psmv_device *psmv) ...@@ -1176,10 +1176,13 @@ psmv_get_calibration_zcm1(struct psmv_device *psmv)
ret = os_hid_get_feature(psmv->hid, 0x10, src, sizeof(part)); ret = os_hid_get_feature(psmv->hid, 0x10, src, sizeof(part));
if (ret < 0) { if (ret < 0) {
PSMV_ERROR(psmv, "os_hid_get_feature returned %i", ret);
return ret; return ret;
} }
if (ret != (int)sizeof(part)) { if (ret != (int)sizeof(part)) {
PSMV_ERROR(psmv, "Size wrong: %i != %i", ret,
(int)sizeof(part));
return -1; return -1;
} }
...@@ -1196,7 +1199,9 @@ psmv_get_calibration_zcm1(struct psmv_device *psmv) ...@@ -1196,7 +1199,9 @@ psmv_get_calibration_zcm1(struct psmv_device *psmv)
src_offset = 2; src_offset = 2;
dst_offset = sizeof(part) * 2 - 2; dst_offset = sizeof(part) * 2 - 2;
break; break;
default: return -1; default:
PSMV_ERROR(psmv, "Unexpected part id! %i", part.which);
return -1;
} }
memcpy(dst + dst_offset, src + src_offset, memcpy(dst + dst_offset, src + src_offset,
...@@ -1402,10 +1407,13 @@ psmv_get_calibration_zcm2(struct psmv_device *psmv) ...@@ -1402,10 +1407,13 @@ psmv_get_calibration_zcm2(struct psmv_device *psmv)
ret = os_hid_get_feature(psmv->hid, 0x10, src, sizeof(part)); ret = os_hid_get_feature(psmv->hid, 0x10, src, sizeof(part));
if (ret < 0) { if (ret < 0) {
PSMV_ERROR(psmv, "os_hid_get_feature returned %i", ret);
return ret; return ret;
} }
if (ret != (int)sizeof(part)) { if (ret != (int)sizeof(part)) {
PSMV_ERROR(psmv, "Size wrong: %i != %i", ret,
(int)sizeof(*part));
return -1; return -1;
} }
...@@ -1418,7 +1426,9 @@ psmv_get_calibration_zcm2(struct psmv_device *psmv) ...@@ -1418,7 +1426,9 @@ psmv_get_calibration_zcm2(struct psmv_device *psmv)
src_offset = 2; src_offset = 2;
dst_offset = sizeof(part); dst_offset = sizeof(part);
break; break;
default: return -1; default:
PSMV_ERROR(psmv, "Unexpected part id! %i", part->which);
return -1;
} }
memcpy(dst + dst_offset, src + src_offset, memcpy(dst + dst_offset, src + src_offset,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment