Stop printing attention reports if GetAttentionReport fails
diff --git a/rmihidtool/main.cpp b/rmihidtool/main.cpp
index 8641b3b..f8a1770 100644
--- a/rmihidtool/main.cpp
+++ b/rmihidtool/main.cpp
@@ -323,9 +323,11 @@
report_attn = 1;
while(report_attn) {
unsigned int bytes = 256;
- device->GetAttentionReport(NULL, NULL, report, &bytes);
- print_buffer(report, bytes);
- fprintf(stdout, "\n");
+ rc = device->GetAttentionReport(NULL, NULL, report, &bytes);
+ if (rc > 0) {
+ print_buffer(report, bytes);
+ fprintf(stdout, "\n");
+ }
}
break;
case RMIHIDTOOL_CMD_PRINT_FUNCTIONS: