OpenWrt 22.03.2 on Linksys EA8300 + APC BAck-UPS CS500 - NUT not working

Hello all,
I'm not able to connect to my USB UPS APC CS500.

~# upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
No matching HID UPS found
Driver failed to start (exit status=1)


# /lib/nut/usbhid-ups -a ups -DDD
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
   0.000000     debug level is '3'
   0.001842     upsdrv_initups...
   0.011288     Checking device (1D6B/0003) (002/001)
   0.012346     - VendorID: 1d6b
   0.012410     - ProductID: 0003
   0.012452     - Manufacturer: Linux 5.10.146 xhci-hcd
   0.012493     - Product: xHCI Host Controller
   0.012532     - Serial Number: xhci-hcd.0.auto
   0.012571     - Bus: 002
   0.012606     - Device release number: 0510
   0.012639     Trying to match device
   0.014317     Device does not match - skipping
   0.014530     Checking device (1D6B/0003) (004/001)
   0.015358     - VendorID: 1d6b
   0.015424     - ProductID: 0003
   0.015465     - Manufacturer: Linux 5.10.146 xhci-hcd
   0.015504     - Product: xHCI Host Controller
   0.015545     - Serial Number: xhci-hcd.1.auto
   0.015579     - Bus: 004
   0.015618     - Device release number: 0510
   0.015655     Trying to match device
   0.015705     Device does not match - skipping
   0.015792     Checking device (051D/0002) (001/002)
   0.087047     - VendorID: 051d
   0.087241     - ProductID: 0002
   0.087364     - Manufacturer: American Power Conversion
   0.087501     - Product: Back-UPS CS 500 FW:808.q8.I USB FW:q8
   0.087628     - Serial Number: 8B0709R10433
   0.087764     - Bus: 001
   0.087878     - Device release number: 0006
   0.087985     Trying to match device
   0.088213     Device matches
   0.088583     nut_usb_set_altinterface: skipped usb_set_altinterface(udev, 0)
   0.102403     HID descriptor, method 1: (9 bytes) => 09 21 10 01 21 01 22 c0 04
   0.102587     HID descriptor length (method 1) 1216
   0.102815     HID descriptor, method 2: (9 bytes) => 09 21 10 01 21 01 22 c0 04
   0.102963     HID descriptor length (method 2) 1216
   0.103099     HID descriptor length 1216
   0.137717     Unable to get Report descriptor: I/O error
   0.139101     Checking device (1D6B/0002) (001/001)
   0.148865     - VendorID: 1d6b
   0.149546     - ProductID: 0002
   0.150078     - Manufacturer: Linux 5.10.146 xhci-hcd
   0.150706     - Product: xHCI Host Controller
   0.151249     - Serial Number: xhci-hcd.0.auto
   0.151781     - Bus: 001
   0.152343     - Device release number: 0510
   0.152859     Trying to match device
   0.153474     Device does not match - skipping
   0.154770     Checking device (1D6B/0002) (003/001)
   0.157992     - VendorID: 1d6b
   0.158053     - ProductID: 0002
   0.158089     - Manufacturer: Linux 5.10.146 xhci-hcd
   0.158126     - Product: xHCI Host Controller
   0.158167     - Serial Number: xhci-hcd.1.auto
   0.158211     - Bus: 003
   0.158246     - Device release number: 0510
   0.158284     Trying to match device
   0.158332     Device does not match - skipping
   0.158410     No appropriate HID device found
   0.158460     No matching HID UPS found


# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux 5.10.146 xhci-hcd xHCI Host Controller
Bus 004 Device 001: ID 1d6b:0003 Linux 5.10.146 xhci-hcd xHCI Host Controller
Bus 001 Device 002: ID 051d:0002 American Power Conversion Back-UPS CS 500 FW:808.q8.I USB FW:q8
Bus 001 Device 001: ID 1d6b:0002 Linux 5.10.146 xhci-hcd xHCI Host Controller
Bus 003 Device 001: ID 1d6b:0002 Linux 5.10.146 xhci-hcd xHCI Host Controller


# lsusb -v
Bus 001 Device 002: ID 051d:0002 American Power Conversion Back-UPS CS 500 FW:808.q8.I USB FW:q8
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x051d
  idProduct          0x0002
  bcdDevice            0.06
  iManufacturer           3 American Power Conversion
  iProduct                1 Back-UPS CS 500 FW:808.q8.I USB FW:q8
  iSerial                 2 8B0709R10433
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0022
    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         3
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode           33 US
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength    1216
          Report Descriptor: (length is -1)
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0006  1x 6 bytes
        bInterval             100
Device Status:     0x0001
  Self Powered

Any ideas what could be wrong?
I've changed the router (from TP-Link), just to be able to talk to my UPS but no joy again :frowning:

