Network UPS Tools (NUT) on TPLINK Archer C7 v4 using LEDE 18.06.0

My hardware device is a TP-Link AC1750 Archer C7 v4 router.

I have just flashed it withOpenWRT and the image I used is: archer-c7-v4-squashfs-sysupgrade.bin

Did try to install nut (2.7.4-7). I noticed that it cannot detect the USB device because lsusb does not work so I installed all USB modules described on this page: https://wiki.openwrt.org/doc/howto/usb.essentials

The lsusb command returned a reading on the Cyber Power device. However, I am seeing that after lsusb -v -d 0764:0501, it cannot read the serial number from the connected Cyber Power UPS on its USB port. Below is a snapshot of the error.

image

USB device status is:
image

Also, I noticed that upon bootup, the upsd did not run automatically. Plus I am seeing stale data messages when I tried to query/poll status from the UPS.

Here is what is installed in my router:
image

Thanks in advance.

Regards,
Jag

This might help. Fortunately a new release is likely coming soon with these fixes (by a stroke of luck in sense) carried along. https://github.com/openwrt/packages/issues/6644

Thank you very much for the immediate response.

I will wait for the update, install, test and then provide feedback.

FYI, the issue mentioned has a copy of the needed script to get things working even before update ,and pointers to the new documentation (as configuration has changed, which I think bit you) on the wiki.

Hi Daniel,

First, just want to thank you again for sharing a lot! Would like to apologize for another long response as I intended to save time for further questions on details.

Second, regarding the next steps here is what I did to my router yesterday:

  1. Started from scratch by re-flashing OpenWRT 18.06.0 as I wanted to ensure that any manual changes I made will NOT affect the router.

  2. Installed the following packages:

    • nut
    • nut-common
    • nut-server
    • nut-upsmon
    • nut-upsc
    • nut-upslog
    • nut-web-cgi
    • nut-driver-usbhid-ups (driver)
  3. Configured /etc/config/nut_server:

config driver 'CP37'
        option driver usbhid-ups
        option port auto
        option serial CRNGV2000037 
        option pollinterval 15

config user
        option username nut
        option password passwd
	option upsmon master

config listen_address
	option address ::1
	option port 3493

config upsd 'upsd'
	option maxage 25
	option statepath /var/run/nut
  1. Configured /etc/config/nut_monitor:
config upsmon 'upsmon'
        option runas nut
	option minsupplies 1
        option shutdowncmd "date >> shutdown.msg" 
	option pollfreq 5
	option pollfreqalert 5
 	option hostsync 15
	option deadtime 25
	option powerdownflags /var/run/killpower
	option finaldelay 15 # final delay

config master
	option upsname CP37
	option hostname localhost
	option port 3493 # optional port number
	option powervalue 1
        option username nut
        option password passwd
  1. Overwritten contents of /etc/init.d/nut-monitor with script from: https://github.com/openwrt/packages/issues/6644.

  2. Installed usbutils which I think is needed to run lsusb. However, after installation running lsusb did not list my USB devices. Instead I get this message: unable to initialize libusb: -99.

  3. Installed kmod-usb2 and performed insmod ehci-hcd. After this, all USB devices are detected:

root@TPLINKAC1750:~# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  1. Adjusted MAXAGE, DEADTIME and pollinterval as suggested by this article to avoid stale data in reading from Cyber Power UPSes: https://nmaggioni.xyz/2017/03/14/NUT-CyberPower-UPS/#NUT-Settings. These values are reflected in the config files in #3 and #4.

  2. Performed a reboot.

OBSERVATIONS

  1. upsd still does not automatically run. However, after executing upsd, I can now see data from UPS.

  2. Here is the list of processes running after starting upsd:

root@TPLINKAC1750:~# ps | egrep "nut|ups"
 1087 root      1364 S    /lib/nut/usbhid-ups -a CP37
 1091 root      1316 S    /bin/sh /etc/rc.common /etc/init.d/nut-server running
 1161 root      1024 S    /usr/sbin/upsmon
 1163 nut       1024 S    /usr/sbin/upsmon
 1867 root       976 S    upsd
 1975 root      1200 S    egrep nut|ups

I tried to compare the running processes for NUT on a Raspberry Pi and here is what I saw:

root@pmd:~# ps aux | grep nut
nut        524  0.7  0.3   2632  1572 ?        Ss   09:47   0:00 /lib/nut/usbhid-ups -a apc
nut        530  0.0  0.3   2632  1572 ?        Ss   09:47   0:00 /lib/nut/usbhid-ups -a cpdurant
nut        539  0.0  0.4   4868  1892 ?        Ss   09:47   0:00 /lib/nut/upsd
root       543  0.0  0.4   4896  2224 ?        Ss   09:47   0:00 /lib/nut/upsmon
nut        544  0.0  0.8   6332  4004 ?        S    09:47   0:00 /lib/nut/upsmon
root      1170  0.0  0.4   4268  1880 pts/0    S+   09:49   0:00 grep nut

