Comments (10)
@KenjiTakahashi Good suggestion, thanks. Since this is all (well, majority) inherited code, there are still areas where I need to better understand the reasoning behind the original logic -- and also the underlying library APIs -- when I'm making code changes, and solutions, like this one, tend to be course-grained. It'll improve over time, we can hope :-)
from gotop.
Can you paste the output of ls -Al /sys/class/power_supply/hidpp_battery_0
?
from gotop.
ls -Al /sys/class/power_supply/hidpp_battery_0
lrwxrwxrwx 1 root root 0 Jan 28 11:46 /sys/class/power_supply/hidpp_battery_0 -> ../../devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3:1.2/0003:046D:C52B.0003/0003:046D:4041.0005/power_supply/hidpp_battery_0
And the content of the whole directory:
ls -l /sys/class/power_supply/hidpp_battery_0/
total 0
-r--r--r-- 1 root root 4096 Jan 28 11:47 capacity_level
lrwxrwxrwx 1 root root 0 Jan 28 11:47 device -> ../../../0003:046D:4041.0005
-r--r--r-- 1 root root 4096 Jan 28 11:47 manufacturer
-r--r--r-- 1 root root 4096 Jan 28 11:47 model_name
-r--r--r-- 1 root root 4096 Jan 28 11:47 online
drwxr-xr-x 2 root root 0 Jan 28 11:47 power
lrwxrwxrwx 1 root root 0 Jan 28 11:47 powers -> ../../../0003:046D:4041.0005
-r--r--r-- 1 root root 4096 Jan 28 11:47 scope
-r--r--r-- 1 root root 4096 Jan 28 11:47 serial_number
-r--r--r-- 1 root root 4096 Jan 28 11:47 status
lrwxrwxrwx 1 root root 0 Jan 28 11:47 subsystem -> ../../../../../../../../../../class/power_supply
-r--r--r-- 1 root root 4096 Jan 28 11:47 type
-rw-r--r-- 1 root root 4096 Jan 28 11:47 uevent
from gotop.
I have the explanation. I also have the Logitech USB unifying receiver connected to my laptop.
It reports battery level of the wireless mouse using it, and /sys/class/power_supply/hidpp_battery_0/ is associated to it. The real laptop battery is in /sys/class/power_supply/BAT0. Distro is openSUSE Tumbleweed if that matters. If I unplug the USB receiver, gotop -b
works fine and picks BAT0.
from gotop.
Glad you figured that out, that's an interesting situation.
I just pushed a commit that should make sure gotop doesn't panic anymore with the battery widget by correctly handling an error we were receiving, but I still need to fix the error.
So the deal is that we're using distatus/battery to fetch battery information, and it tries to gather information like voltage etc, in addition to current usage. But voltage info isn't provided for your mouse. We don't need that info anyway tho, so I'm thinking we can just fork that project and remove the voltage stuff.
from gotop.
Great !
This USB battery device with no voltage should probably be discarded, because the real one we want is the laptop battery (BAT0). In other terms, I would not want the battery widget to display the mouse battery rather than the laptop battery.
from gotop.
Looks like there's already an open issue at distatus/battery: distatus/battery#8.
from gotop.
Hey! The behaviour you're experiencing is, technically, correct. There's a battery(-like) device, but it lacks most of the battery info, hence it is reported, but mostly with errors. To workaround it, you should use granular error checking. I have just pushed an update for it to the CLI part: distatus/battery@c96c646.
Feel free to ping me, if you have any questions!
[BTW: The reason why most errors talk about voltage is because if battery
fails to find info in Watts, it falls back to trying Amps*Volts, hence voltage error comes up as the last one. Just FYI ;-).]
from gotop.
@KenjiTakahashi FYI in case you feel inclined to check the code using your API. I'm not sure exactly how to test this.
from gotop.
It does looks reasonable to me. Would probably be a bit simpler, if you could check partial errors while iterating over the bottom loop, but I don't know how this could affect whatever makeId
is doing, so just a thought.
from gotop.
Related Issues (20)
- Empty screen on startup HOT 1
- top bandwidth usage
- Help text for --bytes is not shown correctly in some translations
- Selection fails to highlight HOT 9
- gotop no longer works in urxvt, works fine in xterm HOT 8
- Detected as Trojan
- Temperature for SSD is -273C HOT 3
- Battery information is not displayed. HOT 1
- Statusbar set to true in the configuration file but is not displayed
- $TERM rendering bug HOT 6
- 4.2.0 is broken HOT 1
- Temperature not showing for M2 Air HOT 5
- build from source failed on macOS HOT 1
- Only show one widget or create custom layout
- RX e TX Network for all time HOT 2
- Disk report problem on each run HOT 3
- gotop only opens keybinding overview HOT 1
- Please bump the golang.org/x/sys dependency
- 404/301 errors when trying to emerge gotop from gentoo guru repo
- Build fails because go.mod requests an outdated Go version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gotop.