Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ https://github.com/networkupstools/nut/milestone/13
descriptor lengths, which could cause a segmentation fault (regression
added in NUT v2.8.5 release). [PR #3550]

- USB drivers now prefer the longer of conflicting HID report descriptor
lengths for EcoFlow devices using USB ID `3746:ffff`. This makes the
complete descriptor available on affected River 3 Plus firmware while
retaining the shorter length as a fallback.

- Windows serial compatibility: fixed timeout handling to return data
already received as a successful short read, while safely canceling
and completing pending overlapped I/O before reusing its state.
Expand Down
8 changes: 7 additions & 1 deletion drivers/libusb0.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#include "strcasestr-static.h"

#define USB_DRIVER_NAME "USB communication driver (libusb 0.1)"
#define USB_DRIVER_VERSION "0.53"
#define USB_DRIVER_VERSION "0.54"

/* driver description structure */
upsdrv_info_t comm_upsdrv_info = {
Expand Down Expand Up @@ -631,6 +631,12 @@ static int nut_libusb_open(usb_dev_handle **udevp,
rdlens[0] = rdlen1;
rdlens[1] = rdlen2;
}
else if ((curDevice->VendorID == 0x3746) && (curDevice->ProductID == 0xffff)
&& (rdlen1 != rdlen2)) {
upsdebugx(1, "EcoFlow device. Trying longer report descriptor first");
rdlens[0] = rdlen1 > rdlen2 ? rdlen1 : rdlen2;
rdlens[1] = rdlen1 > rdlen2 ? rdlen2 : rdlen1;
}
else {
rdlens[0] = rdlen2 >= 0 ? rdlen2 : rdlen1;
rdlens[1] = rdlen2 >= 0 ? rdlen1 : rdlen2;
Expand Down
8 changes: 7 additions & 1 deletion drivers/libusb1.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#endif

#define USB_DRIVER_NAME "USB communication driver (libusb 1.0)"
#define USB_DRIVER_VERSION "0.54"
#define USB_DRIVER_VERSION "0.55"

/* driver description structure */
upsdrv_info_t comm_upsdrv_info = {
Expand Down Expand Up @@ -788,6 +788,12 @@ static int nut_libusb_open(libusb_device_handle **udevp,
rdlens[0] = rdlen1;
rdlens[1] = rdlen2;
}
else if ((curDevice->VendorID == 0x3746) && (curDevice->ProductID == 0xffff)
&& (rdlen1 != rdlen2)) {
upsdebugx(1, "EcoFlow device. Trying longer report descriptor first");
rdlens[0] = rdlen1 > rdlen2 ? rdlen1 : rdlen2;
rdlens[1] = rdlen1 > rdlen2 ? rdlen2 : rdlen1;
}
else {
rdlens[0] = rdlen2 >= 0 ? rdlen2 : rdlen1;
rdlens[1] = rdlen2 >= 0 ? rdlen1 : rdlen2;
Expand Down
Loading