It seems that the usbhid-ups needs to be run as user nut for my router. Thus, Observation #3.

  1. I cannot issue a force shutdown command. Here is what happens when I execute /lib/nut/usbhid-ups -a CP37 -k -DD
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33
   0.000000	debug level is '2'
   0.001459	upsdrv_initups...
   0.004717	Checking device (1D6B/0002) (001/001)
   0.006026	- VendorID: 1d6b
   0.006461	- ProductID: 0002
   0.007078	- Manufacturer: Linux 4.9.111 ehci_hcd
   0.007696	- Product: EHCI Host Controller
   0.008078	- Serial Number: ehci-platform.0
   0.008460	- Bus: 001
   0.008833	- Device release number: 0409
   0.009210	Trying to match device
   0.010079	Device does not match - skipping
   0.010545	Checking device (0764/0501) (002/002)
   0.018053	- VendorID: 0764
   0.018516	- ProductID: 0501
   0.018890	- Manufacturer: CPS
   0.019266	- Product: CP1500EPFCLCD
   0.019642	- Serial Number: CRNGV2000037
   0.020147	- Bus: 002
   0.020532	- Device release number: 0001
   0.020972	Trying to match device
   0.021277	Device matches
   0.021832	failed to claim USB device: Resource busy
   0.021931	failed to detach kernel driver from USB device: No such file or directory
   0.022073	failed to claim USB device: Resource busy
   0.022162	failed to detach kernel driver from USB device: No such file or directory
   0.022280	failed to claim USB device: Resource busy
   0.022655	failed to detach kernel driver from USB device: No such file or directory
   0.022758	failed to claim USB device: Resource busy
   0.023046	failed to detach kernel driver from USB device: No such file or directory
   0.023134	Can't claim USB device [0764:0501]: No such file or directory

Sorry, just saw your reply. Can you try

config upsd 'upsd'
   option maxage 25 
   option statepath /var/run/nut
   option runas root

in your /etc/config/nut_server file?

Runas seems to be misbehaving (I'll have to check if the upsmon runas overrules upsd runas, or if I mistakenly set runas nut as the default for upsd).

The problem with no auto startup and not forced shutdown is because upsd doesn't have permissions on the the usb device (there are ways to do that, but I haven't documented it yet, and it's not (yet) trivial for a regular user to accomplish).

HTH.

Unless the driver has a (undocumented?) requirement to not be root? That would be a pain.

Added "option runas root" to upsd config of /etc/config/nut_server. Here is the result after a reboot:

root@TPLINKAC1750:~# ps | egrep "nut|ups"
 1094 root      1364 S    /lib/nut/usbhid-ups -a CP37 -u root
 1098 root      1316 S    /bin/sh /etc/rc.common /etc/init.d/nut-server running
 1168 root      1024 S    /usr/sbin/upsmon
 1170 nut       1024 S    /usr/sbin/upsmon
 1868 root      1200 S    egrep nut|ups

Unfortunately, upsd still did NOT start automatically. Now, /lib/nut/usbhid-ups has -u root parameter.

I noticed that if I insert a sleep 10 beween calls to upsdrvctl start and upsd in /etc/config/nut_server, it works. So I guess it is a race condition thing.

Also I played around with the upsdrvctl shutdown command. Performed the following:

  1. Reboot.
  2. Send command: upsdrvctl shutdown CP37. I get:
root@TPLINKAC1750:~# upsdrvctl shutdown CP37
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
Can't claim USB device [0764:0501]: No such file or directory
Driver failed to start (exit status=1)
  1. Unplug and then plug USB connection back to the router.
  2. Re-send command: upsdrvctl shutdown CP37. I get:
root@TPLINKAC1750:~# upsdrvctl shutdown CP37
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
Using subdriver: CyberPower HID 0.4
Initiating UPS shutdown

Somehow it proceeds if I do that.

Also, during the failed shutdown command, I checked the lsusb -v -d 0764:0501 ouput:

Bus 001 Device 002: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0764 Cyber Power System, Inc.
  idProduct          0x0501 CP1500 AVR UPS
  bcdDevice            0.01
  iManufacturer           3 CPS
  iProduct                1 CP1500EPFCLCD
  iSerial                 2 CRNGV2000037
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode           33 US
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     480
         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     0x0040  1x 64 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)

After USB re-plugging, here is the output (a longer one maybe due to complete descriptors):

