-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mge-shut 0.86 can't deal with serial lines #2022
Comments
Just in case, can you build the current sources and check from that build workspace (no need to break your packaged installation)? Wondering if the problem was solved by something that landed during the past year since 2.8.0... |
A bit surprised to see
the But this was mostly tested with For example:
...or rather when actually starting a driver:
|
I built from commit 3d9630e and sadly there are no good news to report:
Not happy with this I tried to compile the program again, this time disabling usb support.
Surprisingly upsdrvctl still tries to manage /dev/ttyS5 as an Usb device. |
Huh, got the problem now. Looked at it and missed, seeing USB-ish identifiers in the dump from 2.7.4 driver with serial code-path and remembering how those devices are sort of dual-protocol internally. |
So that could be some fallout from #300 (IIRC) adding support for libusb1.x and reshuffling lots of code around it. |
If you need more tests just drop a line here :-) |
Preliminary guess is that something went awry with past refactoring that could impact Another idea could be that this is some fallout from stricter types used (e.g. Otherwise, Finally, noting that "SHUT" stands for "Serial HID UPS Transfer" - hence the codebase shared with native USB access. Same HID model over USB or Serial wiring and signalling. |
Ok, so at least trying to report the usb driver version in non-usb mode was a rather cosmetic bug (message was posted outside the ifdef picking SHUT vs. USB builds), the subsequent |
Another note: the report lengths returned are:
so wondering if some bytes get mixed up, e.g. if |
In fact there is a change here (IIRC due to compiler complaints about casting - so was simplified), gotta check if ultimately benign or not, in
Equivalents in
|
Assuming this is the problem and trying to explain it to myself, I can only guess that the original expectation was that we take a What I guess does happen is that in fact it casts right in memory, so sees the neighboring byte, and shifts 8'th Also wondering if it would be safer to multiply and add in such cases where we want to turn wire bytes into CPU integers, and not go bitwise and shifting, to be surely CPU agnostic :\ <== CC @aquette @clepple WDYT? |
…rts [networkupstools#2022] Signed-off-by: Jim Klimov <[email protected]>
…USB-connected UPS with library..." when not in SHUT_MODE [networkupstools#2022] Signed-off-by: Jim Klimov <[email protected]>
Signed-off-by: Jim Klimov <[email protected]>
…differently (closer to what libusbX.c do and NUT v2.7.4 did); bump driver version [networkupstools#2022] Signed-off-by: Jim Klimov <[email protected]>
Gave it an exploratory shot, can you please check out https://github.com/jimklimov/nut/tree/issue-2022 and build similarly to what you tested recently? In that same workspace you can:
I believe it should pick up your older configuration and rebuild it... If not - retry according to official instructions :D |
If the types and casting aren't correct, it won't matter whether you multiply or shift. I think the actual problem has to do with not packing this struct: struct my_hid_descriptor {
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t bcdHID;
uint8_t bCountryCode;
uint8_t bNumDescriptors;
uint8_t bReportDescriptorType;
uint16_t wDescriptorLength;
}; I suspect the compiler is inserting a padding byte before I think the real solution is not to alias the struct to the buffer, though I haven't looked too far to see what else that would break. |
You fixed it!!!
Thank you very much for the quickest fix ever seen by me on github.com! Bye |
CC @bigon for Debian (AFAIK) |
…rts [networkupstools#2022] Signed-off-by: Jim Klimov <[email protected]> Signed-off-by: Alex W Baulé <[email protected]>
…USB-connected UPS with library..." when not in SHUT_MODE [networkupstools#2022] Signed-off-by: Jim Klimov <[email protected]> Signed-off-by: Alex W Baulé <[email protected]>
Signed-off-by: Jim Klimov <[email protected]> Signed-off-by: Alex W Baulé <[email protected]>
…differently (closer to what libusbX.c do and NUT v2.7.4 did); bump driver version [networkupstools#2022] Signed-off-by: Jim Klimov <[email protected]> Signed-off-by: Alex W Baulé <[email protected]>
FWIW, |
@mdonz is it possible to test 2.8.1 from Debian testing/unstable? https://packages.debian.org/search?keywords=nut That might be useful for requesting a backport in Debian. |
Thanks for your reply. I have done and hope that I did it the right way. Did not want to enable the testing repository and downloaded the required packages and install manually, version 2.8.1-1: From systemctl status: Also: Should I be worried at this stage about the (new to me) mge-shut originating messages/warnings? |
Hello,
since I upgraded from 2.7.4 to 2.8.0, nut stopped working with Eaton 5P. Actually I moved from Debian Buster to Bookwork (amd64).
This is my (unmodified) definition in ups.conf:
Running upsdrvctl shows mge-shut is trying to operate on the serial line the same way as it use to do for an Usb device. At least this is my guess.
As a workaround I simply copied the old 0.85 binary driver from Buster to Bookworm. And the results were great!
I hope this can be useful for anyone meantime you fix the bug.
Thank you very much for your efforts!
The text was updated successfully, but these errors were encountered: