search for: ser_send

Displaying 9 results from an estimated 9 matches for "ser_send".

2006 May 12
1
Fwd: RE New xanto driver for NUT
Dear Andreas, some googling revealed, you created a driver for the xanto series of online-usv.de. In what state it is currently? I've to manage a S2000 and would like to use nut for it, is it usable by now? Do you need another tester? TIA, Pete
2006 Jul 24
2
fentonups driver patch for Effekta MHD3000 UPS
...** *** 30,38 **** --- 30,52 ---- #define DRV_VERSION "1.22" static int cap_upstemp = 0; + static int is_online = 0; static float lowvolt = 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 *ra...
2006 Nov 26
1
Patch for optiups to support Zinto D from ONLINE USV-Systeme AG
...t;READ: <unsupported command>"); } + if ( _buf[0] == 0x06 ) + { + upsdebugx(2, "READ: <command done>"); + } else { upsdebugx(2, "READ: \"%s\"", _buf ); @@ -125,6 +141,7 @@ { upsdebugx(2, "SEND: \"%s\"", cmd ); ser_send( upsfd, cmd ); + if ( testvar(OPTI_ZINTO) ) ser_send( upsfd, "\r\n" ); return optireadline(); } @@ -179,12 +196,26 @@ { /* You do realize this will kill power to ourself. Would probably only * be useful for killing power for a slave computer */ + if ( testvar(OPTI_ZINTO)...
2011 Oct 03
2
patch: Replace many usleep and some sleep calls with nanosleep
...e ENDCHAR '\r' #define IGNCHARS "\n" -#define UPS_DELAY 150000 -#define UPS_LONG_DELAY 450000 +#define UPS_DELAY 150e6 +#define UPS_LONG_DELAY 450e6 #define VICTRON_OVER 128 #define VICTRON_RB 1 @@ -86,7 +86,7 @@ static int get_data (const char *out_str { int ret_code; ser_send(upsfd, "%s%c", out_string, ENDCHAR); - usleep (UPS_DELAY); + struct timespec delay = {0, UPS_DELAY}; nanosleep(&delay, NULL); ret_code = ser_get_line(upsfd, in_string, LENGTH_TEMP, ENDCHAR, IGNCHARS, 3, 0); if (ret_code < 1) { @@ -498,7 +498,7 @@ void upsdrv_u...
2006 Jan 27
0
[PATCH] fentonups patch to make it work with some powercom ups's
...+ + int dtr_bit = TIOCM_DTR|0x4000; + ioctl(upsfd, TIOCMSET, &dtr_bit); +} + void upsdrv_initinfo(void) { int modelnum, i, ret; char temp[256], model[32], *raw; + if (testvar("powercom")) { + set_powercom_lines(); +// straced from powercom's upsmon (reset?) + ret = ser_send(upsfd, "%c%c%c%c%c\r", 1, 2, 2, 3, 5); + ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, "", + SER_WAIT_SEC, SER_WAIT_USEC); + } raw = get_id(); if (!raw) @@ -426,6 +445,7 @@ void upsdrv_help(void) void upsdrv_makevartable(void) { addvar(VAR_VALUE, "l...
2006 Apr 26
1
RE nut 2.0 fentonups and Xanto S3000R
...intf("Detected %s on %s\n", dstate_getinfo("ups.model"), device_path); - free(raw); + if (raw) + free(raw); /* paranoia - cancel any shutdown that might already be running */ ret = ser_send(upsfd, "C\r"); @@ -406,6 +425,7 @@ void upsdrv_help(void) void upsdrv_makevartable(void) { + addvar(VAR_VALUE, "model", "force model"); } void upsdrv_banner(void) $OpenBSD$ --- drivers/fentonups.h.orig Tue Apr 25 23:32:16 2006 +++ dri...
2007 Dec 02
1
Driver bestfcom - Timing problem with Fortress LI1420
...ze) ?{ ????????int ret; -???????char 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, res...
2008 Jul 10
2
[PATCH] tripplite driver updates
...; return strtol(buf, NULL, 16); } @@ -159,34 +141,36 @@ static int hex2d(char *start, unsigned i * return: # of chars in buf, excluding terminating \0 */ static int send_cmd(const char *str, char *buf, size_t len) { - char c; - int ret; + unsigned char c; + int ret = 0; size_t i = 0; ser_send(upsfd, str); if (!len || !buf) - return -1; + goto out; for (;;) { ret = ser_get_char(upsfd, &c, SER_WAIT_SEC, SER_WAIT_USEC); if (ret == -1) - return -1; + goto out; if (c == ENDCHAR) break; } do { ret = ser_get_char(upsfd, &c, SER_WAIT_SEC, SER_WAIT_USEC)...
2008 Aug 15
2
Problem with APC and Fedora 8 I86_64
...oup=nut --with-usb --with-cgi --with-hal --with-drivers=apcsmart,usbhid-ups > ../configure.txt [root at localhost nut-2.2.2]# make > ../make.txt dstate.c: In function ?send_to_all?: dstate.c:182: warning: format ?%d? expects type ?int?, but argument 3 has type ?size_t? serial.c: In function ?ser_send_pace?: serial.c:259: warning: format ?%d? expects type ?int?, but argument 3 has type ?long unsigned int? serial.c: In function ?ser_send?: serial.c:289: warning: format ?%d? expects type ?int?, but argument 3 has type ?long unsigned int? serial.c: In function ?ser_comm_fail?: serial.c:511: warning...