Bus 002 Device 002: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0764 Cyber Power System, Inc.
  idProduct          0x0501 CP1500 AVR UPS
  bcdDevice            0.01
  iManufacturer           3 CPS
  iProduct                1 CP1500EPFCLCD
  iSerial                 2 CRNGV2000037
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode           33 US
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     480
          Report Descriptor: (length is 480)
            Item(Global): Usage Page, data= [ 0x84 ] 132
                            Power Device Page
            Item(Local ): Usage, data= [ 0x04 ] 4
                            UPS
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x24 ] 36
                            Power Summary
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Report ID, data= [ 0x01 ] 1
            Item(Local ): Usage, data= [ 0xfe ] 254
                            iProduct
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x02 ] 2
            Item(Local ): Usage, data= [ 0xff ] 255
                            iSerialNumber
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x1b ] 27
            Item(Global): Usage Page, data= [ 0x01 0xff ] 65281
                            (null)
            Item(Local ): Usage, data= [ 0xd0 ] 208
                            (null)
            Item(Main  ): Feature, data= [ 0x22 ] 34
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x03 ] 3
            Item(Global): Usage Page, data= [ 0x85 ] 133
                            Battery System Page
            Item(Local ): Usage, data= [ 0x89 ] 137
                            iDeviceChemistry
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x04 ] 4
            Item(Local ): Usage, data= [ 0x8f ] 143
                            iOEMInformation
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x05 ] 5
            Item(Local ): Usage, data= [ 0x8b ] 139
                            Rechargeable
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x06 ] 6
            Item(Local ): Usage, data= [ 0x2c ] 44
                            Capacity Mode
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x07 ] 7
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x06 ] 6
            Item(Global): Logical Maximum, data= [ 0x64 ] 100
            Item(Local ): Usage, data= [ 0x83 ] 131
                            Design Capacity
            Item(Local ): Usage, data= [ 0x8d ] 141
                            Capacity Granularity 1
            Item(Local ): Usage, data= [ 0x8e ] 142
                            Capacity Granularity 2
            Item(Local ): Usage, data= [ 0x8c ] 140
                            Warning Capacity Limit
            Item(Local ): Usage, data= [ 0x29 ] 41
                            Remaining Capacity Limit
            Item(Local ): Usage, data= [ 0x67 ] 103
                            Full Charge Capacity
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x08 ] 8
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Local ): Usage, data= [ 0x66 ] 102
                            Remaining Capacity
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x66 ] 102
                            Remaining Capacity
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x68 ] 104
                            Run Time To Empty
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Global): Logical Maximum, data= [ 0xff 0xff 0x00 0x00 ] 65535
            Item(Global): Unit, data= [ 0x01 0x10 ] 4097
                            System: SI Linear, Unit: Seconds
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x68 ] 104
                            Run Time To Empty
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x2a ] 42
                            Remaining Time Limit
            Item(Global): Logical Maximum, data= [ 0x58 0x02 ] 600
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x2a ] 42
                            Remaining Time Limit
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x09 ] 9
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Usage Page, data= [ 0x84 ] 132
                            Power Device Page
            Item(Local ): Usage, data= [ 0x40 ] 64
                            Config Voltage
            Item(Global): Unit, data= [ 0x21 0xd1 0xf0 0x00 ] 15782177
                            System: SI Linear, Unit: Centimeter^2*Gram*Seconds^-3*Ampere^-1
            Item(Global): Unit Exponent, data= [ 0x06 ] 6
                            Unit Exponent: 6
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x0a ] 10
            Item(Local ): Usage, data= [ 0x30 ] 48
                            Voltage
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x02 ] 2
                            Present Status
            Item(Main  ): Collection, data= [ 0x02 ] 2
                            Logical
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Global): Unit Exponent, data= [ 0x00 ] 0
                            Unit Exponent: 0
            Item(Global): Report ID, data= [ 0x0b ] 11
            Item(Global): Report Size, data= [ 0x01 ] 1
            Item(Global): Report Count, data= [ 0x06 ] 6
            Item(Global): Logical Maximum, data= [ 0x01 ] 1
            Item(Global): Usage Page, data= [ 0x85 ] 133
                            Battery System Page
            Item(Local ): Usage, data= [ 0xd0 ] 208
                            AC Present
            Item(Local ): Usage, data= [ 0x44 ] 68
                            Charging
            Item(Local ): Usage, data= [ 0x45 ] 69
                            Discharging
            Item(Local ): Usage, data= [ 0x42 ] 66
                            Below Remaining Capacity Limit
            Item(Local ): Usage, data= [ 0x46 ] 70
                            Fully Charged
            Item(Local ): Usage, data= [ 0x43 ] 67
                            Remaining Time Limit Expired
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0xd0 ] 208
                            AC Present
            Item(Local ): Usage, data= [ 0x44 ] 68
                            Charging
            Item(Local ): Usage, data= [ 0x45 ] 69
                            Discharging
            Item(Local ): Usage, data= [ 0x42 ] 66
                            Below Remaining Capacity Limit
            Item(Local ): Usage, data= [ 0x46 ] 70
                            Fully Charged
            Item(Local ): Usage, data= [ 0x43 ] 67
                            Remaining Time Limit Expired
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report Size, data= [ 0x02 ] 2
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Main  ): Input, data= [ 0x01 ] 1
                            Constant Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): Feature, data= [ 0x01 ] 1
                            Constant Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Global): Report ID, data= [ 0x0c ] 12
            Item(Global): Usage Page, data= [ 0x84 ] 132
                            Power Device Page
            Item(Local ): Usage, data= [ 0x5a ] 90
                            Audible Alarm Control
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Logical Minimum, data= [ 0x01 ] 1
            Item(Global): Logical Maximum, data= [ 0x03 ] 3
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x5a ] 90
                            Audible Alarm Control
            Item(Main  ): Input, data= [ 0x22 ] 34
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x0d ] 13
            Item(Local ): Usage, data= [ 0xfd ] 253
                            iManufacturer
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Global): Usage Page, data= [ 0x84 ] 132
                            Power Device Page
            Item(Local ): Usage, data= [ 0x1a ] 26
                            Input
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Report ID, data= [ 0x0e ] 14
            Item(Global): Usage Page, data= [ 0x84 ] 132
                            Power Device Page
            Item(Local ): Usage, data= [ 0x40 ] 64
                            Config Voltage
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Unit, data= [ 0x21 0xd1 0xf0 0x00 ] 15782177
                            System: SI Linear, Unit: Centimeter^2*Gram*Seconds^-3*Ampere^-1
            Item(Global): Unit Exponent, data= [ 0x07 ] 7
                            Unit Exponent: 7
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x0f ] 15
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Local ): Usage, data= [ 0x30 ] 48
                            Voltage
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x10 ] 16
            Item(Local ): Usage, data= [ 0x53 ] 83
                            Low Voltage Transfer
            Item(Global): Logical Minimum, data= [ 0xaa 0x00 ] 170
            Item(Global): Logical Maximum, data= [ 0xb4 0x00 ] 180
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x53 ] 83
                            Low Voltage Transfer
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x54 ] 84
                            High Voltage Transfer
            Item(Global): Logical Minimum, data= [ 0x04 0x01 ] 260
            Item(Global): Logical Maximum, data= [ 0x0e 0x01 ] 270
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x54 ] 84
                            High Voltage Transfer
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Local ): Usage, data= [ 0x1c ] 28
                            Output
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Report ID, data= [ 0x12 ] 18
            Item(Local ): Usage, data= [ 0x30 ] 48
                            Voltage
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Global): Unit Exponent, data= [ 0x00 ] 0
                            Unit Exponent: 0
            Item(Global): Report ID, data= [ 0x13 ] 19
            Item(Local ): Usage, data= [ 0x35 ] 53
                            Percent Load
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x14 ] 20
            Item(Local ): Usage, data= [ 0x58 ] 88
                            Test
            Item(Global): Logical Maximum, data= [ 0x06 ] 6
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x58 ] 88
                            Test
            Item(Main  ): Input, data= [ 0x22 ] 34
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x15 ] 21
            Item(Local ): Usage, data= [ 0x57 ] 87
                            Delay Before Shutdown
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Global): Logical Minimum, data= [ 0xff ] 255
            Item(Global): Logical Maximum, data= [ 0xff 0x7f ] 32767
            Item(Global): Physical Minimum, data= [ 0xc4 ] 196
            Item(Global): Physical Maximum, data= [ 0xc4 0xff 0x1d 0x00 ] 1966020
            Item(Global): Unit, data= [ 0x01 0x10 ] 4097
                            System: SI Linear, Unit: Seconds
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x16 ] 22
            Item(Local ): Usage, data= [ 0x56 ] 86
                            Delay Before Startup
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x17 ] 23
            Item(Local ): Usage, data= [ 0x6e ] 110
                            Boost
            Item(Global): Report Size, data= [ 0x01 ] 1
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0x01 ] 1
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0x00 ] 0
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x65 ] 101
                            Overload
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report Size, data= [ 0x06 ] 6
            Item(Main  ): Feature, data= [ 0x01 ] 1
                            Constant Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x18 ] 24
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Local ): Usage, data= [ 0x44 ] 68
                            Config Active Power
            Item(Global): Logical Maximum, data= [ 0x84 0x03 ] 900
            Item(Global): Unit, data= [ 0x21 0xd1 ] 53537
                            System: SI Linear, Unit: Centimeter^2*Gram*Seconds^-3
            Item(Global): Unit Exponent, data= [ 0x07 ] 7
                            Unit Exponent: 7
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x1a ] 26
            Item(Global): Usage Page, data= [ 0x01 0xff ] 65281
                            (null)
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Global): Unit Exponent, data= [ 0x00 ] 0
                            Unit Exponent: 0
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0x02 ] 2
            Item(Local ): Usage, data= [ 0x43 ] 67
                            (null)
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x43 ] 67
                            (null)
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Global): Report ID, data= [ 0x1c ] 28
            Item(Local ): Usage, data= [ 0xba ] 186
                            (null)
            Item(Main  ): Collection, data= [ 0x02 ] 2
                            Logical
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Global): Logical Maximum, data= [ 0xff 0xff 0x00 0x00 ] 65535
            Item(Local ): Usage, data= [ 0xbb ] 187
                            (null)
            Item(Main  ): Feature, data= [ 0x22 ] 34
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Local ): Usage, data= [ 0xbc ] 188
                            (null)
            Item(Main  ): Feature, data= [ 0x22 ] 34
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Global): Logical Maximum, data= [ 0xff 0xff 0x00 0x00 ] 65535
            Item(Local ): Usage, data= [ 0xbd ] 189
                            (null)
            Item(Main  ): Feature, data= [ 0xa2 0x01 ] 418
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Buffered Bytes
            Item(Main  ): End Collection, data=none
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)

