[Nut-upsdev] Powercom Imperial/Black Knight USB support for NUT

Arnaud Quette aquette.dev at gmail.com
Tue Oct 21 20:06:40 UTC 2008


2008/10/18 Sergiy Yegorov <prapor at unixzone.org.ua>:
> Dear Arnaud!

Hi Sergiy and Alexey,

> Please, check this patch. It adds USB-attached Powercom UPS Imperial &
> Black Knight series. Originaly code is writed by Kirill Burdin
> (burdin at post.ru) for Imperial UPS`es.
> I`m just sysadmin without enought C programming
> skills, so I adapted it to nut-2.2.2-6 (Lenny) & test it with BNT devices.

not that bad for a sysadmin ;-)

there was just 1 big mistake:
+    if (types[type].name != "USB") {

that would work in C++ (using the String class), but not in C.
here, you're comparing if 2 memory pointers are different!
that will always be true (someone there to calculate the
probability?), so the case that interest you (USB) will always work.
but not anymore with other models ;-)

the right version is:
    if (strcmp(types[type].name, "USB")) {

quickly looking at the powercom code in the trunk, there has been some
changes around.
@Alexey: can you please have a look at the patch and get it in shape
for merging?
there also miss an update to the manpage and the drivers.list.

> It`s realy works as expected and I have no problems with it. My friends
> use it with other distributions (mostly - CentOS/RHEL) and also have no problems.
> Currently available powercom driver is not workable with USB-attached devices.

just to be sure, for other users: what is the name of the port you've
indicated in ups.conf (my guess is ttyUSB0 since the powercom driver
has no real USB support)?

> For example:
> /var/log/daemon.log message with original:
> Oct 18 23:20:11 main powercom[10312]: data receiving error
> (-1 instead of 16 bytes)
> /var/log/daemon.log message with patched:
> Oct 18 23:20:52 main powercom[4551]: Startup successful

that suits me fine.
for the sake of completeness, can you also post back an upsc output,
and report if you have tested the low battery condition?

> P.S. Excuse me my bad English.

still, not that bad... for a sysadmin ;-p

thanks,
Arnaud
-- 
Linux / Unix Expert R&D - MGE Office Protection Systems - http://www.mgeops.com
Network UPS Tools (NUT) Project Leader - http://www.networkupstools.org/
Debian Developer - http://people.debian.org/~aquette/
Free Software Developer - http://arnaud.quette.free.fr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: powercom.diff.gz
Type: application/x-gzip
Size: 1380 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20081021/dd404fcb/attachment.bin 


More information about the Nut-upsdev mailing list