@@ -47,14 +47,11 @@ namespace fw16led::ledmatrix
47
47
// Send the data via bulk OUT transfer
48
48
int actual_length = 0 ;
49
49
int ret = libusb_bulk_transfer (device.get (), ENDPOINT_OUT, outData.data (), static_cast <int >(outData.size ()), &actual_length, TRANSFER_TIMEOUT_MS);
50
- if (ret != LIBUSB_SUCCESS)
51
- {
52
- LOG_WARN (" Bulk OUT transfer failed: {}" , libusb_strerror (static_cast <libusb_error>(ret)));
53
- }
54
-
55
- if (actual_length != static_cast <int >(outData.size ()))
50
+ if (ret != LIBUSB_SUCCESS || actual_length != static_cast <int >(outData.size ()))
56
51
{
57
- LOG_WARN (" Bulk OUT transfer size does not match. Expected {}; Got {}" , outData.size (), actual_length);
52
+ LOG_WARN (" Bulk OUT transfer failed or size mismatch: {}" , libusb_strerror (static_cast <libusb_error>(ret)));
53
+ std::this_thread::sleep_for (std::chrono::milliseconds (100 ));
54
+ return send_command (command, parameters);
58
55
}
59
56
}
60
57
@@ -72,15 +69,11 @@ namespace fw16led::ledmatrix
72
69
// Send the data via bulk OUT transfer
73
70
int actual_length = 0 ;
74
71
int ret = libusb_bulk_transfer (device.get (), ENDPOINT_OUT, outData.data (), static_cast <int >(outData.size ()), &actual_length, TRANSFER_TIMEOUT_MS);
75
- if (ret != LIBUSB_SUCCESS)
76
- {
77
- LOG_WARN (" Bulk OUT transfer failed: {}" , libusb_strerror (static_cast <libusb_error>(ret)));
78
- return {};
79
- }
80
-
81
- if (actual_length != static_cast <int >(outData.size ()))
72
+ if (ret != LIBUSB_SUCCESS || actual_length != static_cast <int >(outData.size ()))
82
73
{
83
- LOG_WARN (" Bulk OUT transfer size does not match. Expected {}; Got {}" , outData.size (), actual_length);
74
+ LOG_WARN (" Bulk OUT transfer failed or size mismatch: {}" , libusb_strerror (static_cast <libusb_error>(ret)));
75
+ std::this_thread::sleep_for (std::chrono::milliseconds (100 ));
76
+ return send_command_with_response (command, parameters);
84
77
}
85
78
86
79
std::vector<uint8_t > inData (RESPONSE_SIZE, 0 );
@@ -90,7 +83,8 @@ namespace fw16led::ledmatrix
90
83
if (ret != LIBUSB_SUCCESS)
91
84
{
92
85
LOG_WARN (" Bulk IN transfer failed: {}" , libusb_strerror (static_cast <libusb_error>(ret)));
93
- return {};
86
+ std::this_thread::sleep_for (std::chrono::milliseconds (100 ));
87
+ return send_command_with_response (command, parameters);
94
88
}
95
89
96
90
// Shrink the buffer to the actual number of bytes read
0 commit comments