[Nut-upsdev] [nut-commits] svn commit r975 - in trunk: . docs drivers
Arjen de Korte
nut+devel at de-korte.org
Sat Jun 23 08:23:16 UTC 2007
Arnaud Quette wrote:
>>>> Author: adkorte-guest
>>>> Date: Thu Jun 21 18:58:20 2007
>>>> New Revision: 975
>>>> Add modem control line functions so that we don't have to mess with
>>>> ioctl() calls directly.
>>> excellent, I was thinking about it for some time...
>>> btw, will you also take over converting the other drivers?
>> Sure. Probably later today or tomorrow.
Done. I skipped one driver, mge-utalk.c does something weird with the
> int RTS = TIOCM_RTS;
> upsfd = ser_open(device_path);
> ser_set_speed(upsfd, device_path, B2400);
> /* read command line/conf variable that affect comm. */
> if (testvar ("oldmac"))
> RTS = ~TIOCM_RTS;
Huh? Apparently, if the 'oldmac' parameter is passed to the driver, the
ioctl() command is different. Usually, you have to set the bits that you
want to set/clear with the TIOCMBIS/TIOCMBIC command, but apparently for
this system the meaning is reversed. In that case, this probably should
not be a runtime variable, but a compilation option which then can be
used for all drivers. Now that we have ser_set_control() in 'serial.c',
this should be a piece of cake.
I'm not sure whay and if the above is still needed, so I didn't dig into
that. Anyone interested in checking this out?
> if (dstate_getinfo ("driver.parameter.pollinterval") != NULL)
> pollinterval = atoi (dstate_getinfo ("driver.parameter.pollinterval"));
> pollinterval = 2;
> /* Init serial line */
> ioctl(upsfd, TIOCMBIC, &RTS);
This could be replaced by ser_set_rts(upsfd, 0) if the inversion of
TIOCM_RTS is no longer needed.
I also didn't modify genericups.c that is using TIOCMGET. We might be
able to convert that one too, but I don't think it is worth it. This
would require writing additional functions to send a break and also
means that we have to change the way parameters are passed to the
driver. I don't think this is worth the effort.
Best regards, Arjen
More information about the Nut-upsdev