Being fed up with the recent frequency of power-outages in our department building I headed off to MSY and picked up a UPS, the KStar BM3150 1500 VA (link). Oddly enough this seems to be an Antipodean-only UPS, as the main Kstar website doesn't list it.
The UPS comes with a USB port, and if you connect it to a computer you'll find that the UPS is recognised as a Lakeview Research product:
lsusbThe UPS comes with a CD which contains a full-fledged Windows collection of software, and a pre-compiled shell-only 32 bit binary (need ia32-libs) which is installed via a shell script which needs modification to run properly on Debian. In other words -- it seems to have linux 'support' as a selling point, but not much more. It's so bad that it's not realistically useful.Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 003: ID 0925:1234 Lakeview Research Bus 002 Device 003: ID 0b95:7720 ASIX Electronics Corp. AX88772 Bus 002 Device 004: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub Bus 002 Device 005: ID 04d9:1603 Holtek Semiconductor, Inc. Keyboard Bus 002 Device 006: ID 0461:4d81 Primax Electronics, Ltddmesg[ 424.292130] usb 1-1.3: new low-speed USB device number 3 using ehci_hcd [ 424.389739] usb 1-1.3: New USB device found, idVendor=0925, idProduct=1234 [ 424.390648] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 424.391553] usb 1-1.3: Product: UPS USB MON V1.4 [ 424.392449] usb 1-1.3: Manufacturer: \xffffffd0\xffffff89\xffffff89 [ 424.397491] hid-generic 0003:0925:1234.0004: hiddev0,hidraw3: USB HID v1.00 Device [\xffffffd0\xffffff89\xffffff89 UPS USB MON V1.4] on usb-0000:00:1a.0-1.3/input0
Googling 0925:124 leads to this post: http://ifireball.wordpress.com/2011/10/13/configuring-aviem-pro2100-ups-on-debian-6-0-stablesqueeze/
The solution below is not particularly elegant -- I compile nut from source to get the udev rules and the richcomm driver, then install the debian nut packages.
cd ~/tmp sudo apt-get install libusb-dev
wget http://www.networkupstools.org/source/2.6/nut-2.6.4.tar.gz tar xvf nut-2.6.4.tar.gz cd nut-2.6.4/ ./configure --with-usb --with-devConfiguration summary: ====================== build serial drivers: yes build USB drivers: yes build SNMP drivers: no build neon based XML driver: no enable Avahi support: no build Powerman PDU client driver: no build IPMI driver: no enable SSL development code: yes enable libwrap (tcp-wrappers) support: no enable libltdl (Libtool dlopen abstraction) support: yes build CGI programs: no enable HAL support: no build and install documentation: no build and install the development files: yesmake sudo make install
Things are installed, but in an non-standard place.
/usr/local/ups/bin/nut-scannerEdit /ect/nut/ups.confScanning USB bus. No start IP, skipping NUT bus (old connect method) [nutdev1] driver = "richcomm_usb" port = "auto" vendorid = "0925" productid = "1234" bus = "001"sudo ln -s /lib/udev/rules.d/52-nut-usbups.rules /etc/udev/rules.d/52-nut-usbups.rules sudo service udev restart sudo apt-get install nut nut-cgi
Edit /etc/nut/nut.conf[kstar] driver=richcomm_usb port=auto desc='kstar'
Edit /etc/nut/upsmon.confMODE=standalone
Edit /etc/nut/upsd.confMONITOR kstar@localhost 1 upsmon myups master
[upsmon] password=myups upsmon masterThen restart the nut server
sudo service nut-server restart ps aux|grep nut
upsc kstarnut 3594 0.0 0.0 16764 592 ? Ss 18:00 0:00 /lib/nut/richcomm_usb -a kstar nut 7179 0.0 0.0 16764 592 ? Ss 18:29 0:00 /lib/nut/richcomm_usb -a kstar nut 7182 0.0 0.0 16900 568 ? Ss 18:29 0:00 /sbin/upsd
device.mfr: Richcomm dry-contact to USB solution device.model: UPS USB MON V1.4 device.serial: unknown device.type: ups driver.name: richcomm_usb driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.version: 2.6.4 driver.version.internal: 0.04 ups.mfr: Richcomm dry-contact to USB solution ups.model: UPS USB MON V1.4 ups.productid: 1234 ups.serial: unknown ups.status: OL ups.vendorid: 0925
Errors:
I'm leaving the various errors here more or less as link-bait. I tried using the NUT in the debian repos, and it gave me nothing than pain.
It's not nicely formatted or anything. Basically, if you see any of the crap below, compile your own version.
./configure --with-drivers=richcomm_usb --with-statepath=/var/run/nut --with-pidpath=/var/run/nut --with-user=nut --with-group=nutConfiguration summary: ====================== build serial drivers: yes build USB drivers: yes build SNMP drivers: no build neon based XML driver: no enable Avahi support: no build Powerman PDU client driver: no build IPMI driver: no build Mac OS X meta-driver: no enable SSL development code: yes enable libwrap (tcp-wrappers) support: no enable libltdl (Libtool dlopen abstraction) support: yes build nut-scanner: yes build CGI programs: no enable HAL support: no build and install documentation: no build and install the development files: no only build specific drivers: richcomm_usbmake sudo make install
Now try to load the driver:
sudo upsdrvctl -u root -D startand it didn't really work. Checking dmesgNetwork UPS Tools - UPS driver controller 2.6.4 0.000000 Starting UPS: kstar Network UPS Tools - Richcomm dry-contact to USB driver 0.04 (2.6.4) Warning: This is an experimental driver. Some features may not function correctly.
[282263.171108] usb 1-1.3: usbfs: interface 0 claimed by usbhid while 'richcomm_usb' sets config #1
and looking at
ls /sys/bus/usb/drivers/usb/1-1.3/ -lahmeans that the device already has a driver loaded, solrwxrwxrwx 1 root root 0 Dec 1 10:09 driver -> ../../../../../../bus/usb/drivers/usb
sudo su echo -n "1-1.3" > /sys/bus/usb/drivers/usb/unbind exit ls /sys/bus/usb/drivers/usb/1-1.3/ -lahsigh...ls: cannot access /sys/bus/usb/drivers/usb/1-1.3/: No such file or directorysudo upsdrvctl -u root -D startNetwork UPS Tools - UPS driver controller 2.6.4 0.000000 Starting UPS: kstar Network UPS Tools - Richcomm dry-contact to USB driver 0.04 (2.6.4) Warning: This is an experimental driver. Some features may not function correctly. Communications with UPS lost: Query to UPS faileddmesg[284116.758107] usb 1-1.3: usbfs: interface 0 claimed by usbfs while 'richcomm_usb' sets config #1 [..] [284155.661271] usb 1-1.3: usbfs: interface 0 claimed by usbfs while 'richcomm_usb' sets config #1 [284155.790409] usb 1-1.3: usbfs: process 17105 (richcomm_usb) did not claim interface 0 before use
ls /sys/bus/usb/drivers/usbfs/ -lahThen try againlrwxrwxrwx 1 root root 0 Dec 4 17:07 1-1.3:1.0 -> ../../../../devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.3/1-1.3:1.0sudo su echo -n "1-1.3:1.0" > /sys/bus/usb/drivers/usbfs/unbind exit
sudo upsdrvctl -u root -D startSo I then didNetwork UPS Tools - UPS driver controller 2.6.4 0.000000 Starting UPS: kstar Network UPS Tools - Richcomm dry-contact to USB driver 0.04 (2.6.4) Warning: This is an experimental driver. Some features may not function correctly. Duplicate driver instance detected! Terminating other driver! Communications with UPS lost: Query to UPS failed
sudo vim /etc/udev/rules.d/70-ignore-ups.rulesIf you get this:ATTRS{idVendor}=="0925", ATTRS{idProduct}=="1234", OPTIONS=="ignore_device"sudo service udev restartStopping the hotplug events dispatcher: udevd. Starting the hotplug events dispatcher: udevd.
sudo upsdrvctl -D startthen you need to make sure to add -u root to upsdrvctl. Also, make sure that the driver versions match.Network UPS Tools - UPS driver controller 2.6.4 0.000000 Starting UPS: kstar Network UPS Tools - Richcomm dry-contact to USB driver 0.04 (2.6.4) Warning: This is an experimental driver. Some features may not function correctly. USB device [0925:1234] matches, but driver callback failed: could not detach kernel driver from interface 0: Operation not permitted 0.004077 Driver failed to start (exit status=1)
Thank you for this.
ReplyDeleteI was able to get my Kstar BM3080 working with FreeNAS (uses NUT) with the Sweex 1000 USB (richcomm_usb) driver. I determined the USB port by watching the console as I plugged it in.
There is a more specific driver that I thought would work, which is the SVEN PowerPro + series. The ID's etc match but FreeNAS doesn't see the UPS.