Displaying 13 results from an estimated 13 matches for "ser_flush_in".
2011 Mar 05
19
[RFC apcsmart V3 00/18] apcsmart driver updates
...() 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.h | 1 +
4 files changed, 510 ins...
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
-
2011 Oct 03
0
patch: Fix [-Wunused-but-set-variable]
...uff)
void SendCmdToSerial(unsigned char *Buff, int Len)
{
- int i, ret ;
+ int i;
unsigned char Tmp[20], Xor ;
Tmp[0] = STX_CHAR ;
@@ -204,9 +204,8 @@ void SendCmdToSerial(unsigned char *Buff
upsdebug_hex(4, "->UPS", Tmp, Len+3) ;
/* flush serial port */
- ret = ser_flush_in(upsfd, "", 0) ; /* empty input buffer */
-
- ret = ser_send_buf(upsfd, Tmp, Len+3) ; /* send data to the UPS */
+ ser_flush_in(upsfd, "", 0) ; /* empty input buffer */
+ ser_send_buf(upsfd, Tmp, Len+3) ; /* send data to the UPS */
}
Index: b/drivers/solis.c
================...
2018 Mar 14
2
Interfacing with Siemens SITOP UPS500S
Hello all,
For an upcoming project I will have to interface with a 24V DC UPS from Siemens (full name: Siemens SITOP UPS500S, manufacturer nr 6EP1933-2EC41).
As this device is not listed in the compatibility list, I will have to write my own driver.
I already found out, that the UPS has a serial-over-USB interface (USB full-speed, 12 MBps), using an FTDI chip.
Over this serial port, it will
2011 Oct 03
2
patch: Replace many usleep and some sleep calls with nanosleep
...NULL);
ser_send_pace(upsfd, UPSDELAY, "%s", timer);
ret = sdok();
@@ -867,7 +869,8 @@ static int sdcmd_ATn(int cnt)
* silent (YMMV);
*/
ser_send_char(upsfd, APC_CMD_GRACEDOWN);
- usleep(UPSDELAY);
+ delay.tv_sec = 0; delay.tv_nsec = UPSDELAY;
+ nanosleep(&delay, NULL);
ser_flush_in(upsfd, IGNCHARS, nut_debug_level);
return 0;
@@ -880,7 +883,8 @@ static int sdcmd_K(int dummy)
upsdebugx(1, "Issuing delayed poweroff");
ser_send_char(upsfd, APC_CMD_SHUTDOWN);
- usleep(CMDLONGDELAY);
+ struct timespec delay = {CMDLONGDELS, CMDLONGDELNS};
+ nanosleep(&delay,...
2008 Nov 06
0
[nut-commits] svn commit r1549 - in trunk: . drivers
...no
> more data left in the input buffer. So flushing the input buffers
> was not guaranteed to work.
This still holds true, a zero length reply doesn't mean there is
nothing more in the input buffer (this might be an empty line with
only a <NL> in it), so we'd better use ser_flush_in() or
ser_flush_io() instead.
Best regards, Arjen
--
Please keep list traffic on the list
2018 Mar 14
0
Interfacing with Siemens SITOP UPS500S
...don't recall any other drivers which parse a continuous stream of data without sending a query command. For a query/response example, ivtscd.c is relatively straightforward to understand.
Given the fixed-length strings and unambiguity of the commands, you might want a loop like the following:
ser_flush_in()
while(!done && !timed_out) {
ser_get_char()
// append to buffer
check for match
check for timeout
}
One thing that may be useful while waiting for hardware is to embed a test harness in the code. We don't have much of a standard for this, but as long as the code doesn...
2006 Jul 24
2
fentonups driver patch for Effekta MHD3000 UPS
...wvolt = 0, voltrange, chrglow = 0, chrgrange;
static int lownorm, highnorm;
+ static void sendcr_and_clear_buf(void)
+ {
+ int ret;
+
+ ret = ser_send(upsfd, "\r");
+
+ usleep(300000);
+
+ if (ret != 1)
+ upslog(LOG_ERR, "sendcr_and_clear_buf: ser_send failed");
+ ser_flush_in(upsfd, "", 0);
+ }
+
/* handle devices which don't give a properly formatted I string */
static int check_mtab2(const char *raw)
{
***************
*** 54,59 ****
--- 68,74 ----
chrglow = mtab2[i].chrglow;
chrgrange = mtab2[i].chrgrange;
cap_upstemp = mtab2[i].has...
2008 Jul 10
2
[PATCH] tripplite driver updates
...if (c == ENDCHAR)
break;
}
do {
ret = ser_get_char(upsfd, &c, SER_WAIT_SEC, SER_WAIT_USEC);
if (ret == -1)
- return -1;
+ goto out;
if (c == IGNCHAR || c == ENDCHAR)
continue;
buf[i++] = c;
} while (c != ENDCHAR && i < len);
buf[i] = '\0';
- ser_flush_in(upsfd, NULL, 0);
- return i;
+ ret = i;
+out:
+ ser_flush_io(upsfd);
+ return ret;
}
static void ups_sync(void)
@@ -301,14 +285,17 @@ void upsdrv_initinfo(void)
int va;
long w, l;
-
/* Detect the UPS or die. */
ups_sync();
- send_cmd(":W\r", w_value, sizeof w_value);
- se...
2009 Aug 14
2
Bestfortress driver, network serial patch for nut-2.0
...sec)
usleep(d_usec);
sent++;
}
return sent;
}
static int upsrecv(char *buf,size_t bufsize,char ec,const char *ic) {
return ser_get_line(upsfd, buf, bufsize - 1, ec, ic,
SER_WAIT_SEC, SER_WAIT_USEC);
}
static int upsflushin(int f,int verbose,const char *ignset) {
return ser_flush_in(upsfd, ignset, verbose);
}
/* read out UPS and store info */
void upsdrv_updateinfo(void) {
char temp[256];
char *p;
int loadva;
int len;
int retry;
int checksum_ok, is_online=1, is_off, low_batt, trimming, boosting;
for (retry = 0; retry < 5; ++retry) {
upsflushin (0, 0, &...
2008 Dec 24
1
Driver removal notification: al175
Hi Kirill,
just to notify you that your al175 driver is being removed from the
NUT tree, as of 2.4.0-pre1.
if you wish to see it entering the tree again, please contact the
Development mailing list to talk about it.
Merry Christmas and happy New Year.
Arnaud
--
Linux / Unix Expert R&D - Eaton - http://www.eaton.com/mgeops
Network UPS Tools (NUT) Project Leader -
2005 Dec 19
0
new(er) SEC driver.
...ld me
"Never assume ...", so we try the different rates to see which works. */
fd = ser_open(port);
for (i=0; i<SEC_NUMBAUDS; i++) {
upsdebugx(SEC_LOG_LOWLEVEL, "Trying to connect at %d baud",baud_rates[i].name);
ser_set_speed(fd, port, baud_rates[i].rate);
ser_flush_in(fd, "", 0); /* drain input */
upsdebugx(SEC_LOG_LOWLEVEL, " sending probing command...");
sec_send(fd, SEC_POLLCMD, SEC_CMD_MFR, tmp, 0);
upsdebugx(SEC_LOG_LOWLEVEL, " reading reply...");
ret = sec_recv(fd, tmp, SEC_SIZE);
if (ret >= -1) /* valid reply */...