Cheers,
Alex

Probably this.

Indeed - not seeing the specific model on

Possibly you’ll need apcupsdusb or generic-usb driver (if actually supported)?

Back-UPS CS is listed on NUT website and the driver is usbhid-ups.

Depending on use case, apcupsd might be the better choice here.

Perhaps this could help, same device ID Connected UPS with NUT (network ups tools) package: usb problem after reinstall

I've tried this one as well, but it also can't connect:

2022-10-28 08:48:33 apctest 3.14.14 (31 May 2016) unknown
Checking configuration ...
sharenet.type = Network & ShareUPS Disabled
cable.type = USB Cable
mode.type = USB UPS Driver
Setting up the port ...
apctest FATAL ERROR in apctest.c at line 319
Unable to open UPS device.
  If apcupsd or apctest is already running,
  please stop it and run this program again.
apctest error termination completed

this might be a nut clash, make sure it's stopped.

All stopped, the only thing NUT related I see is the usb device file:

ll  /dev/bus/usb/002/001
crw-------    1 nut      nut       189, 128 Oct 28 00:05 /dev/bus/usb/002/001

Also in apcupsd config I've tried different config options for ups cable, etc.

Could it be something generic on OpenWRT and the USB controller?

Here's the output of lsusb again:

# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux 5.10.146 xhci-hcd xHCI Host Controller
Bus 004 Device 001: ID 1d6b:0003 Linux 5.10.146 xhci-hcd xHCI Host Controller
Bus 001 Device 002: ID 051d:0002 American Power Conversion Back-UPS CS 500 FW:808.q8.I USB FW:q8
Bus 001 Device 001: ID 1d6b:0002 Linux 5.10.146 xhci-hcd xHCI Host Controller
Bus 003 Device 001: ID 1d6b:0002 Linux 5.10.146 xhci-hcd xHCI Host Controller

After reboot I also see the following:

root# dmesg | grep -i usb
[    0.046727] usbcore: registered new interface driver usbfs
[    0.046797] usbcore: registered new interface driver hub
[    0.046857] usbcore: registered new device driver usb
[    0.482050] tcsr 194b000.tcsr: setting usb hs phy mode select = e700e7
[    4.821413] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    4.843572] hub 1-0:1.0: USB hub found
[    4.856552] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
[    4.861895] xhci-hcd xhci-hcd.0.auto: Host supports USB 3.0 SuperSpeed
[    4.872035] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    4.876565] hub 2-0:1.0: USB hub found
[    4.891928] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 3
[    4.914963] hub 3-0:1.0: USB hub found
[    4.928006] xhci-hcd xhci-hcd.1.auto: new USB bus registered, assigned bus number 4
[    4.933330] xhci-hcd xhci-hcd.1.auto: Host supports USB 3.0 SuperSpeed
[    4.941847] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[    4.947990] hub 4-0:1.0: USB hub found
[    5.138938] usb 1-1: new low-speed USB device number 2 using xhci-hcd
[   12.442179] usbhid 1-1:1.0: can't add hid device: -71
[   12.442272] usbhid: probe of 1-1:1.0 failed with error -71
[   12.446409] usbcore: registered new interface driver usbhid
[   12.451697] usbhid: USB HID core driver
[   27.994233] usbhid 1-1:1.0: can't add hid device: -71
[   27.994313] usbhid: probe of 1-1:1.0 failed with error -71
[   43.170937] usbhid 1-1:1.0: can't add hid device: -71
[   43.171034] usbhid: probe of 1-1:1.0 failed with error -71
[   58.353415] usbhid 1-1:1.0: can't add hid device: -71
[   58.353508] usbhid: probe of 1-1:1.0 failed with error -71
[   75.837994] usbhid 1-1:1.0: can't add hid device: -71
[   75.838087] usbhid: probe of 1-1:1.0 failed with error -71

What does it mean?

usbhid 1-1:1.0: can't add hid device: -71

Indeed - apologies for causing confusion.
User report is here;

Wondering if this may be a USB version issue.

@alexo : this came to mind :
[OpenWrt Wiki] Installing and troubleshooting USB Drivers
Seems to be sometimes issues with USB drivers

I'll swap the cable and the UPS to test with different hardware.

I think the problem/solution needs to come from this output:

can't get debug descriptor: Resource temporarily unavailable
**Device Status:     0x0001**
  Self Powered

and then the device is not covered by any driver now:

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=1.5  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=051d ProdID=0002 Rev= 0.06
S:  Manufacturer=American Power Conversion
S:  Product=Back-UPS CS 500 FW:808.q8.I USB FW:q8
S:  SerialNumber=8B0709R10433
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 ***Driver=(none)***
E:  Ad=81(I) Atr=03(Int.) MxPS=   6 Ivl=100ms