You are not logged in.

#1 2024-03-17 03:29:12

redshoe
Member
Registered: 2015-12-16
Posts: 250

[solved] Is there a way to get UPC device info straight from /sys dir

What I ultimately want to do is to get the backup UPC (Uninterruptible Power Supply) info (specifically UPC battery charge status) on to i3 status bar. In the case of laptops, i3 status bar takes laptop's battery info from /sys/class/power_supply directory, where you can see BATX files. My UPC is connected to my computer via USB, so there must be somewhere I can get this info. I am currently using apcupsd to look at the battery charge status, etc., but I would like to put those info in my i3 status bar. Does anyone know if this is possible?

Thanks.

Last edited by redshoe (2024-03-21 14:30:31)

Offline

#2 2024-03-17 11:17:56

xerxes_
Member
Registered: 2018-04-29
Posts: 1,045

Re: [solved] Is there a way to get UPC device info straight from /sys dir

See here: https://askubuntu.com/questions/69556/h … e-terminal and read 'man i3status', especially "battery 0 {", "Battery" and "EXTERNAL SCRIPTS/PROGRAMS WITH I3STATUS".
'upower -e' enumerates path to devices. I don't know what format returns '/sys/class/power_supply/BAT%d/uevent', because I don't have that path, is it similar to what returns 'upower -d' or 'upower -i $(upower -e)'. If not then you need create your own script for i3status (man i3status: "EXTERNAL SCRIPTS/PROGRAMS WITH I3STATUS").

Offline

#3 2024-03-17 17:50:07

redshoe
Member
Registered: 2015-12-16
Posts: 250

Re: [solved] Is there a way to get UPC device info straight from /sys dir

Thank you for the reply, but the solution that you have linked is based on the fact that I could get something from '/sys/class/power_supply/BAT%d/uevent' or some sort. But, like how I described above, I don't have that in my '/sys/class/power_supply', just like you don't have that path.

Offline

#4 2024-03-20 20:47:27

xerxes_
Member
Registered: 2018-04-29
Posts: 1,045

Re: [solved] Is there a way to get UPC device info straight from /sys dir

If your UPS is connected to USB  then what returns commands:

lsusb
upower -e
upower -d
upower -i $(upower -e)

If 'upower -e' works and returns path then try to use it instead of '/sys/class/power_supply/...' path.

Offline

#5 2024-03-21 14:29:52

redshoe
Member
Registered: 2015-12-16
Posts: 250

Re: [solved] Is there a way to get UPC device info straight from /sys dir

Thanks! upower does return some decent info, and I was able to get some info from /sys/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/usb3/3-1/3-1:1.0/usbmisc/hiddev0. Thank you!

Offline

Board footer

Powered by FluxBB