Seems like the first time, some descriptor parts are missing.

I am interested to work on it. I hope interest is enough :slight_smile:.

[malakingpusa] malakingpusa
https://forum.openwrt.org/u/malakingpusa Jag Glifonea
https://forum.openwrt.org/u/malakingpusa
August 17

Added "option runas root" to upsd config of /etc/config/nut_server.
Here is the result after a reboot:

root@TPLINKAC1750:~# ps | egrep "nut|ups" 1094 root 1364 S
/lib/nut/usbhid-ups -a CP37 -u root 1098 root 1316 S /bin/sh
/etc/rc.common /etc/init.d/nut-server running 1168 root 1024 S
/usr/sbin/upsmon 1170 nut 1024 S /usr/sbin/upsmon 1868 root 1200 S
egrep nut|ups |

Unfortunately, upsd still did NOT start automatically. Now,
/lib/nut/usbhid-ups has -u root parameter.

I noticed that if I insert a sleep 10 beween calls to upsdrvctl
start
and upsd in /etc/config/nut_server, it works. So I guess it
is a race condition thing.

This part I haven't been able to reproduce. I do agree probably race
condition though I think not with the initscript per se, but rather with
the timing if USB device being noticed by kernel and such.

Also I played around with the upsdrvctl shutdown command. Performed
the following:

  1. Reboot.
  2. Send command: upsdrvctl shutdown CP37. I get:

