Skip to content

2. Running the Application

dimkasta edited this page Nov 30, 2023 · 1 revision

No configuration is required to run the application. You can just call it and it will try to detect any USB connected HID compatible UPS devices

sudo sups

You might need root permissions to run the application, depending on the ownership of the dev file.

The response takes a couple of seconds, since the info is broadcasted from the device to the HID interface at random intervals (we are not doing any IOCTL stuff).

If you want to define a specific UPS other than the one that autodetect uses (first one), you can define your own target dev file with the --port argument.

sudo sups --port /dev/usb/hiddev1

image

If you don't know the dev files or your devices, you can use

find /dev -name hidd*

You will get something like

/dev/usb/hiddev0
/dev/usb/hiddev1

If you want the app's output in json, you can use the --json argument

sudo sups --json

image

The json data include the following fields

{
    "Port": "/dev/usb/hiddev0", 
    "Charge": 100,
    "ACPresent": true,
    "Time": 40,
    "ChargerStatus": "Charged",
    "ShutdownThreshold": 50,
    "Monitoring": false
}

You can also use the --debug argument to display extra information about the data received and how they are being parsed.

Clone this wiki locally