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

0anacron fails to detect ac power is on #69

Closed
ovitters opened this issue Oct 29, 2020 · 6 comments
Closed

0anacron fails to detect ac power is on #69

ovitters opened this issue Oct 29, 2020 · 6 comments
Labels
needinfo Needs more information from the reporter

Comments

@ovitters
Copy link

As reported at https://bugs.mageia.org/show_bug.cgi?id=27480:

/etc/cron.hourly/0anacron checks for ac power indicator in
/sys/class/power_supply/AC/online or /sys/class/power_supply/ADP{0..9}/online

The laptop in use uses
/sys/class/power_supply/ACAD/online so cron.hourly assumes the laptop is on
battery and never runs cron.daily, weekly, etc.

A patch was supplied but it won't apply to latest changes in master. It's a matter of adding ACAD as a path to check.

@t8m
Copy link
Member

t8m commented Nov 2, 2020

It is weird that the check would mean that such system is on battery as the default for the online value is 1. It could happen only in case there are other power supply devices present matching the above paths that are actually offline.

@t8m
Copy link
Member

t8m commented Nov 12, 2020

Can you please show output of

for i in /sys/class/power_supply/*/online ; do echo -n "$i: " ; cat $i; done

@t8m t8m added the needinfo Needs more information from the reporter label Nov 12, 2020
@t8m
Copy link
Member

t8m commented Mar 17, 2021

I made the script a little bit more general with 1.5.6 release. If it still doesn't work, please reopen.

@t8m t8m closed this as completed Mar 17, 2021
@zlandau
Copy link

zlandau commented Mar 29, 2021

FYI I had this same problem, and at least for my case, the logic in d8490bb seems reversed. First, my output:

# cat /sys/class/power_supply/axp288_charger/{type,online}
USB
0

This machine isn't powered by a battery at all, just AC. I'm guessing that power supply is for the USB ports or something. If change the battery check from != Batteryx to = Batteryx then anacron runs. But I'm not sure if that was your intention or not.

    if [ `cat "$psupply/type" 2>/dev/null`x = Batteryx ] && [ -f "$psupply/online" ]; then

@t8m
Copy link
Member

t8m commented Mar 29, 2021

Hmm... that's bad. Of course the logic might not be reversed as that would break other cases.

@zlandau
Copy link

zlandau commented Mar 29, 2021

I'm not sure if it's useful, but there's also the 'present' flag which is 0 on that device. I'm not sure if devices with present=0 can just be skipped or not.

$ udevadm info --path=/sys/class/power_supply/axp288_charger
P: /devices/pci0000:00/808622C1:05/i2c-2/i2c-INT33F4:00/axp288_charger/power_supply/axp288_charger
L: 0
E: DEVPATH=/devices/pci0000:00/808622C1:05/i2c-2/i2c-INT33F4:00/axp288_charger/power_supply/axp288_charger
E: POWER_SUPPLY_NAME=axp288_charger
E: POWER_SUPPLY_TYPE=USB
E: POWER_SUPPLY_PRESENT=0
E: POWER_SUPPLY_ONLINE=0
E: POWER_SUPPLY_HEALTH=Unknown
E: POWER_SUPPLY_CONSTANT_CHARGE_CURRENT=1200000
E: POWER_SUPPLY_CONSTANT_CHARGE_CURRENT_MAX=1200000
E: POWER_SUPPLY_CONSTANT_CHARGE_VOLTAGE=4200000
E: POWER_SUPPLY_CONSTANT_CHARGE_VOLTAGE_MAX=4200000
E: POWER_SUPPLY_INPUT_CURRENT_LIMIT=1500000
E: SUBSYSTEM=power_supply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needinfo Needs more information from the reporter
Projects
None yet
Development

No branches or pull requests

3 participants