root@TPLINKAC1750:~# upsdrvctl shutdown CP37 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 Can't claim USB device
[0764:0501]: No such file or directory Driver failed to start (exit
status=1) |

  1. Unplug and then plug USB connection back to the router.
  2. Re-send command: upsdrvctl shutdown CP37. I get:

root@TPLINKAC1750:~# upsdrvctl shutdown CP37 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 Using subdriver: CyberPower HID
0.4 Initiating UPS shutdown |

Somehow it proceeds if I do that.

This I can confirm occurs for me too. I will investigate a 'hotplug'
start for NUT rather than on boot as that is the probable issue.

Thanks for confirming my observations. On the first one, I can live with the delay on calling upsd. On the hotplug issue, I have seen other OS encountered this as well and resolved it through udev rules. Unfortunately openwrt does not have udev. Will wait for the hotplug start.

Hey, can you save me some work and post (here, or in a GitHub ticket, or PM) the udev rules and such that other projects use to handle this? Or at least links to the actual code and udev rules? That'd save me a lot of hunting.

@malakingpusa I've also discovered that USB on ar71xx and ath79 can be touchy. With my Eaton UPS connecting directly to the router fails altogether with a usb driver error (kernel, nothing to do with NUT), but attaching through a hub (unpowered hub), allows the router to register the UPS. Can you see if something like that helps your descriptor thing on initial boot? (Hotplug still needs to be worked on, but I wonder if you are also seeing some kernel USB driver issue).

I will try to do some test with an unpowered hub. Will update you with results. Thanks.

FYI I found the udev rules, so that part I've got taken care. Definitely interested to hear your results with hub.

@malakingpusa Hi, I may have figured out the issue. In my case, while I was testing hotplug fixes I accidentally changed the permission on /dev to 0660 instead of 0755 which meant even root couldn't access the usb device. Can you check if something similar happened in your case. I will check further to see if it's something in the nut initscripts. Also could you file a GitHub Issue on https://github.com/openwrt/packages repo (nut package) to track this better (and so I can make the case for backport to 18.06).

Hi Daniel,

Sorry just came from a national holiday vacation. Anyhow, I managed to connect the UPS to an unpowered USB hub which is connected to the router.

I performed the following steps:

  1. Reboot the router.
  2. Executed lsusb.
  3. Checked permissions of /dev/bus/usb/ by executing ls -l /dev/bus/usb/001.
  4. Checked USB descriptors by executing lsusb -v -d 0764:0501. Found that Report Descriptors: Unavailable.
root@TPLINKAC1750:~# lsusb -v -d 0764:0501

Bus 001 Device 003: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0764 Cyber Power System, Inc.
  idProduct          0x0501 CP1500 AVR UPS
  bcdDevice            0.01
  iManufacturer           3 CPS
  iProduct                1 CP1500EPFCLCD
  iSerial                 2 CRNGV2000037
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode           33 US
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     480
         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     0x0040  1x 64 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)
  1. Listed processes related to nut by executing ps | egrep "nut|ups".
root@TPLINKAC1750:~# ps | egrep "nut|ups"
 1094 root      1372 S    /lib/nut/usbhid-ups -a CP37
 1575 root       976 S    /usr/sbin/upsd
 1579 root      1316 S    /bin/sh /etc/rc.common /etc/init.d/nut-server running
 1649 root      1024 S    /usr/sbin/upsmon
 1651 nut       1024 S    /usr/sbin/upsmon
 1898 root      1200 S    egrep nut|ups
  1. Queried UPS through upsc CP37 command.
