Closed 72siddharth closed 3 years ago
I believe the Linux specific implementation has been withdrawn from the Widgets/battery.rs
.
Probably due to unresolved issues?
I have added Linux implementation back here: https://github.com/mjkillough/cnx/pull/37
The MR still needs some cleaning, I will merge this once I find some spare time.
@72siddharth I just merged the MR to master. Are you able to reproduce the issue with master branch ?
@psibi The bar runs but the issue persists in a new form.
The battey widget doesn't show up and it's printed
Error from widget 6: Could not load value from battery status file: charge_full
I also noticed another issue. The volume doesn't update real time. The volume displayed is the volume of the system when the bar was started, and it doesn't update with any changes
Thanks for the feedback! I haven't tested the battery thing yet as I don't run cnx on my laptop as I don't use it frequently these days.
The volume displayed is the volume of the system when the bar was started, and it doesn't update with any changes
That is strange as I can tell you that it works for me. But I'm not that surprised as it's the only module currently which I'm not that happy about. Some questions:
Thanks for your quick response
Did the volume widget work for you before ?
Previously the bar ran but the position for volume widget was empty Are you getting any messages from cnx when you are updating the volume ? Nope, cnx doesn't seem to notice the volume change or it doesn't check the volume after the first check, if that makes any sense
Previously the bar ran but the position for volume widget was empty
What do you mean by volume widget was empty ? You mean it didn't show the volume before ? You mean in the current behaviour: it's showing volume but it doesn't get updated ?
You mean it didn't show the volume before ?
Yea, that's what I meant. Now the volume widget shows up but doesn't update.
@72siddharth I can reproduce the issue at my side and will have a fix soon. What is the output of this in your system:
ls /sys/class/power_supply/BAT1/
@72siddharth I have created a PR which fixes the battery widget for Linux: https://github.com/mjkillough/cnx/pull/43
You can optionally now specify the battery path name:
let battery = Battery::new(attr.clone(), Color::red(), Some("BAT1".into()), Some(battery_render));
Can you give it a try and see if that fixes it for you ?
@72siddharth I can reproduce the issue at my side and will have a fix soon. What is the output of this in your system:
ls /sys/class/power_supply/BAT1/
$ ls /sys/class/power_supply/BAT1/ alarm model_name capacity power capacity_level present charge_full serial_number charge_full_design status charge_now subsystem current_now technology cycle_count type device uevent hwmon2 voltage_min_design manufacturer voltage_now
@72siddharth Thanks, that LGTM and I think my new above linked PR should fix the issue for you. Give it a go and let me know how it goes.
@psibi So I tried the PR, unfortunately it didn't fix the issue in it's current state and I got this
Error from widget 7: Could not load value from battery status file: current_now
But as it turns out this was a really helpful error message, so I checked .../BAT1/current_now and this is what cat results in
cat: /sys/class/power_supply/BAT1/current_now: No such device
So I fiddled around with the battery fetching code and switched "current_now" with "charge_now" within the load_value function, and behold it works perfectly.
@72siddharth Thanks, I will investigate more about it to understand this further. From a quick google the above issue you are facing looks like a BIOS issue: https://bugzilla.kernel.org/show_bug.cgi?id=83411
@psibi You're right, seems to be more of a firmware issue. Thank you, the issue seems to be solved by replacing "current_now" with "charge_now" although I do not understand the overall implications of this. And unfortunately the volume widget problem still persists, of not updating with changes in volume.
@72siddharth Thanks, yeah I'm looking to see if there a better way to solve this. Can you open a new issue for the volume widget problem ?
@72siddharth I have updated the MR. Can you give that a try ?
The battery widget now works perfectly. Thank you very much.
The docs state that cnx reads battery info from
/sys/class/power_supply/BAT0/
but my device doesn't seem to have this directory. Instead a/sys/class/power_supply/BAT1/
directory exists with all the battery info. So when I use:cnx_add_widget!(cnx, Battery::new(&cnx, attr.clone(), Color::red()));
an error is thrown: