Ко мне в руки попал источник бесперебойного питания Powercom IMPERIAL с родным диском. На диске нашлась папка "LINUX" с программным обеспечением upsmon версии 0.92 так же прилагалась инструкция:
Код:
UPSMON FOR LINUX README
upsmon PM1 PM2 PM3
1. upsmon has 3 parameters, PM1、PM2 and PM3
2. PM1: COMPORT => ttyS0 (COM1 of UNIX) or ttyS1 (COM2 of UNIX)
It must include the path when you appoint the parameter PM1 (Ex: /dev/ttyS0)
Please be noted that PM1 must be appointed.
3. PM2: It is for setting the breakout delay time default: 60 sec. If PM2 don’t be appointed, the breakout delay time will be 60 seconds.
4. PM3: It is for setting the UPS shutdown delay time default: 60 sec. If PM3 don’t be appointed, the UPS shutdown delay time will be 60 seconds.
./upsmon /dev/ttyS0 300 60
Note: The Caps is considered different with Low case in UNIX.
Installation step must use root LOGIN:
5. Copy upsmon.tar to /etc directory.
6. use “tar xvf upsmon.tar “ to install software.
7. It will be created a upsmon directory.
8. Change to upsmon directory.
9. Test UPSMON and comport:
Use commend ./upsmon /dev/ttyS0 300 60 ( “./upsmon” must be included when you use this commend)
Means: ./upsmon COM1 300 seconds AC fail count and 60 seconds UPS shutdown delay.
You will see UPS CONNECT OR NO CONNECT UPS in tty1 (ctrl_alt_F1)
If it didn’t connect UPS, you can use the commend “kill PID” to delete the process of UPSMON
Then, use commend ./upsmon /dev/ttyS1 300 60 (“./upsmon” must be included when you use this commend)
Means: ./upsmon COM2 300 seconds AC fail count and 60 seconds UPS shutdown delay.
If it still doesn’t connect, please check the CABLE、 PC and UPS are all be connected correctly.
10. After the connection confirmed, please edit the system setup file rc.local under /etc/rc.d/rc.local and add the following commend to edit rc.local:
/etc/upsmon/upsmon /dev/ttyS0 300 60
or
/etc/upsmon/upsmon /dev/ttyS1 300 60
The system will execute upsmon after restart the computer.
11. You can see the situation of UPS if you use the commend ./upsdisp under directory /etc/upsmon (“./upsmon” must be included when you use this commend)
12. Use CTRL-C, you can exit UPSDISP.
13. The UPS Event Log file save to: /etc/upsmon/PCMYYMM.log.
(PS.The YY is year and the MM is month.)
14. The down file is a shutdown script and you can edit it by yourself.
root@lol-PC:/etc/upsmon# ./upsmon /dev/ttyS0 300 60
Copyright(c) Powercom Co., Ltd., all rights reserved.
UPSMON V0.92 program start!
UPSMON: The UPS serial port use /dev/ttyS0.
UPSMON: Ac Fail count down is seted 300 secs.
UPSMON: UPS shutdown delay time is seted 1 mins and 0 secs.
Check UPS type.....
UPSMON: UPS cann't fount!
UPSMON: Program stop!
UPSMON: Please check the UPS connection and restart the program.
root@lol-PC:/etc/upsmon#
Блок питания с компом соединен USB шнуром (в менеджере устройств виден)
а ttyS0 вроде бы - COM порт. Пробовал sda (вроде sda - это usb?) 1 2 3 - все то же самое - как заставить программу работать?
Проделал вот такую весч:
Скачал с оф сайта (http://www.pcm.ru/support/download/soft/) два файлика: UPSmon_FOR_Linux_USB_English.doc и upsmon_usbv091_linux.tar
Первый (UPSmon_FOR_Linux_USB_English.doc) - ман как ставить:
Код:
Thank you for selecting the PCM UPS. The items, A and B, listed below are the hardware configuration and software installation process, respectively.
A : Firstly please complete the hardware configuration :
1. Plug the UPS into a wall outlet.
2. Connect your PC or peripheral equipments to the UPS.
3. Turn ON the UPS.
4. Then connect USB Cable to the PC and install the software( Procedure B).
B : The software installing procedure is as follows :
1. Firstly please log in as the super-user (root).
2. Copy the floopy files 'upsmon_usbv091.tar' into the system directory '/usr' (or the other directory you prefer).
ex: > mcopy A:upsmon_usbv091.tar /usr
3. Decompress the software 'upsmon_usbv091.tar'.
ex: > tar -xvf upsmon_usbv091.tar
4. Change to the upsmon directory.
ex: > cd upsmon
5. Copy the file "down" to the root directory( It includes the shutdown command).
ex: > cp down /
6. Execute the UPS monitoring software.
ex:> ./upsmon_usb1 Parameter_A Parameter_B Parameter_C
Definition of these parameters :
Parameter_A : AC fail countdown time
Parameter_B : UPS turn OFF delay time
Parameter_C : USB name and path
ex: > ./upsmon_usb1 100 120 /dev/usb/hid/hiddev0
Consider the examples quoted above. The UPS will start to count down 100 seconds when the utility failed. If the delay tim 100 was exhausted, your OS will launch to shutdonw. At the same time, the UPS will automatically start to turn off itself after this period of time 120 sec.
Ну а второй (upsmon_usbv091_linux.tar) - сама прога - но только другая - специально для USB походу.
Сделал все как по написанному, теперь прога на ./upsmon_usb1 120 120 /dev/hiddev0 отвечает так:
root@lol-PC:/usr/upsmon# ./upsmon_usb1 120 120 /dev/hiddev0
2007/02/07 17:10:16 UPSMON_USB V0.9: program start!
2007/02/07 17:10:16 UPSMON_USB V0.9: program start!
Copyright(c) Powercom Co., Ltd., all rights reserved.
UPSMON_USB V0.9 program start!
UPSMON_USB: The UPS USB serial port use (null).
UPSMON_USB: Ac Fail count down is seted 120 seconds.
UPSMON_USB: UPS shutdown delay time is seted 2 minutes and 0 seconds.
hiddev driver version is 1.0.4
HID: vendor 0xd9f product 0x2 version 0x0 applications [1]: ffa00001
HID: bus: 1 devnum: 4 ifnum: 0
UPS HID device name: "POWERCOM CO., LTD. USB to Serial"
root@lol-PC:/usr/upsmon#
А где же gui? А как же узнать заряд батарей всю прочую чуш?
И последнее - если у устройства USB шнур - зачем в коробку положили диск с прогой для COM кабеля - у них глаза во лбу или в попе?
Network UPS Tools - UPS driver controller 2.0.4
Network UPS Tools (version 2.0.4) - APC Smart protocol driver
Driver version 1.99.8, command table version 2.0
Unable to open /dev/hiddev0: Permission denied
Current user id: nut (113)
Serial port owner: root (0)
Serial port group: root (0)
Mode of port: 0660
Things to try:
- Use another port (with the right permissions)
- Fix the port owner/group or permissions on this port
- Run this driver as another user (upsdrvctl -u or 'user=...' in ups.conf).
See upsdrvctl(8) and ups.conf(5).
Fatal error: unusable configuration
Driver failed to start (exit status=1)
Current user id: nut (113)
Serial port owner: root (0)
Serial port group: root (0)
Mode of port: 0660
Причина ошибки выделена. Это неверные права доступа к устройству. Вам нужно соответственно их изменить.
Скорее всего придется редактировать правила udev
Current user id: nut (113)
Serial port owner: root (0)
Serial port group: root (0)
Mode of port: 0660
Причина ошибки выделена. Это неверные права доступа к устройству. Вам нужно соответственно их изменить.
Скорее всего придется редактировать правила udev
Похоже все дело было в драйвере который прописывается в ups.conf. Все драйвера лежат в папке /lib/nut - перебрал все - и на всех кроме одного вылетали разного рода ошибки.
Warning: This is an experimental driver.
Some features may not function correctly.
debug level is '1'
/dev/bus/usb/002/002 is not a UPS
В листе рассылки нарыл вот такое:
I bought an UPS Powercom BNT-600AP. It's compatible
in NUT with driver powercom and protocol type KIN1500AP.
But I have a simple problem: the 'upsc' shows wrong values in
battery.charge
I bought an UPS Powercom BNT-600AP. It's compatible
in NUT with driver powercom and protocol type KIN1500AP.
But I have a simple problem: the 'upsc' shows wrong values in
battery.charge
То есть судя по всему, запустить таки удалось.
"and protocol type KIN1500AP" - этот протокол KIN1500AP надо прописывать в какой то конфиг?
[ups]
driver = powercom -u root
desc = "PCM ups"
port = /dev/bus/usb/002/002
type = KIN1500AP
Цитата из man powercom
type=name
The exact type of the communication protocol within the powercom family, that will be used to communi‐
cate with the UPS. The type is named after the first modelname that was coded with that protocol. The
acceptable names are KP625AP, Trust, KIN2200AP, Egys, KIN525AP or KIN1500AP. The default is Trust.
Вот нашел вот такой драйвер:...
Это не драйвер, это man page Для nut-драйвера powercom. Ее можно посмотреть, если в командной строке набрать man powercom
powercom драйвер входит в состав пакета nut. у меня он находится в /lib/nut/powercom
USB драйвера Powercom действительно нет. Можно конечно использовать переходник USB<->COM, но в связи с тем что мне ответили на форуме производителя я не стал торопиться покупать перехдник:
Работа над новым софтом идет и уже давно... ожидается выход в свет нового софта достаточно скоро (там бфдует софт с GUI)
Упс! На форуме так же сказали: что все зависит от того как скоро в ядре реализуют поддержку usage tables for Power Devices. Кто нибудь слышал об этой штуке? Что это такое и когда ее реализуют и реализуют ли вообще?