root@TPLINKAC1750:~# upsc CP37
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 20
battery.mfr.date: CPS
battery.runtime: 14790
battery.runtime.low: 4000
battery.type: PbAcid
battery.voltage: 24.0
battery.voltage.nominal: 24
device.mfr: CPS
device.model: CP1500EPFCLCD
device.serial: CRNGV2000037
device.type: ups
driver.flag.ignorelb: enabled
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 15
driver.parameter.port: auto
driver.parameter.serial: CRNGV2000037
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: CyberPower HID 0.4
driver.version.internal: 0.41
input.transfer.high: 260
input.transfer.low: 170
input.voltage: 221.0
input.voltage.nominal: 230
output.voltage: 269.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 0
ups.mfr: CPS
ups.model: CP1500EPFCLCD
ups.productid: 0501
ups.realpower.nominal: 900
ups.serial: CRNGV2000037
ups.status: OL
ups.test.result: No test initiated
ups.timer.shutdown: -60
ups.timer.start: -60
ups.vendorid: 0764
  1. Attempted shutdown/killpower to UPS through upsdrvctl shutdown command, which DID NOT WORK.
root@TPLINKAC1750:~# upsdrvctl shutdown
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
Can't claim USB device [0764:0501]: No such file or directory
Driver failed to start (exit status=1)
  1. Performed unplug-re-plug of USB to hub.
  2. Repeated steps 2,3 and 4.
root@TPLINKAC1750:~# lsusb
Bus 001 Device 004: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@TPLINKAC1750:~# ls -l /dev/bus/usb/001
crw-------    1 root     root      189,   0 Aug 22 11:39 001
crw-------    1 root     root      189,   1 Aug 22 11:39 002
crw-------    1 root     root      189,   3 Aug 22 11:39 004
root@TPLINKAC1750:~# lsusb -v -d 0764:0501

