Форум русскоязычного сообщества Ubuntu


Считаете, что Ubuntu недостаточно дружелюбна к новичкам?
Помогите создать новое Руководство для новичков!

Автор Тема: USB mini-box OpenUPS  (Прочитано 4144 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн onelastfm

  • Автор темы
  • Новичок
  • *
  • Сообщений: 8
    • Просмотр профиля
USB mini-box OpenUPS
« : 05 Октября 2012, 10:52:42 »
Может кто сталкивался с проблемой подключения USB UPS-ов.

Устройство:
mini-box OpenUPS (http://www.mini-box.com/OpenUPS)

Система:
Linux xubuntu 12.04 kernel 3.2.0-23-generic на виртуалке

lsusb(до включения)
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 010: ID 0e0f:0002 VMware, Inc. Virtual USB Hub

lsusb(после)
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 011: ID 04d8:d004 Microchip Technology, Inc.
Bus 001 Device 010: ID 0e0f:0002 VMware, Inc. Virtual USB Hub

lsusb -v
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0        64
  idVendor           0x1d6b Linux Foundation
  idProduct          0x0001 1.1 root hub
  bcdDevice            3.02
  iManufacturer           3 Linux 3.2.0-23-generic uhci_hcd
  iProduct                2 UHCI Host Controller
  iSerial                 1 0000:00:07.2
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0002  1x 2 bytes
        bInterval             255
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             2
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
  bPwrOn2PwrGood        1 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0103 power enable connect
   Port 2: 0000.0107 power suspend enable connect
Device Status:     0x0001
  Self Powered

Bus 001 Device 011: ID 04d8:d004 Microchip Technology, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        32
  idVendor           0x04d8 Microchip Technology, Inc.
  idProduct          0xd004
  bcdDevice            0.03
  iManufacturer           1
  iProduct                2
  iSerial                 4
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     519
         Report Descriptors:
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval              10
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval              10
Device Status:     0x0001
  Self Powered

Bus 001 Device 010: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0         8
  idVendor           0x0e0f VMware, Inc.
  idProduct          0x0002 Virtual USB Hub
  bcdDevice            1.00
  iManufacturer           0
  iProduct                1 VMware Virtual USB Hub
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          1 VMware Virtual USB Hub
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              1 VMware Virtual USB Hub
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0001  1x 1 bytes
        bInterval             255
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             7
  wHubCharacteristic 0x0009
    Per-port power switching
    Per-port overcurrent protection
  bPwrOn2PwrGood       50 * 2 milli seconds
  bHubContrCurrent    100 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xfe
 Hub Port Status:
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
   Port 3: 0000.0100 power
   Port 4: 0000.0100 power
   Port 5: 0000.0100 power
   Port 6: 0000.0100 power
   Port 7: 0000.0100 power
Device Status:     0x0100
  (Bus Powered)

usb-devices
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0001 Rev=03.02
S:  Manufacturer=Linux 3.2.0-23-generic uhci_hcd
S:  Product=UHCI Host Controller
S:  SerialNumber=0000:00:07.2
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  6 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs=  1
P:  Vendor=04d8 ProdID=d004 Rev=00.03
S:  Manufacturer=Mini-Box.Com
S:  Product=OPEN-UPS
S:  SerialNumber=PBSO4-LiFePO
C:  #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid

T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  5 Spd=12  MxCh= 7
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0e0f ProdID=0002 Rev=01.00
S:  Product=VMware Virtual USB Hub
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub

dmesg | tail
[35145.480765] usb 1-1: USB disconnect, device number 8
[35291.057867] usb 1-2: USB disconnect, device number 5
[35302.626827] usb 1-1: new full-speed USB device number 9 using uhci_hcd
[35302.971628] generic-usb: probe of 0003:04D8:D004.0007 failed with error -22         <------------  :-[
[35303.089512] usb 1-2: new full-speed USB device number 10 using uhci_hcd
[35303.493648] hub 1-2:1.0: USB hub found
[35303.524756] hub 1-2:1.0: 7 ports detected
[39788.234956] usb 1-1: USB disconnect, device number 9
[39921.685466] usb 1-1: new full-speed USB device number 11 using uhci_hcd
[39921.862437] generic-usb: probe of 0003:04D8:D004.0008 failed with error -22

Что за ошибка возникает при подключение? Куда дальше копать?
На сайте производителя написано:
OpenUPS has strong Windows / Linux support and API allowing developers to interface to custom applications.

Но пока что-то не удается его подключить.

Оффлайн ilf

  • Новичок
  • *
  • Сообщений: 2
    • Просмотр профиля
Re: USB mini-box OpenUPS
« Ответ #1 : 19 Ноября 2012, 17:53:20 »
Ну что, получилось опен-упс к линуксу прикрутить?

У меня та же проблема. Под Ubuntu из коробки не определяется как батарея, а вывод комманд такой же как у вас.

Пробовал подключить под FreeNAS который построен на FreeBSD и использует NUT с модулем "usbhid-ups" для таких случаев. Однако usbhid-ups не распознаёт это устройство как что-либо совместимое (видимо нужно просить добавить поддержку, или самому подготовить патч и предложить...).

Под FreeNAS OpenUPS выглядит примерно так:

[root@nas ~]# /usr/local/libexec/nut/usbhid-ups -a openups -u root -DDDDD 2> /tmp/log.txt   1>/tmp/log.txt
[root@nas ~]# cat /tmp/log.txt
Network UPS Tools - Generic HID driver 0.37 (2.6.5)                             
USB communication driver 0.31                                                   
device (4146/BA65) (/dev/usb//dev/ugen3.2)                                     
   0.016626     - VendorID: 4146                                               
   0.016691     - ProductID: ba65                                               
   0.016735     - Manufacturer: PRETEC Technology                               
   0.016777     - Product: USB Mass Storage Device                             
   0.016819     - Serial Number: a84599d00fb330                                 
   0.016862     - Bus: /dev/usb                                                 
   0.016903     Trying to match device                                         
   0.016955     Device does not match - skipping                               
   0.017077     Checking device (04D8/D004) (/dev/usb//dev/ugen0.2)             
   0.042359     - VendorID: 04d8                                               
   0.042439     - ProductID: d004                                               
   0.042468     - Manufacturer: Mini-Box.Com                                   
   0.042494     - Product: OPEN-UPS                                             
   0.042520     - Serial Number: PBSO4-LiFePO                                   
   0.042546     - Bus: /dev/usb                                                 
   0.042575     Trying to match device                                         
   0.042614     Device does not match - skipping
   0.042704     Checking device (0000/0000) (/dev/usb//dev/ugen3.1)             
   0.042913     - VendorID: 0000                                               
   0.042944     - ProductID: 0000                                               
   0.042971     - Manufacturer: nVidia                                         
   0.042997     - Product: EHCI root HUB                                       
   0.043024     - Serial Number: unknown                                       
   0.043052     - Bus: /dev/usb                                                 
   0.043086     Trying to match device                                         
   0.043121     Device does not match - skipping                               
   0.043187     Checking device (0000/0000) (/dev/usb//dev/ugen2.1)             
   0.043352     - VendorID: 0000                                               
   0.043383     - ProductID: 0000                                               
   0.043409     - Manufacturer: nVidia                                         
   0.043435     - Product: OHCI root HUB                                       
   0.043462     - Serial Number: unknown                                       
   0.043488     - Bus: /dev/usb                                                 
   0.043513     Trying to match device                                         
   0.043542     Device does not match - skipping                               
   0.043622     Checking device (0000/0000) (/dev/usb//dev/ugen1.1)             
   0.043789     - VendorID: 0000                                               
   0.043828     - ProductID: 0000                                               
   0.043855     - Manufacturer: nVidia                                         
   0.043881     - Product: EHCI root HUB                                       
   0.043908     - Serial Number: unknown                                       
   0.043934     - Bus: /dev/usb                                                 
   0.043960     Trying to match device   
   0.043989     Device does not match - skipping                               
   0.044053     Checking device (0000/0000) (/dev/usb//dev/ugen0.1)             
   0.044217     - VendorID: 0000                                               
   0.044248     - ProductID: 0000                                               
   0.044275     - Manufacturer: nVidia                                         
   0.044301     - Product: OHCI root HUB                                       
   0.044327     - Serial Number: unknown                                       
   0.044353     - Bus: /dev/usb                                                 
   0.044386     Trying to match device                                         
   0.044416     Device does not match - skipping                               
   0.044477     No appropriate HID device found                                 
   0.044528     No matching HID UPS found 
[root@nas ~]#

Пользователь решил продолжить мысль 19 Ноября 2012, 18:08:36:
Вот тут кажется еще кто-то Open-UPS ковыряет: http://www.mail-archive.com/nut-upsdev@lists.alioth.debian.org/msg03296.html
« Последнее редактирование: 19 Ноября 2012, 18:08:36 от ilf »

Оффлайн ilf

  • Новичок
  • *
  • Сообщений: 2
    • Просмотр профиля
Re: USB mini-box OpenUPS
« Ответ #2 : 24 Декабря 2012, 12:53:19 »
Производитель допилил OpenUPS под линукс, правда он по прежнему non-usb-hid т.е. работает только через NUT http://www.networkupstools.org/. UPower (aka DeviceKit-power) по прежнему не видит его, а значит из коробки упс как батарейка в трее (через например Gnome Power Manager) не отображается.

Чтобы NUT увидел OpenUPS нужно обновить флеш в самом OpenUPS до версии 1.4 и использовать NUT с патчем. Для Ubuntu берём отсюда https://launchpad.net/~mini-box.com/+archive/ppa?field.series_filter=precise. Для других дистрибутивов пока что прийдётся брать исходники из данного PPA и собирать у себя локально вручную (но патч закоммичен и в следующих версиях NUT будет по умолчанию, а значит будет доступен и во всех дистрибутивах из коробки).

Я себе из PPA собрал патч (в приложении) и успешно пересобрал для FreeBSD и FreeNAS. Для этого на FreeBSD нужно вытащиить локально порт для NUT, положить данный патч как файл "/usr/ports/sysutils/nut/files/patch-openups" а затем собрать и установить порт коммандами "make clean" и "make install" из-под рута в директории "/usr/ports/sysutils/nut". Для FreeNAS нужно либо пересобрать весь фринас с данным патчем, либо собрать пакет с патчем на совместимой с фринасом фрибсд и перенести его на фринас (я делал так: на фрибсд пересобираем и устанавливаем порт с патчем, настраиваем его как нужно, затем собираем из установленного пакет коммандой "bpkg -B nut", находим пакет /usr/ports/packages/bpkg/nut-2.6.5_1.tbz и копируем на фринас; на фринас проверяем через "df -h" наличие в рут-партиции свободного места, затем перемонтируем раздел в режиме Read/Write коммандой "mount -uw /" и устанавливаем пакет коммандой "pkg_add -i ./nut-2.6.5_1-openups.tbz").

Насчет отображения не-usb-hid УПСов см. вон ту переписку: http://lists.alioth.debian.org/pipermail/nut-upsdev/2009-December/004349.html

 

Страница сгенерирована за 0.023 секунд. Запросов: 22.