valr / cbatticon

A lightweight and fast battery icon that sits in your system tray
GNU General Public License v2.0
168 stars 40 forks source link

/sys/ info is refreshed with delay so notification value is not always accurate #3

Closed valr closed 6 years ago

valr commented 12 years ago

It can take a bit of time to have the refreshed info in /sys/... so the value is not always accurate when the notification is sent.

ghost commented 12 years ago

I'll help if I have time, I've been swamped with university computer science assignments. :(

valr commented 12 years ago

So it would be like holidays then :)

Feel free. On my side, I'll first finish to migrate gexif to gtk3 (almost finished) then I'll have a look at that point. Not sure how this can be solved. I have to think about it and maybe dig into the kernel code to understand how it works.


De: Colin Jones reply@reply.github.com : Valre Monseur valere.monseur@ymail.com Envoy le : Mardi 25 Octobre 2011 20h19 Objet: Re: [cbatticon] /sys/ info is refreshed with delay so notification value is not always accurate (#3)

I'll help if I have time, I've been swamped with university computer science assignments. :(

Reply to this email directly or view it on GitHub: https://github.com/ColinJones/cbatticon/issues/3#issuecomment-2520791

ghost commented 12 years ago

Checking the battery discharge speed at a less small interval would probably increase the accuracy.

valr commented 12 years ago

Sure, but when is the info accurate? During my testing I've seen many different cases:

...so when can the info be considered accurate, that's the question.


De: Colin Jones reply@reply.github.com : Valre Monseur valere.monseur@ymail.com Envoy le : Mardi 25 Octobre 2011 20h35 Objet: Re: [cbatticon] /sys/ info is refreshed with delay so notification value is not always accurate (#3)

Checking the battery discharge speed at a less small interval would probably increase the accuracy.

Reply to this email directly or view it on GitHub: https://github.com/ColinJones/cbatticon/issues/3#issuecomment-2521044

ghost commented 12 years ago

Looking at other battery monitor icons, it appears that they update the icon very infrequently and only show an accurate estimation when clicked on. This is what the submitter of one of the other issues has suggest. I suggest we increase the timeout for checking the battery information and instead of having the tooltip have users click on the icon to get the estimations.

ghost commented 12 years ago

I've been working on a simple library for accessing the status of the battery (and moving all of the logic for calculating and so on out of cbatticon). It's in the testing branch, if you haven't looked at it. I was wondering what you thought of using simple fopen calls instead of using udev.

I'm going to be using the library for other projects, so if you have any advice on optimizing I'd love your input!

valr commented 12 years ago

  Hi,   Sorry, I didn't see the testing branch so I hope it's not a problem for you. If so you can revert the commits I've done.   Regarding the libubat.c:   Usage of fopen to read values is ok. In fact, I've done something similar in the first commit I've done yesterday. I've used another approach than udev by using g_file_get_contents which opens file, reads value and closes file in a single call. In fact it's something I wanted to change since the beginning because udev puts the information in cache memory so it's always required to reopen a new context if you want up-to-date values. Udev is only kept to find the correct path to the battery (or to list pathes to available batteries : a new feature).   To access batteries, I'm not certain that hardcoding /sys/class/power_supply/... will always be correct in the future. It might be good for a library to be able to change that value (at compile time or, better, runtime). I would prefer to see it defined as a parameter to the init_battery library call.   Another comment is that you should avoid using fixed length array of char to store the filenames or you should defined them big enough i.e. using the standard value FILENAME_MAX defined in stdio.h   That's all for now...as I have do my job now (am at work :-)   Cheers Valere


De : Colin Jones reply@reply.github.com À : Valère Monseur valere.monseur@ymail.com Envoyé le : Mardi 17 avril 2012 10h03 Objet : Re: [cbatticon] /sys/ info is refreshed with delay so notification value is not always accurate (#3)

I've been working on a simple library for accessing the status of the battery (and moving all of the logic for calculating and so on out of cbatticon). It's in the testing branch, if you haven't looked at it. I was wondering what you thought of using simple fopen calls instead of using udev.

I'm going to be using the library for other projects, so if you have any advice on optimizing I'd love your input!


Reply to this email directly or view it on GitHub: https://github.com/ColinJones/cbatticon/issues/3#issuecomment-5170118

valr commented 6 years ago

I don't plan to change this soon. Closing.