Bus 001 Device 004: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0764 Cyber Power System, Inc.
  idProduct          0x0501 CP1500 AVR UPS
  bcdDevice            0.01
  iManufacturer           3 CPS
  iProduct                1 CP1500EPFCLCD
  iSerial                 2 CRNGV2000037
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode           33 US
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     480
          Report Descriptor: (length is 480)
            Item(Global): Usage Page, data= [ 0x84 ] 132
                            Power Device Page
            Item(Local ): Usage, data= [ 0x04 ] 4
                            UPS
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x24 ] 36
                            Power Summary
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Report ID, data= [ 0x01 ] 1
            Item(Local ): Usage, data= [ 0xfe ] 254
                            iProduct
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x02 ] 2
            Item(Local ): Usage, data= [ 0xff ] 255
                            iSerialNumber
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x1b ] 27
            Item(Global): Usage Page, data= [ 0x01 0xff ] 65281
                            (null)
            Item(Local ): Usage, data= [ 0xd0 ] 208
                            (null)
            Item(Main  ): Feature, data= [ 0x22 ] 34
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x03 ] 3
            Item(Global): Usage Page, data= [ 0x85 ] 133
                            Battery System Page
            Item(Local ): Usage, data= [ 0x89 ] 137
                            iDeviceChemistry
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x04 ] 4
            Item(Local ): Usage, data= [ 0x8f ] 143
                            iOEMInformation
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x05 ] 5
            Item(Local ): Usage, data= [ 0x8b ] 139
                            Rechargeable
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x06 ] 6
            Item(Local ): Usage, data= [ 0x2c ] 44
                            Capacity Mode
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x07 ] 7
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x06 ] 6
            Item(Global): Logical Maximum, data= [ 0x64 ] 100
            Item(Local ): Usage, data= [ 0x83 ] 131
                            Design Capacity
            Item(Local ): Usage, data= [ 0x8d ] 141
                            Capacity Granularity 1
            Item(Local ): Usage, data= [ 0x8e ] 142
                            Capacity Granularity 2
            Item(Local ): Usage, data= [ 0x8c ] 140
                            Warning Capacity Limit
            Item(Local ): Usage, data= [ 0x29 ] 41
                            Remaining Capacity Limit
            Item(Local ): Usage, data= [ 0x67 ] 103
                            Full Charge Capacity
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x08 ] 8
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Local ): Usage, data= [ 0x66 ] 102
                            Remaining Capacity
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x66 ] 102
                            Remaining Capacity
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x68 ] 104
                            Run Time To Empty
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Global): Logical Maximum, data= [ 0xff 0xff 0x00 0x00 ] 65535
            Item(Global): Unit, data= [ 0x01 0x10 ] 4097
                            System: SI Linear, Unit: Seconds
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x68 ] 104
                            Run Time To Empty
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x2a ] 42
                            Remaining Time Limit
            Item(Global): Logical Maximum, data= [ 0x58 0x02 ] 600
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x2a ] 42
                            Remaining Time Limit
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x09 ] 9
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Usage Page, data= [ 0x84 ] 132
                            Power Device Page
            Item(Local ): Usage, data= [ 0x40 ] 64
                            Config Voltage
            Item(Global): Unit, data= [ 0x21 0xd1 0xf0 0x00 ] 15782177
                            System: SI Linear, Unit: Centimeter^2*Gram*Seconds^-3*Ampere^-1
            Item(Global): Unit Exponent, data= [ 0x06 ] 6
                            Unit Exponent: 6
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x0a ] 10
            Item(Local ): Usage, data= [ 0x30 ] 48
                            Voltage
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x02 ] 2
                            Present Status
            Item(Main  ): Collection, data= [ 0x02 ] 2
                            Logical
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Global): Unit Exponent, data= [ 0x00 ] 0
                            Unit Exponent: 0
            Item(Global): Report ID, data= [ 0x0b ] 11
            Item(Global): Report Size, data= [ 0x01 ] 1
            Item(Global): Report Count, data= [ 0x06 ] 6
            Item(Global): Logical Maximum, data= [ 0x01 ] 1
            Item(Global): Usage Page, data= [ 0x85 ] 133
                            Battery System Page
            Item(Local ): Usage, data= [ 0xd0 ] 208
                            AC Present
            Item(Local ): Usage, data= [ 0x44 ] 68
                            Charging
            Item(Local ): Usage, data= [ 0x45 ] 69
                            Discharging
            Item(Local ): Usage, data= [ 0x42 ] 66
                            Below Remaining Capacity Limit
            Item(Local ): Usage, data= [ 0x46 ] 70
                            Fully Charged
            Item(Local ): Usage, data= [ 0x43 ] 67
                            Remaining Time Limit Expired
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0xd0 ] 208
                            AC Present
            Item(Local ): Usage, data= [ 0x44 ] 68
                            Charging
            Item(Local ): Usage, data= [ 0x45 ] 69
                            Discharging
            Item(Local ): Usage, data= [ 0x42 ] 66
                            Below Remaining Capacity Limit
            Item(Local ): Usage, data= [ 0x46 ] 70
                            Fully Charged
            Item(Local ): Usage, data= [ 0x43 ] 67
                            Remaining Time Limit Expired
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report Size, data= [ 0x02 ] 2
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Main  ): Input, data= [ 0x01 ] 1
                            Constant Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): Feature, data= [ 0x01 ] 1
                            Constant Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Global): Report ID, data= [ 0x0c ] 12
            Item(Global): Usage Page, data= [ 0x84 ] 132
                            Power Device Page
            Item(Local ): Usage, data= [ 0x5a ] 90
                            Audible Alarm Control
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Logical Minimum, data= [ 0x01 ] 1
            Item(Global): Logical Maximum, data= [ 0x03 ] 3
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x5a ] 90
                            Audible Alarm Control
            Item(Main  ): Input, data= [ 0x22 ] 34
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x0d ] 13
            Item(Local ): Usage, data= [ 0xfd ] 253
                            iManufacturer
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Global): Usage Page, data= [ 0x84 ] 132
                            Power Device Page
            Item(Local ): Usage, data= [ 0x1a ] 26
                            Input
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Report ID, data= [ 0x0e ] 14
            Item(Global): Usage Page, data= [ 0x84 ] 132
                            Power Device Page
            Item(Local ): Usage, data= [ 0x40 ] 64
                            Config Voltage
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Unit, data= [ 0x21 0xd1 0xf0 0x00 ] 15782177
                            System: SI Linear, Unit: Centimeter^2*Gram*Seconds^-3*Ampere^-1
            Item(Global): Unit Exponent, data= [ 0x07 ] 7
                            Unit Exponent: 7
            Item(Main  ): Feature, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x0f ] 15
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Local ): Usage, data= [ 0x30 ] 48
                            Voltage
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x10 ] 16
            Item(Local ): Usage, data= [ 0x53 ] 83
                            Low Voltage Transfer
            Item(Global): Logical Minimum, data= [ 0xaa 0x00 ] 170
            Item(Global): Logical Maximum, data= [ 0xb4 0x00 ] 180
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x53 ] 83
                            Low Voltage Transfer
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x54 ] 84
                            High Voltage Transfer
            Item(Global): Logical Minimum, data= [ 0x04 0x01 ] 260
            Item(Global): Logical Maximum, data= [ 0x0e 0x01 ] 270
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x54 ] 84
                            High Voltage Transfer
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Local ): Usage, data= [ 0x1c ] 28
                            Output
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Report ID, data= [ 0x12 ] 18
            Item(Local ): Usage, data= [ 0x30 ] 48
                            Voltage
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Global): Unit Exponent, data= [ 0x00 ] 0
                            Unit Exponent: 0
            Item(Global): Report ID, data= [ 0x13 ] 19
            Item(Local ): Usage, data= [ 0x35 ] 53
                            Percent Load
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x14 ] 20
            Item(Local ): Usage, data= [ 0x58 ] 88
                            Test
            Item(Global): Logical Maximum, data= [ 0x06 ] 6
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x58 ] 88
                            Test
            Item(Main  ): Input, data= [ 0x22 ] 34
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x15 ] 21
            Item(Local ): Usage, data= [ 0x57 ] 87
                            Delay Before Shutdown
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Global): Logical Minimum, data= [ 0xff ] 255
            Item(Global): Logical Maximum, data= [ 0xff 0x7f ] 32767
            Item(Global): Physical Minimum, data= [ 0xc4 ] 196
            Item(Global): Physical Maximum, data= [ 0xc4 0xff 0x1d 0x00 ] 1966020
            Item(Global): Unit, data= [ 0x01 0x10 ] 4097
                            System: SI Linear, Unit: Seconds
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x16 ] 22
            Item(Local ): Usage, data= [ 0x56 ] 86
                            Delay Before Startup
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x17 ] 23
            Item(Local ): Usage, data= [ 0x6e ] 110
                            Boost
            Item(Global): Report Size, data= [ 0x01 ] 1
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0x01 ] 1
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0x00 ] 0
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x65 ] 101
                            Overload
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report Size, data= [ 0x06 ] 6
            Item(Main  ): Feature, data= [ 0x01 ] 1
                            Constant Array Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x18 ] 24
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Local ): Usage, data= [ 0x44 ] 68
                            Config Active Power
            Item(Global): Logical Maximum, data= [ 0x84 0x03 ] 900
            Item(Global): Unit, data= [ 0x21 0xd1 ] 53537
                            System: SI Linear, Unit: Centimeter^2*Gram*Seconds^-3
            Item(Global): Unit Exponent, data= [ 0x07 ] 7
                            Unit Exponent: 7
            Item(Main  ): Feature, data= [ 0xa3 ] 163
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Global): Report ID, data= [ 0x1a ] 26
            Item(Global): Usage Page, data= [ 0x01 0xff ] 65281
                            (null)
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Global): Unit Exponent, data= [ 0x00 ] 0
                            Unit Exponent: 0
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0x02 ] 2
            Item(Local ): Usage, data= [ 0x43 ] 67
                            (null)
            Item(Main  ): Feature, data= [ 0xa2 ] 162
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Bitfield
            Item(Local ): Usage, data= [ 0x43 ] 67
                            (null)
            Item(Main  ): Input, data= [ 0x23 ] 35
                            Constant Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Global): Report ID, data= [ 0x1c ] 28
            Item(Local ): Usage, data= [ 0xba ] 186
                            (null)
            Item(Main  ): Collection, data= [ 0x02 ] 2
                            Logical
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Global): Logical Maximum, data= [ 0xff 0xff 0x00 0x00 ] 65535
            Item(Local ): Usage, data= [ 0xbb ] 187
                            (null)
            Item(Main  ): Feature, data= [ 0x22 ] 34
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Local ): Usage, data= [ 0xbc ] 188
                            (null)
            Item(Main  ): Feature, data= [ 0x22 ] 34
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Global): Logical Maximum, data= [ 0xff 0xff 0x00 0x00 ] 65535
            Item(Local ): Usage, data= [ 0xbd ] 189
                            (null)
            Item(Main  ): Feature, data= [ 0xa2 0x01 ] 418
                            Data Variable Absolute No_Wrap Linear
                            No_Preferred_State No_Null_Position Volatile Buffered Bytes
            Item(Main  ): End Collection, data=none
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)
  1. Queried UPS through upsc CP37 command. Seen data stale error.
