Support in other languages: 
Reply
Fanfold Paper
wujj123456
Posts: 16
Registered: ‎02-17-2012
Location: United States
0

Any way to query the AC adapter info?

Hi

 

I am looking for a way to identify my AC adapter info.   I have two adapters, one is 65W and the other is 90W.   From /proc/acpi/ac_adapter/AC/state, I can only check if power adapter is connected, but I want to extract the detailed power adapter information.  Something similar to /proc/acpi/battery/BAT0/info. 

 

In addition, I want to write some bash script that behave differently depending on if power is plugged in.  Is there a way to get informed after user plug in/pull the power cord?  I can continuously cat /proc/acpi/ac_adapter/AC/state, but I want a more elegant solution such as catching the event or signal.  

 

Thanks. 

RMattoo
Posts: 1,241
Topics: 3
Kudos: 94
Solutions: 91
Registered: ‎11-02-2011
Location: India
0

Re: Any way to query the AC adapter info?

[ Edited ]

Hi

 

Thanks for your post.

 

I found a possible solution at this site:

 

"Proposed Fix Directions:


1. Make sure your system is fully up to date, either by running Update Manager, or "sudo apt-get -y update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade" Be sure to reboot your system when finished.

2. Install the KernelCheck debian from http://kcheck.sourceforge.net/download.html if you havent already (make sure your running the latest version if you have).

3. Use typical installation to build your kernel. You could use custom if you like, but I find that none of the options (including nvidia options) were required.

4. When the graphical version of the kernel config displays (towards the end, takes a while because it has to download a bunch of packages to prep your system for building the kernel, as well as download and extract the linux sources for the new kernel), search for or find "AC Adapter" (the related kernel config key you are looking for is ACPI_AC, but I didnt check if that was searchable). Make sure to select it such that the checkbox next to it is a DOT not a CHECK (this based on the help instructions tells the system to compile ACPI_AC as a module, which is the whole reason to recompile the kernel). Once you are done hit SAVE (very important otherwise your changes are lost), and exit the graphical config.

5. From here the kernel will compile and be packaged as a deb for you, as well as installed automatically. Like it says, it really does take 2-4 hours, so come back in a bit.

6. Reboot your system and thats it. From now on it should detect the ac adapter correctly, and it shouldnt throw out any ACPI errors in the startup log. You can check that it worked by looking at "dmesg | grep ACPI | less" and looking for "ACPI: AC Adapter [AC] (on-line)" (towards the bottom)"

 

Hope it helps!

Cheers!!!

 

Post edited for clarity

Fanfold Paper
wujj123456
Posts: 16
Registered: ‎02-17-2012
Location: United States
0

Re: Any way to query the AC adapter info?

Hi RMattoo,

 

Thank you for the reply.  I finally have some time to check out the solution.  It seems that kernelcheck is too old.  It defaults to 2.6.13 kernel on my computer, and even with custom install, I can select 2.39.xx at most. I am currently running 3.0.0-17, which was the latest for Ubuntu 11.10/Mint 12. 

 

Are you aware of other tools that can prepare kernel compilations?  Thanks.

Fanfold Paper
wujj123456
Posts: 16
Registered: ‎02-17-2012
Location: United States
0

Re: Any way to query the AC adapter info?

Sorry for bumping this thread now.  I just found that CONFIG_ACPI_AC is always enabled in my kernel, and dmesg shows ACPI AC adapter info.  Please let me know if anyone have further suggestions.