Repository navigation
Description
Apparently some devices don't close their replies to our commands/queries with the expected (and mandated by the specs) CR and, at the moment, this is not supported by nutdrv_qx:
http://lists.alioth.debian.org/pipermail/nut-upsuser/2017-June/010714.html
('krauler' USB subdriver)
As far as I can remember, this eventuality can only happen with certain USB subdrivers that only read a predetermined amount of data, read data from a given index or wait till no more data is available (if I recall correctly, serial communication and other USB subdrivers need the terminating CR in order to work properly), so, probably, the easiest fix should be to handle this situation in those USB subdrivers.
Also, this should not be considered an improvement, but a regression that needs to be solved, since blazer_* drivers, being less strict on the terminating CR of Q1 replies (3747fd5), should (sort of) support (some of) this kind of devices.
MAINTAINER NOTE: The null byte vs. \r at end of reads sounds reminiscent of work recently done by @blaa for the nutdrv_qx subdriver for armac in #2005; maybe this part should/can be generalized somehow to help with all devices that do not use CR/LF in protocol? It seems that the 1595a06 commit which allegedly solved this issue previously added the fix for certain *_command() methods, and so is lacking in some others that appeared afterwards.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
clepple commentedon Oct 8, 2017
@zykh is it okay if I move this to the 2.7.6 milestone?
zykh commentedon Oct 8, 2017
ahem, yes, @clepple... it turns out I completely forgot this one...
clepple commentedon Oct 8, 2017
no problem. (Hopefully the next release won't be a year from now :-) )
nutdrv_qx: support USB devices that don't close their replies with a CR
zykh commentedon Sep 10, 2018
moving back to 2.7.5, since a) there is a workaround (zykh@1595a06) that apparently works as expected, and b) this is needed for #616
nutdrv_qx: support USB devices that don't close their replies with a CR
trentbuck commentedon Oct 24, 2022
For the record,
I encountered this bug in nut 2.7.4 on Debian 11 with my UPS, model "UPSONIC IRT-3K 2U". My UPS is about 10 years old. The equivalent current model appears to be https://www.upsonic.com.au/upsonic-esart-rack-or-tower-series-ups/
https://bugs.debian.org/1019624
The fix in nut 2.8.0 (zykh@0e2372b) looks much nicer than mine. I am confident it will fix my problem, but as my UPS is back in production, I won't be able to verify this experimentally for a long time. :-(
Here's my upsc output (inc. make/model):
7 remaining items
Add UPSonic IRT-3K 2U [networkupstools/nut#441]
data/driver.list.in: Add UPSonic IRT-3K 2U [networkupstools#441]
blaa commentedon Aug 31, 2023
BTW, in Armac, the final solution was different. I was forging the \r for a second when finding \0 in the datastream prematurely for Vultech. But in the end, after coercing \0 to '0' the UPS eventually sends \r at the right position and everything seems to work "fine". Just single bit is sent as \0.
This \0 is weird obviously. When finishing on it though, there was not enough status bits to correctly parse response, although those lacking weren't particularly important and could be synthesized as zeroes.
jimklimov commentedon Mar 8, 2024
Note for future, regarding Armac subdriver approach, see:
I am not convinced that devices covered by
armac_command()are the only ones in need of such approach. There were a number of reports (couldn't find them quickly at the moment, but I think they regarded "short read" errors?) which I think could have the same root cause with NUL bytes instead of ASCII zeroes in a bitmap.If so - then possibly this solution should be generalized to all QX reads?..