diff --git a/NEWS.adoc b/NEWS.adoc index 16e339db4a..b245e3d1e9 100644 --- a/NEWS.adoc +++ b/NEWS.adoc @@ -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. diff --git a/drivers/libusb0.c b/drivers/libusb0.c index 8471136efb..ceb6d624a0 100644 --- a/drivers/libusb0.c +++ b/drivers/libusb0.c @@ -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 = { @@ -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; diff --git a/drivers/libusb1.c b/drivers/libusb1.c index e9f6c855c4..d250825ea9 100644 --- a/drivers/libusb1.c +++ b/drivers/libusb1.c @@ -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 = { @@ -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;