[Nut-upsdev] Problems with USB-serial converters -- please adviseon code fix
Vadim
nutdev at vadim.ws
Tue May 14 19:43:29 UTC 2013
On Tuesday, May 14, 2013 08:51:11 AM simon-alioth at eazimail.com wrote:
> Hi Vadim,
>
> Have you tried using a UDEV rule (/etc/udev/rules.d) to create a persistent
> state for the port? What I would do is add a persistent rule for the serial
> converter so that it either has a persistent device name, or a persistent
> syslink (e.g. "ups0" could be a symlink to /dev/ttyUSBx).
Hello, yes I have.
That however doesn't fix the problem. When the USB device resets, the filehandle
becomes invalid. The new USB device isn't the same file, symlink or not, so it
needs to be reopened.
Udev helps fix things if the UPS driver restarts, but that doesn't happen
because the driver gets stuck in a loop trying to read from the now invalid
filehandle.
So there are two possible fixes here: make the driver abort, and hope it gets
restarted by systemd or whatever other init system is in place, or make the
driver itself reconnect.
I tried the first option, but so far it's not working well. USB is slow, and it
takes a few seconds for the serial port to start working after the reset,
during which the driver aborts instantly if it tries to open it. So what
results is a series of very quick restarts, until the system decides that
something is wrong and disables the service.
So I'm working on the second. I've been a bit busy with other issues, but I'm
getting back to it now.
More information about the Nut-upsdev
mailing list