Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery indicator on RG280V shows empty #254

Closed
Rabobert opened this issue Jun 1, 2022 · 10 comments
Closed

Battery indicator on RG280V shows empty #254

Rabobert opened this issue Jun 1, 2022 · 10 comments
Assignees

Comments

@Rabobert
Copy link

Rabobert commented Jun 1, 2022

What happened?

Also Apps show "RG350 test" instead of RG280V.

Device

RG280V

Version

v1.4.2

@neilswann80
Copy link
Collaborator

I'm running an RG280v on 1.4.2... my battery indicator is working perfectly, so possibly a hardware issue?

Also Apps show "RG350 test" instead of RG280V.

Do you mean the button test app? If so, that is normal.

@Rabobert Rabobert closed this as completed Jun 2, 2022
@eduardofilo
Copy link
Owner

That application is only suitable for the RG350, that's why it's called that. Used on the RG280V it produces uncontrolled results such as the battery level. Just don't use it on RG280V. The image is common for several machines and there are things that go better or worse on some models.

@eduardofilo
Copy link
Owner

Correction. The problem of incorrect battery measurement is not because the application is designed for RG350. I have checked that on that machine it also indicates 0%. The application is compiled for stock system and ODbeta must have changed the hooks to get that information. I will try to locate an equivalent application that works well on ODbeta to replace it in a future revision of the image. I reopen the issue to keep this in mind.

@eduardofilo eduardofilo reopened this Jun 2, 2022
@a-dekker
Copy link

a-dekker commented Jun 2, 2022

@eduardofilo fyi, this fixed the battery indicator for me:

diff --git a/src/main.cpp b/src/main.cpp
index 45b7ce8..c1bfa7d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -518,7 +518,7 @@ unsigned short get_batterylevel()
     lastChecking=SDL_GetTicks();

     FILE *batteryHandle = NULL;
-    batteryHandle = fopen("/sys/class/power_supply/battery/voltage_now", "r");
+    batteryHandle = fopen("/sys/class/power_supply/jz-battery/voltage_now", "r");
     if (batteryHandle) {
       /* voltaje maximo de la RG es 4320000 */
 #define MAX_VOLTAGE 4200000

The current cpu frequency is also an issue. It reads /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_cur_freq for that, but only root is allowed to read this value in OD-beta. If I open up the permissions by hand, I get the current frequency displayed for that moment. Haven't found a proper solution yet.

@eduardofilo
Copy link
Owner

Perfect. That way I don't have to look for it. I had found @RafaVico's repository, but little else.
I see in the code the part that gets the frequency, but then in the application I don't see where it shows it. Theoretically three question marks (???) should appear as it can't read the frequency, but they don't appear in the application interface. I mean that maybe that is not shown even solving the problem that can only be read with root.

@a-dekker
Copy link

a-dekker commented Jun 2, 2022

I guess the frequency part (with a cpu logo) is added in a later stage and not visible in most versions found on the internet.
And indeed, it shows "???" when it fails to read the value.

@eduardofilo
Copy link
Owner

OK, I understand. The version installed in the image is 1.3d and in the repository I see that it is 1.4. I will include it after correcting the battery issue. I will think about removing the part that shows the frequency so that the question marks do not appear. Thank you.

@a-dekker
Copy link

a-dekker commented Jun 2, 2022

Maybe we don't need to remove the cpu freq part. Just noticed we can read /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq instead of /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
Not 100% these values are always identical, but in my case they do match.
image

@eduardofilo
Copy link
Owner

Then we have all the pieces. Thank you very much @a-dekker.

eduardofilo added a commit that referenced this issue Jun 4, 2022
eduardofilo added a commit that referenced this issue Jun 4, 2022
@eduardofilo
Copy link
Owner

Done. I have already added to the repository the OPK version of RG350 test that includes the changes you proposed @a-dekker. It will be included in the next release. In the meantime you can install it manually by deleting the file /media/data/apps/rg350test_v1.3d.opk and placing this one in the same directory.

@kaossino kaossino mentioned this issue Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants