Displaying 7 results from an estimated 7 matches for "upsdelay".
2011 Oct 03
2
patch: Replace many usleep and some sleep calls with nanosleep
...pcsmart.c	2011-05-31 13:36:49.000000000 +0300
+++ b/drivers/apcsmart.c	2011-08-17 03:06:07.000000000 +0300
@@ -822,7 +822,7 @@ static int sdcmd_CS(int tval)
 	if (tval & APC_STAT_OL) {
 		upsdebugx(1, "On-line - forcing OB temporarily");
 		ser_send_char(upsfd, 'U');
-		usleep(UPSDELAY);
+		struct timespec delay = {0, UPSDELAY}; nanosleep(&delay, NULL);
 	}
 	return sdcmd_S(tval);
 }
@@ -837,6 +837,7 @@ static int sdcmd_ATn(int cnt)
 	int n = 0, mmax, ret;
 	const char *strval;
 	char timer[4];
+	struct timespec delay;
 
 	mmax = cnt == 2 ? 99 : 999;
 
@@ -853,7 +854,8 @@ sta...
2007 Dec 02
1
Driver bestfcom - Timing problem with Fortress LI1420
...ch, buf[256];
+???????unsigned char ch;
+???????char buf[256];
?
????????/* Check for the Inverter status alarm if pending :
???????? * "\r\n{Inverter: ? ? On}\r\n=>"
@@ -190,10 +191,12 @@
????????????????POLL_ALERT, alert_handler, 0, 20);
?
????????ser_send(upsfd, cmd);
+???????sleep(UPSDELAY);
?
????????/* delete command echo up to \012 but no further */
????????for (ch = '\0'; ch != '\012'; ser_get_char(upsfd, &ch, 0, 10));
?
+???????sleep(UPSDELAY);
????????/* get command response?*/
????????ret = ser_get_line(upsfd, result, resultsize, '\015', "\012&...
2010 Apr 19
1
Patch for the bestfortress driver 0.02
...etry;
+       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))...
2011 Mar 05
19
[RFC apcsmart V3 00/18] apcsmart driver updates
...art.c: add upsdrv_shutdown_advanced() and upsdrv_shutdown_simple()
  drivers/apcsmart.c: adjust upsdrv_shutdown()
  drivers/apcsmart.c: update in-driver help information
  drivers/apcsmart.c: update version and authors
  drivers/apcsmart: remove CMD_IGN_CHARS
  drivers/apcsmart.c: don't overuse UPSDELAY
  drivers/apcsmart.c: add ser_flush_in() in setver_enum() and do_cmd()
  drivers/apcsmart: use STAT_INSTCMD_{HANDLED,FAILED} for sdcmd_*()
 drivers/apcsmart.c |  588 ++++++++++++++++++++++++++++++++++++++++------------
 drivers/apcsmart.h |   82 ++++---
 drivers/dstate.c   |    5 +
 drivers/dstate...
2011 Jan 25
1
[RFC] Updates to ACP smart driver
This patch introduces a handful of new options, I mentioned earlier in:
http://www.mail-archive.com/nut-upsdev at lists.alioth.debian.org/msg02088.html
See the large commit message in the follow-up for the details and rationale.
I realize it's a bit larger diff - so if it's required I can split it into few
smaller ones.
Michal Soltys (1):
  APC smart driver update and new features.
2011 Feb 07
4
[PATCH/RFC v2 0/3] Updates to ACP smart driver
This is 2nd version of the earlier patch featuring a few new features
and fixes to the apcsmart driver, following the remarks in:
http://www.mail-archive.com/nut-upsdev at lists.alioth.debian.org/msg02294.html
Major changes from v1:
- handle battery.charge and battery.runtime checks at main.c level
- handle "immutable but writable" conflict gracefully at driver level
-
2009 Aug 14
2
Bestfortress driver, network serial patch for nut-2.0
...General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
	anything commented is optional
	anything else is mandatory
*/
#include "main.h"
#include "serial.h"
#define UPSDELAY 50000	/* 50 ms delay required for reliable operation */
#define SER_WAIT_SEC	2	/* allow 2.0 sec for ser_get calls */
#define SER_WAIT_USEC	0
#define ENDCHAR		'\r'
#define IGNCHARS	" \n"
#if defined(__sgi) && ! defined(__GNUC__)
#define        inline  __inline
#endif
stat...