Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Auto-battery usage?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6271
Location: /usr/lib64/lv2

PostPosted: Wed Sep 26, 2018 2:25 pm    Post subject: Auto-battery usage? Reply with quote

I'm looking for a program or script that will monitor my laptop's battery level, switch to battery power when it's 100%, and switch back to A/C when it reaches a certain low point - all without removing the power cord.

Is this possible? Is there something in Portage for this?
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 778
Location: usually offline

PostPosted: Wed Sep 26, 2018 3:14 pm    Post subject: Reply with quote

Can you manually switch to battery power while connected to A/C power?
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6271
Location: /usr/lib64/lv2

PostPosted: Wed Sep 26, 2018 4:11 pm    Post subject: Reply with quote

Good question. I don't even know if this can be done, manually or automatically.
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 778
Location: usually offline

PostPosted: Wed Sep 26, 2018 4:54 pm    Post subject: Reply with quote

If you can't make it happen manually, I don't think we can script to make it happen automatically.
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey


Last edited by josephg on Wed Sep 26, 2018 6:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6271
Location: /usr/lib64/lv2

PostPosted: Wed Sep 26, 2018 5:19 pm    Post subject: Reply with quote

I dunno if I can make it happen manually or otherwise. That's what I'm asking.
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 3485
Location: Dallas area

PostPosted: Wed Sep 26, 2018 5:33 pm    Post subject: Reply with quote

I don't think you can make it go to battery when it's plugged to the wall. I think that's internal to the laptop.
At least I've never heard of that being possible.
What happens is when the battery is 100% charged the charging element stops, but again that's automatic.
_________________
Asus m5a99fx, FX 8320 - nouveau & radeon, oss4
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
4.14.62 kernel, profile 17.0 (no-pie) amd64-no-multilib
gcc 7.3.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6271
Location: /usr/lib64/lv2

PostPosted: Fri Sep 28, 2018 8:33 pm    Post subject: Reply with quote

Yeah. I didn't think it was possible, but I wanted to ask because it'd be cool if I could do it. Thanks for the replies. 8)
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 778
Location: usually offline

PostPosted: Sat Sep 29, 2018 11:55 am    Post subject: Reply with quote

You might be able to do it, but you'd need some kinda hardware switching circuit which you could trigger with some scripting. You can easily check battery voltage through the acpi framework.
Code:
$ acpi --details --everything --show-empty

_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
joanandk
n00b
n00b


Joined: 12 Feb 2017
Posts: 65

PostPosted: Sat Sep 29, 2018 6:32 pm    Post subject: Reply with quote

audiodef wrote:
Good question. I don't even know if this can be done, manually or automatically.


If you do not shy to use external hardware, you could use usb-powered relay to switch the mains manually/by script: https://acroname.com/products/r341-usbrly02?sku=R341-USBRLY02

I have been using this module very long time and it does the work very well. You also have a second channel to do other stuff. The module is detected as ttyACM0 and there is an example c source.

BR
Back to top
View user's profile Send private message
Akkara
Administrator
Administrator


Joined: 28 Mar 2006
Posts: 6522
Location: &akkara

PostPosted: Sat Sep 29, 2018 9:36 pm    Post subject: Reply with quote

I assume you're wanting to do this so that there isn't a high level of charge on the battery all the time, which shortens its life? If that is the reason, ...

What kind of laptop is it?

Some Dells have a bios setting to configure intended use. There's one that says, in effect, "mostly plugged into AC" (I don't recall the exact words used). I haven't checked to see exactly what this does. But if it doesn't keep as high a level of charge on the batteries, it'll help them last longer.

Apple laptops with the "magsafe" power connectors can be tricked into using power to run the system, but not charge the battery. Just break the connection between the center "pogo pin" of the 5-pin connector at the end of the power brick, and its mate on the laptop. Carefully inserting a thin strip of paper across it and holding it there as you attach the connector will do the trick [**]. A thin strip of cellophane also works well and can be easier to maneuver into place. This breaks the communication to the little "ID"-chip inside the connector. With the laptop unable to identify the source of power, it won't try to charge the battery. Remove the strip of paper to charge again.

** Make sure only the center pin is affected and that the connector and receptacle are clean to make good contact on the other pins. And make sure it isn't thick paper, otherwise the outside power pins don't connect as well and it can get hot, which will cause damage if things start to melt. Make sure it stays cool to the touch when you first try this. There's power conversion circuitry nearby inside the laptop so some warming from that is normal. But it must never get hot enough that you pull away in surprise.
_________________
Humility means not having to eat as much crow when you are shown to be wrong.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum