特殊:Badtitle/NS100:ACPIBattery:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
(未显示同一用户的5个中间版本) | |||
第30行: | 第30行: | ||
=== Obtaining Intel's iasl compiler === | === Obtaining Intel's iasl compiler === | ||
The DSDT has to be compiled. For this we need a special compiler from Intel. Download there Unix source | The DSDT has to be compiled. For this we need a special compiler from Intel. Download there Unix source | ||
[http://www. | [http://www.acpica.org/downloads/ here]. You might have to replace the download | ||
link in the following. | link in the following. | ||
<pre><nowiki> | <pre><nowiki> | ||
tar zxf acpica-unix-20050624.tar.gz | tar zxf acpica-unix-20050624.tar.gz | ||
cd acpica-unix-20050624/compiler | cd acpica-unix-20050624/compiler | ||
第149行: | 第148行: | ||
bootoption default). | bootoption default). | ||
=== Links === | === Links === | ||
[http://acpi.sourceforge.net acpi.sf.net] - ACPI Homepage< | [http://acpi.sourceforge.net acpi.sf.net] - ACPI Homepage<<BR>> | ||
[http://forums.gentoo.org/viewtopic.php?t=122145 Gentoo Forums] - How to fix a DSDT yourself< | [http://forums.gentoo.org/viewtopic.php?t=122145 Gentoo Forums] - How to fix a DSDT yourself<<BR>> | ||
[http://www.intel.com/technology/IAPC/acpi/downloads.htm Intel ACPI] - Download iasl compiler< | [http://www.intel.com/technology/IAPC/acpi/downloads.htm Intel ACPI] - Download iasl compiler<<BR>> | ||
[http://gaugusch.at/kernel.shtml gaugusch.at] - the kernel patch to make this work | [http://gaugusch.at/kernel.shtml gaugusch.at] - the kernel patch to make this work | ||
=== Another possible solution (workaround) === | === Another possible solution (workaround) === | ||
第180行: | 第179行: | ||
In a more detailed way, here's what I did and what you can do (at your own risk!): | In a more detailed way, here's what I did and what you can do (at your own risk!): | ||
1. Using a text editor, put the following content in a file and save it: | 1. Using a text editor, put the following content in a file and save it: | ||
<pre><nowiki> | <pre><nowiki> | ||
#!/bin/bash | #!/bin/bash | ||
第189行: | 第189行: | ||
3. Use the Ksysv editor (or whatever it is called in K menu/system or in the "System settings"/System Administration/System services), in order to make this script run at each boot time (you can make it run just before the "kdm" script; it works for me). | 3. Use the Ksysv editor (or whatever it is called in K menu/system or in the "System settings"/System Administration/System services), in order to make this script run at each boot time (you can make it run just before the "kdm" script; it works for me). | ||
4. Make another copy of this file, name it "37-modules-load-battery.sh", make it executable (in a console, you can use the command "sudo chmod a+x 37-modules-load-battery.sh"), and put this file in /etc/acpi/resume.d; it will run at each resume from hibernate state. | 4. Make another copy of this file, name it "37-modules-load-battery.sh", make it executable (in a console, you can use the command "sudo chmod a+x 37-modules-load-battery.sh"), and put this file in /etc/acpi/resume.d; it will run at each resume from hibernate state. | ||
---- | ---- | ||
[[category:CategoryLaptop]] [[category:CategoryHardware]] | [[category:CategoryLaptop]] [[category:CategoryHardware]] | ||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2010年5月19日 (三) 17:14的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/ACPIBattery }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/af | • {{#if: UbuntuHelp:ACPIBattery|Afrikaans| [[::ACPIBattery/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/ar | • {{#if: UbuntuHelp:ACPIBattery|العربية| [[::ACPIBattery/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/az | • {{#if: UbuntuHelp:ACPIBattery|azərbaycanca| [[::ACPIBattery/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/bcc | • {{#if: UbuntuHelp:ACPIBattery|جهلسری بلوچی| [[::ACPIBattery/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/bg | • {{#if: UbuntuHelp:ACPIBattery|български| [[::ACPIBattery/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/br | • {{#if: UbuntuHelp:ACPIBattery|brezhoneg| [[::ACPIBattery/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/ca | • {{#if: UbuntuHelp:ACPIBattery|català| [[::ACPIBattery/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/cs | • {{#if: UbuntuHelp:ACPIBattery|čeština| [[::ACPIBattery/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/de | • {{#if: UbuntuHelp:ACPIBattery|Deutsch| [[::ACPIBattery/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/el | • {{#if: UbuntuHelp:ACPIBattery|Ελληνικά| [[::ACPIBattery/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/es | • {{#if: UbuntuHelp:ACPIBattery|español| [[::ACPIBattery/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/fa | • {{#if: UbuntuHelp:ACPIBattery|فارسی| [[::ACPIBattery/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/fi | • {{#if: UbuntuHelp:ACPIBattery|suomi| [[::ACPIBattery/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/fr | • {{#if: UbuntuHelp:ACPIBattery|français| [[::ACPIBattery/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/gu | • {{#if: UbuntuHelp:ACPIBattery|ગુજરાતી| [[::ACPIBattery/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/he | • {{#if: UbuntuHelp:ACPIBattery|עברית| [[::ACPIBattery/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/hu | • {{#if: UbuntuHelp:ACPIBattery|magyar| [[::ACPIBattery/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/id | • {{#if: UbuntuHelp:ACPIBattery|Bahasa Indonesia| [[::ACPIBattery/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/it | • {{#if: UbuntuHelp:ACPIBattery|italiano| [[::ACPIBattery/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/ja | • {{#if: UbuntuHelp:ACPIBattery|日本語| [[::ACPIBattery/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/ko | • {{#if: UbuntuHelp:ACPIBattery|한국어| [[::ACPIBattery/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/ksh | • {{#if: UbuntuHelp:ACPIBattery|Ripoarisch| [[::ACPIBattery/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/mr | • {{#if: UbuntuHelp:ACPIBattery|मराठी| [[::ACPIBattery/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/ms | • {{#if: UbuntuHelp:ACPIBattery|Bahasa Melayu| [[::ACPIBattery/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/nl | • {{#if: UbuntuHelp:ACPIBattery|Nederlands| [[::ACPIBattery/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/no | • {{#if: UbuntuHelp:ACPIBattery|norsk| [[::ACPIBattery/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/oc | • {{#if: UbuntuHelp:ACPIBattery|occitan| [[::ACPIBattery/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/pl | • {{#if: UbuntuHelp:ACPIBattery|polski| [[::ACPIBattery/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/pt | • {{#if: UbuntuHelp:ACPIBattery|português| [[::ACPIBattery/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/ro | • {{#if: UbuntuHelp:ACPIBattery|română| [[::ACPIBattery/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/ru | • {{#if: UbuntuHelp:ACPIBattery|русский| [[::ACPIBattery/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/si | • {{#if: UbuntuHelp:ACPIBattery|සිංහල| [[::ACPIBattery/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/sq | • {{#if: UbuntuHelp:ACPIBattery|shqip| [[::ACPIBattery/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/sr | • {{#if: UbuntuHelp:ACPIBattery|српски / srpski| [[::ACPIBattery/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/sv | • {{#if: UbuntuHelp:ACPIBattery|svenska| [[::ACPIBattery/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/th | • {{#if: UbuntuHelp:ACPIBattery|ไทย| [[::ACPIBattery/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/tr | • {{#if: UbuntuHelp:ACPIBattery|Türkçe| [[::ACPIBattery/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/vi | • {{#if: UbuntuHelp:ACPIBattery|Tiếng Việt| [[::ACPIBattery/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/yue | • {{#if: UbuntuHelp:ACPIBattery|粵語| [[::ACPIBattery/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/zh | • {{#if: UbuntuHelp:ACPIBattery|中文| [[::ACPIBattery/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/zh-hans | • {{#if: UbuntuHelp:ACPIBattery|中文(简体)| [[::ACPIBattery/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:ACPIBattery | UbuntuHelp:ACPIBattery | {{#if: | :}}ACPIBattery}}/zh-hant | • {{#if: UbuntuHelp:ACPIBattery|中文(繁體)| [[::ACPIBattery/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:ACPIBattery|:ACPIBattery|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :ACPIBattery/zh | | {{#ifexist: ACPIBattery/zh | | {{#ifeq: {{#titleparts:ACPIBattery|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:ACPIBattery|1|-1|}} | zh | | }}
This page is missing a diagnostic guide to be sure that the problem described here is what is happening to a specific system. If you know how to test for this issue please add such a diagnostic guide.
Introduction
Some Notebooks don't display the battery status. This HOWTO will show you how to fix this annoying problem. I am aware there are a lot of forum posts on this but none show you how to easily fix the problem. Note: The Ubuntu kernel already contains the patch that is needed for this to work, so no recompiling of the kernel is needed in this HOWTO!
Prerequisites
We need to compile some stuff along the way, so we need the package build-essential. We also need the packages flex-old (which will replace flex) and bison.
sudo apt-get install build-essential bison flex-old
The DSDT for your notebook
The DSDT (Differentiated System Description Table) sits in your BIOS and gives Linux all the information on your computer. Yours is obviously messed up, so we have to get a new one. Go to the ACPI page at sourceforge and in the menu on the left click on DSDT and View. Here you can select your manufacturer, model and BIOS version. On the page you will get then, you can download a fixed DSDT for your notebook. If there is none for you notebook, see the links at the end of this document. If there is no DSDT for you BIOS version, update your BIOS (which in fact might already fix the problem). So copy the download address (to paste it to the console) and in your $HOME do:
mkdir acpi cd acpi wget http://acpi.sourceforge.net/dsdt/tables/Manufacturer/Model/DSDT.asl.gz gzip -d DSDT.asl.gz
(the link after wget has to be replaced with the link to your DSDT)
Obtaining Intel's iasl compiler
The DSDT has to be compiled. For this we need a special compiler from Intel. Download there Unix source here. You might have to replace the download link in the following.
tar zxf acpica-unix-20050624.tar.gz cd acpica-unix-20050624/compiler make cp iasl ../.. cd ../..
If the make didn't work I can only assume that bison is not installed or you still have the flex instead of flex-old.
Compiling your DSDT
Since the 2005 versions of iasl are more restrictive than older versions your DSDT might not compile. You can either try to find an older version of iasl (I couldn't) or fix the DSDT by yourself (I will explain this).
cp yourdsdtfile.asl dsdt.asl # backup ./iasl -tc dsdt.asl # compiling
If this works you should get 0 errors, a couple of warnings and two new files. A .hex and a .aml file. If it
doesn't you will have alot of error messages telling you a ResourceSource
string is missing. These
errors are easy to fix. Keep the windows with the compile errors open, since we will need the line numbers.
What the errors might look like:
dsdt.asl 1028: 0x0100, 0x00) Error 1094 - ^ Missing ResourceSource string (required) dsdt.asl 1034: 0x00000CF8, 0x00) Error 1094 - ^ Missing ResourceSource string (required) dsdt.asl 1041: 0x0000F300, 0x00) Error 1094 - ^ Missing ResourceSource string (required)
Lets open the .asl file and look at line 1028.
gedit dsdt.asl&
It looks like this:
1023 WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode, 1024 0x0000, /* Address Space Granularity */ 1025 0x0000, /* Address Range Minimum */ 1026 0x00FF, /* Address Range Maximum */ 1027 0x0000, /* Address Translation Offset */ 1028 0x0100, 0x00)
What we have to do is simply remove the 0x00
so that line 1028 looks like
1028 0x0100)
Do this for all missing ResourceSource string
errors (they should all be in the same place), save the
file and close gedit. Now compile again with ./iasl -tc dsdt.asl
and watch the magic.
Some backups
As we don't want to mess with your working system we'll work on a backup and add that backup to your bootloader.
sudo -s -H # followed by user pw cp /boot/initrd.img-2.6.10-5-686 /boot/initrd.img-2.6.10-5-386.acpi cp /boot/vmlinuz-2.6.10-5-686 /boot/vmlinuz-2.6.10-5-386.acpi exit
To be able to boot from this kernel-copy we need to add a section for it to the grub bootloader.
gedit /boot/grub/menu.lst&
Add a section that looks like this (see other sections in your menu.lst for comparison)...
title Ubuntu, kernel 2.6.10-5-386 Battery root (hd0,3) kernel /boot/vmlinuz-2.6.10-5-386.acpi root=/dev/hda4 ro quiet splash initrd /boot/initrd.img-2.6.10-5-386.acpi savedefault boot
...and place it where you want it to appear in the bootmenu.
Putting your DSDT into initrd
What remains is to actually add the DSDT to your initrd. There are 2 ways of doing this. The first one is to patch the initrd.img file, so that the initrd.img will include the DSDT. (NOTE: if you are a BREEZY user the second method is prefered):
echo -n "INITRDDSDT123DSDT123" >> /boot/initrd.img-2.6.10-5-386.acpi cat dsdt.asl >> /boot/initrd.img-2.6.10-5-386.acpi
The alternative option is to add the DSDT.aml file in a specific place so that the default initrd image will search for it and load it on boot. As a bonus, with every kernel update the DSDT will be loaded. Beware that if the DSDT is incorrect it may lead to a kernel panic. If you are using HOARY or below: Once you have the DSDT compiled, copy the DSDT.aml in /etc/mkinitrd/DSDT (without the extension, I don't know if this is necessary):
sudo cp dsdt.aml /etc/mkinitrd/DSDT
Then reconfigure the kernel package you are using:
sudo dpkg-reconfigure linux-image-$(uname -r)
If you are using BREEZY or DAPPER, the location to put the DSDT.aml file has changed, it's:
/etc/mkinitramfs/DSDT.aml
WITH the extension! it's necessary. Then reconfigure the kernel package as before:
sudo dpkg-reconfigure linux-image-$(uname -r)
If you are using EDGY, the location to put the DSDT.aml file has changed, it's:
/etc/initramfs-tools/DSDT.aml
WITH the extension! it's necessary. Then reconfigure the kernel package as before:
sudo dpkg-reconfigure linux-image-$(uname -r)
That's it. Reboot your computer and pick the newly created bootoption. If it all works out you can savely remove the $HOME/acpi directory and modify the bootmenu as you like (i.e. make the new bootoption default).
Links
acpi.sf.net - ACPI Homepage<
>
Gentoo Forums - How to fix a DSDT yourself<
>
Intel ACPI - Download iasl compiler<
>
gaugusch.at - the kernel patch to make this work
Another possible solution (workaround)
If fixing your DSDT file like suggested avove doesn't solve your battery monitoring problem, you can try the folowing simple workaround. In my case, it seems that if I unload and reload the "battery" module, everything works fine after. But before unloading the battery module, I need to unload the smart battery module (acpi_usb).
- How to determine if this solution works for you:
To try this solution, do the following: Open a terminal and enter the following commands, in this order:
sudo rmmod acpi_sbs sudo rmmod battery sudo modprobe battery
Then, enter this command:
sudo acpi -V
if you see someting like this:
Battery 1: charging, 100% Thermal 1: ok, 56.0 degrees C AC Adapter 1: on-line
Then, voila, your battery is now detected and monitored and you now know that this solution works in your case. If you don't see any reference to the battery after issuing the "acpi -V" command, the problem may be more complex...
- Fixing the problem in a permanent way with this workaround:
I have created special init scripts that I put in /etc/init.d and /etc/acpi/resume.d in order to unload-reload battery module at each boot and resume after hibernation. In a more detailed way, here's what I did and what you can do (at your own risk!): 1. Using a text editor, put the following content in a file and save it:
#!/bin/bash rmmod acpi_sbs rmmod battery modprobe battery
2. Make a copy of this file, name it "modules-load-battery", make it executable (in a console, you can use the command "sudo chmod a+x modules-load-battery") and put this file in /etc/init.d 3. Use the Ksysv editor (or whatever it is called in K menu/system or in the "System settings"/System Administration/System services), in order to make this script run at each boot time (you can make it run just before the "kdm" script; it works for me). 4. Make another copy of this file, name it "37-modules-load-battery.sh", make it executable (in a console, you can use the command "sudo chmod a+x 37-modules-load-battery.sh"), and put this file in /etc/acpi/resume.d; it will run at each resume from hibernate state.