[nut-Patches][301285] fentonups: add orvaldi support

nut-patches at alioth.debian.org nut-patches at alioth.debian.org
Mon Jun 18 11:16:26 UTC 2007


Patches item #301285, was opened at 2005-03-21 14:22
>Status: Closed
Priority: 3
Submitted By: Arnaud Quette (aquette)
Assigned to: Carlos Rodrigues (carlosefr-guest)
Summary: fentonups: add orvaldi support 
Category: None
Group: None
>Resolution: Out of Date


Initial Comment:
need to be reworked (might break other models compat?!)

---
	The patch attached to this message adds support for Orvaldi UPS-es to 
fentonups driver. It should be applied to stable nut-2.0.0. Original 
description of communication protocol is also included in pdf file. For 
information about Orvaldi visit http://www.orvaldi.com.pl. The patched driver 
was tested with ORVALDI Rack 1000 and ORVALDI Rack 3000. Probably the 
following models will be supported: ORVALDI 400; ORVALDI 600; ORVALDI 800; 
ORVALDI 1000; ORVALDI 1400; ORVALDI 2000; ORVALDI 3000; ORVALDI Rack 1000; 
ORVALDI Rack 2000; ORVALDI Rack 3000; ORVALDI "10" 1kVA on-line; ORVALDI "10" 
3kVA on-line; ORVALDI "10" 6kVA on-line; ORVALDI "10" 10kVA on-line.
	The following models will NOT be supported: ORVALDI 300PL, ORVALDI 400PL, 
ORVALDI 520PL,  ORVALDI 620PL, ORVALDI 300NV, ORVALDI 400NV, ORVALDI 520NV,  
ORVALDI 620NV - they require special cable, signalling is different.
	Computer is connected to UPS with standard (stright) RS232 cable. 
Communication protocol is very similar to Megatec protocol. However, those  
UPS-es don't support command "I" (although documentation states they do). 
"CT" is not supported either, and there is only one variant of shutdown 
syntax (SxxRyyyy).
	Also, I need to set COM port speed manually to 2400 baud before running the 
driver:
setserial /dev/ttyS0 baud_base 115200 divisor 48 spd_cust

	I think You will not like all of my changes, use my informations as a 
guidelines.

Cheers.
-- 
Artur

filename="orvaldi.diff"

diff -u /root/nut-2.0.0/drivers/fentonups.c drivers/fentonups.c
--- /root/nut-2.0.0/drivers/fentonups.c	2003-12-27 09:30:47.000000000 +0100
+++ drivers/fentonups.c	2005-02-04 08:56:42.847408500 +0100
@@ -155,8 +155,9 @@
 			SER_WAIT_SEC, SER_WAIT_USEC);
 
 		if (ret < 1) {
-			upslogx(LOG_ERR, "Short read during UPS id sequence");
-			continue;
+			upslogx(LOG_ERR, "Short read during UPS id sequence, Orvaldi UPS.");
+			strncpy(temp,"#Orvaldi",SMALLBUF);
+			return xstrdup(temp);
 		}
 
 		if (temp[i] != '#') {
@@ -228,7 +229,10 @@
 
 	/* now add instant command support info */
 	dstate_addcmd("test.battery.start");
-	dstate_addcmd("test.battery.stop");
+
+	if(!strstr(dstate_getinfo("ups.model"),"Orvaldi UPS")) {
+	    dstate_addcmd("test.battery.stop");
+	}
 
 	printf("Detected %s on %s\n", dstate_getinfo("ups.model"), device_path);
 	free(raw);
@@ -388,7 +392,7 @@
 	/* on battery: send S01<cr>, ups will return by itself on utility */
 	/* on line: send S01R0003<cr>, ups will cycle and return soon */
 
-	if (ups_on_line) {
+	if (ups_on_line()) {
 		printf("On line, sending shutdown+return command...\n");
 
 		/* return values below 3 misbehave on some hardware revs */
@@ -397,7 +401,7 @@
 	}
 
 	printf("On battery, sending normal shutdown command...\n");
-	ser_send(upsfd, "S01\r");
+	ser_send(upsfd, "S01R0000\r");
 }
 
 void upsdrv_help(void)
diff -u /root/nut-2.0.0/drivers/fentonups.h drivers/fentonups.h
--- /root/nut-2.0.0/drivers/fentonups.h	2003-10-13 23:26:42.000000000 +0200
+++ drivers/fentonups.h	2005-02-03 11:14:28.000000000 +0100
@@ -81,5 +81,6 @@
 	{ "WELI 500 1.0", "Giant Power", "MT650", 10.6, 3.7, 170, 180, 270, 280, 0 },
 	{ "SMART-UPS       1800VA     T18Q16AG", "Effekta", "MT 2000 RM",
 		50.0, 19.5, 171, 200, 260, 278, 1 },
+	{ "Orvaldi", "Orvaldi", "Orvaldi UPS", 50.0, 3.7, 170, 180, 270, 280, 1 },
 	{ NULL,    NULL,		NULL,  0, 0,   0,   0,   0,   0, 0 }
 };


----------------------------------------------------------------------

>Comment By: Arjen de Korte (adkorte-guest)
Date: 2007-06-18 13:16

Message:
The fentonups driver is obsolete now and has been superseded by the megatec driver.

----------------------------------------------------------------------

Comment By: Arnaud Quette (aquette)
Date: 2005-03-21 14:23

Message:
connecté 
user_id=3002

Missed: also extract the protocol info from the orig mail
(Comms Protocol ORVALDI.pdf)

----------------------------------------------------------------------

You can respond by visiting: 
http://alioth.debian.org/tracker/?func=detail&atid=411544&aid=301285&group_id=30602



More information about the NUT-tracker mailing list