Hi Jørgen, Oliver and Stuart, I'm not forgetting you... while looking again at bestfortress, I realized I completely missed Jørgen's patch!
2010/4/19 J. Thomsen <[email protected]>: > I could not make the bestfortress driver 0.02 work for my Best Fortress > LI675VA, > so I have made a patch for the driver. > The reason was, that all responses are preceded and terminated by CR LF, but > the driver would discard everything after the first CR > LF. > > The following patch discards everything up to the first LF. > It also adds a debugging feature of displaying the accepted data (level 5 > i.e. -D -D -D -D -D -D) > > /Jørgen Thomsen > > --- nut-2.4.3/drivers/bestfortress.c 2010-02-11 22:43:23.000000000 +0100 > +++ nut-2.4.3j/drivers/bestfortress.c 2010-04-19 12:17:07.929852889 +0200 > @@ -34,7 +34,7 @@ > #endif > > #define DRIVER_NAME "Best Fortress UPS driver" > -#define DRIVER_VERSION "0.02" > +#define DRIVER_VERSION "0.03" > > /* driver description structure */ > upsdrv_info_t upsdrv_info = { > @@ -203,20 +203,26 @@ > int loadva; > int len; > int retry; > + char ch; > > int checksum_ok, is_online=1, is_off, low_batt, trimming, boosting; > > for (retry = 0; retry < 5; ++retry) { > upsflushin (0, 0, "\r "); > upssend ("f\r"); > + while (ser_get_char(upsfd, &ch, 0, UPSDELAY) > 0 && ch != > '\n'); // response starts with \r\n > + temp[2] = 0; > do { > - if (upsrecv (temp+2, sizeof temp - 2, ENDCHAR, > IGNCHARS) <= 0) { > + if ((len = upsrecv (temp+2, sizeof temp - 2, ENDCHAR, > IGNCHARS)) <= 0) { > upsflushin (0, 0, "\r "); > upssend ("f\r"); > + while (ser_get_char(upsfd, &ch, 0, UPSDELAY) > > 0 && ch != '\n'); // response starts with \r\n > } > } while (temp[2] == 0); > > - /*syslog (LOG_DAEMON | LOG_NOTICE,"ups: got '%s'\n", p);*/ > + /* syslog (LOG_DAEMON | LOG_NOTICE,"ups: got %d chars > '%s'\n", len, temp + 2); */ > + > + upsdebugx(5, "data from UPS: len=%d '%s'", len, &temp[2]); > /* status example: > > 000000000001000000000000012201210000001200014500000280600000990025000000000301BE > > 000000000001000000000000012401230000001200014800000280600000990025000000000301B7 I've still not had time to actually get back on the protocol and implementation. All apologies for that: budget restrictions and time constraints are killing me :-( That said, I've updated Jørgen's patch to apply to the current trunk... just to see if things are a bit better. @Jørgen, Oliver and Stuart: would you be kind enough to test the attached patch? I'm not much confident considering the change, and Oliver's specific issue (with a 660 LI)... I've still a small room to address some final things for 2.6.4. So if possible within this timeframe, I'd like to check if we can solve your issues, and improve the situation... Thanks for your help. cheers, Arnaud -- Linux / Unix Expert R&D - Eaton - http://powerquality.eaton.com Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/ Debian Developer - http://www.debian.org Free Software Developer - http://arnaud.quette.free.fr/
bestfortress-JTomsen-AQ.diff
Description: Binary data
_______________________________________________ Nut-upsdev mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev
