-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Allow apc_modbus
instances to monitor several USB devices on the same system
#2790
base: master
Are you sure you want to change the base?
Conversation
…the freed reopen_matcher does not remain in the chain from best_matcher upwards [networkupstools#2609] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…her and reopen_matcher [networkupstools#2609] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…from current_matcher->match_function() [networkupstools#2609] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…etail printout from libusb1.c [networkupstools#2609] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…ommon return codes from matcher methods, like libusb1.c does [networkupstools#2609] Notably, handle active rejection of a candidate device by the matcher properly - go try the next device! Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
…atcher in the list is the old reopen_matcher(), rely on _apc_modbus_create_reopen_matcher() to do the right job [networkupstools#2609] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Will convert to draft for now, according to reports in #2609 some of these changes may be wrong; at least the driver seems to lock up and time out in initial data collection from an actual UPS. Maybe I've got the "matcher" list manipulation wrong, will need to review again. |
❌ Build nut 2.8.2.2712-master failed (commit 7395a2955b by @jimklimov) |
This area proved difficult to debug or troubleshoot for me, especially without a device to poke. I am still not 100% convinced even where the fault lies - NUT driver, or libmodbus standard core, or changes made in the libmodbus rtu_usb branch?.. For now, would have to mark it as a known issue in the upcoming NUT v2.8.3 release and hope someone wraps their head around it to solve in a later release. |
As part of discussion at #2609 an issue was identified, where the driver did not ignore devices actively rejected by a matcher (e.g. one with a different serial number string), and so two drivers tried to manage the same device.
This probably does not solve the main problems of that ticket, but at least gets us one problem less...
Another change is about trying to clean out
reopen_matcher
if we need to free it during reconnection. Original code seemed to assume it was the first one in stack, new code tries to walk the list of known matchers and actually check for it before freeing, and drop the linked list entry.This also brings in the familiar NUT printout of USB device details, e.g. (matching the FTDI Serial-USB chip below, for the lack of actual APC UPS here, with an extra char in Serial field):
Similar match for the correct serial (fails later as a not-modbus device, but that is beside the point):
It should also fix the
_apc_modbus_usb_callback: Failed to match!: Success
reports :)