root@TPLINKAC1750:~# upsc CP37
Error: Data stale
  1. Attempted shutdown/killpower to UPS through upsdrvctl shutdown command, which WORKED!
root@TPLINKAC1750:~# upsdrvctl shutdown
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
Using subdriver: CyberPower HID 0.4
Initiating UPS shutdown

Mine says 0755:

dr-xr-xr-x   66 root     root           0 Jan  1  1970 proc
drwxr-xr-x    5 root     root           0 Jan  1  1970 overlay
dr-xr-xr-x   11 root     root           0 Jan  1  1970 sys
drwxr-xr-x    1 root     root           0 Jul 22 15:37 usr
lrwxrwxrwx    1 root     root           3 Jul 31 00:25 var -> tmp
drwxr-xr-x    2 root     root         769 Jul 31 00:25 sbin
drwxr-xr-x   16 root     root         211 Jul 31 00:25 rom
drwxr-xr-x    2 root     root           3 Jul 31 00:25 mnt
drwxr-xr-x    2 root     root         790 Jul 31 00:25 bin
drwxr-xr-x    1 root     root           0 Jul 31 00:30 lib
drwxr-xr-x    1 root     root           0 Jul 31 00:30 etc
drwxr-xr-x    1 root     root           0 Aug 15 18:14 ..
drwxr-xr-x    1 root     root           0 Aug 15 18:14 .
drwxr-xr-x    1 root     root           0 Aug 17 11:08 www
drwxr-xr-x    1 root     root           0 Aug 17 15:44 root
drwxr-xr-x    4 root     root        1.3K Aug 22 11:33 dev
drwxrwxrwt   16 root     root         400 Aug 22 11:33 tmp

Submitted GitHub Issue #6843 (https://github.com/openwrt/packages/issues/6843).