On Fri, 18 May 2007 02:56:44 +0400, Eric S. Raymond <esr at thyrsus.com>
wrote:
> Alexander I. Gordeev <lasaine at lvk.cs.msu.su>:
>> --with-statepath=PATH
>>
>> Change the default location of the state sockets created by the
>> drivers.
>>
>> The NUT_STATEPATH environment variable overrides this at run time.
>>
>> Default is /var/state/ups.
>
> OK, that tells me that creating /var/state/ups and chowning it to nut.nut
> is probably the right thing to do.
>
Yes, sure. I think, you'll also want to install udev and hotplug rules to
setup device permissions automatically as well.
> And in fact that seems to work....
>
> root at snark:/home/esr/svn/nut/trunk/drivers# ./megatec_usb -DDD -x
> vendorid=0665 -x subdriver=agiler -u root auto
> Network UPS Tools 2.1.0 - Megatec protocol driver 1.5.3 [megatec_usb]
> Carlos Rodrigues (c) 2003-2007
>
> Serial-over-USB transport layer for Megatec protocol driver [megatec_usb]
>
> debug level is '3'
> Checking device (0000/0000) (003/001)
> - VendorID: 0000
> - ProductID: 0000
> - Manufacturer: Linux 2.6.17-11-generic ehci_hcd
> - Product: EHCI Host Controller
> - Serial Number: 0000:00:02.2
> - Bus: 003
> Trying to match device
> Device does not match - skipping
> Checking device (0000/0000) (001/001)
> - VendorID: 0000
> - ProductID: 0000
> - Manufacturer: Linux 2.6.17-11-generic ohci_hcd
> - Product: OHCI Host Controller
> - Serial Number: 0000:00:02.0
> - Bus: 001
> Trying to match device
> Device does not match - skipping
> Checking device (0665/5161) (002/002)
> - VendorID: 0665
> - ProductID: 5161
> - Manufacturer: Cypress Semiconductor
> - Product: USB to Serial
> - Serial Number: unknown
> - Bus: 002
> Trying to match device
> Device matches
> failed to claim USB device, trying 2 more time(s)...
> detaching kernel driver from USB device...
> trying again to claim USB device...
> Starting UPS detection process...
> Attempting to detect the UPS...
> Sending "Q1" command...
> Wrong answer to "Q1" command.
> Attempting to detect the UPS...
> Sending "Q1" command...
> "Q1" command successful.
> Attempting to detect the UPS...
> Sending "Q1" command...
> "Q1" command successful.
> Attempting to detect the UPS...
> Sending "Q1" command...
> "Q1" command successful.
> Attempting to detect the UPS...
> Sending "Q1" command...
> "Q1" command successful.
> 1 out of 5 detection attempts failed (minimum failures: 2).
> Asking for UPS information ("I" command)...
> UPS doesn't return any information about itself.
> Megatec protocol UPS detected.
> Asking for UPS power ratings ("F" command)...
> UPS power ratings: #120.0 008 24.00 60.0
> Asking for UPS status ("Q1" command)...
>
Cool! This subdriver was not maintained and tested since November 2006.
Well, it comes from the Andrey Lelikov's patch unchanged. I tried not to
break it but there were many changes made and no chance to test it. And now
it just works :) It is really strange.
At least, some more testing would be great.
Please, install all NUT tools. Typically information flows in NUT setup
like this:
driver -> server (upsd) -> client
So, run upsd and then upsc (the simpliest command-line client) to ensure
that obtained values are correct. You'll need upsd.conf and upsd.users in
the $PREFIX/etc directory for upsd to run. Sample configuration files lie
in the 'conf' directory of sources. They are self-explaining.
Please, write back the results.
> Now, can you tell me how to write an ups.conf that will initialize
> this driver properly at startup time?
Please, update your NUT copy. I've added your device to the list of known
devices. You won't need to specify vendorid and subdriver variables
anymore.
You only need these lines in ups.conf now:
[myups]
driver = megatec_usb
port = auto
After this you can control the driver with upsdrvctl tool:
upsdrvctl start myups
--
Alexander