direc85 / harbour-batterybuddy

Battery level alert for Sailfish OS
GNU General Public License v3.0
7 stars 8 forks source link

[PineTab] add device file paths #60

Closed nephros closed 1 year ago

nephros commented 1 year ago

This adds support for the PineTab port.

This device seems to lack charge control capability AFAICS, but the readouts work fine.

nephros commented 1 year ago

Note: by adding the second charger file (the PineTab has both AC and USB charging), charger is displayed as "not connected" when USB is not attached, and AC is.

I assume the order of files does that (USB file is there and shows disconnected which is true, so no ore checking is done).
Maybe there should be separate handling of AC and USB charging. I admit it's rare for phones, but I'd say common for Laptops ATM.

nephros commented 1 year ago

Note2: the temperature file (/sys/class/power_supply/axp20x-battery/hwmon0/in0_input) shows a four-digit integer which I assume is deg C to two digits. Currently BB shows e.g. 386° from that - not a healthy temperature to be at ;)

nephros commented 1 year ago

Ah, hold on - I forgot to add the things to the service source as well.

There seems to be quite some duplication in code - any special reason for that?

direc85 commented 1 year ago

This adds support for the PineTab port.

Great addition! Thank you already!

Note2: the temperature file (/sys/class/power_supply/axp20x-battery/hwmon0/in0_input) shows a four-digit integer which I assume is deg C to two digits.

This seems to be the case indeed, according to the source I found.

nephros commented 1 year ago

So, both chargers, USB and AC have a writable online sysfs file, which can be used to have the charger connected but not charging the battery (write 0 --> charger will not charge, write 1, resumes charging).

This could be used to implement the charge limit, but I'll not do that in this PR at the moment.

There is also an online file for the battery, would be cool to be able to take that offline (so power draw only over charger) but it's not writable.

direc85 commented 1 year ago

This starts to look quite good! Do you think it's ready to be merged? :)

nephros commented 1 year ago

Yes, it seems to work fine so far.

BUT I'm seeing an issue where the device wakes up from sleep every XX seconds, and shows a 'charging...' prompt even though no charger is connected. The sysfs 'present' file also goes from 0 to 1 when that happens.

It's maybe unrelated to BB but I'd like to rule it out.

Have you ever seen something like that being caused by e.g. the daemon?

direc85 commented 1 year ago

No, I don't have that issue. BB doesn't write to that file either, it only reads it, without changing the permissions either...

I'll merge this now, please open a separate issue about that behaviour if you find it BB related.

Thank you very much for your contribution!