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

Surface Pro 2017 / Book 2 / Laptop: Battery Status Not Working #28

Closed
geoffholden opened this issue Nov 8, 2017 · 291 comments
Closed

Surface Pro 2017 / Book 2 / Laptop: Battery Status Not Working #28

geoffholden opened this issue Nov 8, 2017 · 291 comments
Assignees
Labels
surface-acpi module Bug/feature-request for the surface-acpi module

Comments

@geoffholden
Copy link
Contributor

The new 2017 version of the Surface Pro has no battery status.
I don't know of any working kernel for this issue.
I suspect this is an ACPI issue, as I have the following lines in my kernel messages:

ACPI Error: [_SB_.PCI0] Namespace lookup failure, AE_NOT_FOUND (20170728/dswload2-191)
ACPI Exception: AE_NOT_FOUND, During name lookup/catalog (20170728/psobject-252)
ACPI Error: Method parse/execution failed \_SB.PCI0.UA02, AE_NOT_FOUND (20170728/psparse-550)
@jakeday
Copy link
Owner

jakeday commented Nov 9, 2017

@geoffholden Can you give me the output of this:

$ ls /sys/bus/acpi/devices

@samsungrocks10
Copy link

samsungrocks10 commented Nov 9, 2017

Oh I have the same (or similar) issue with the battery status not showing/working on the Pro 2017, was actually thinking about making an issue for it after my wifi/network issue was resolved(which it is), then found that there already was one so.

@geoffholden
Copy link
Contributor Author

@jakeday as requested:

% ls /sys/bus/acpi/devices
ACPI0003:00
ACPI000C:00
ACPI000E:00
device:00
device:01
device:02
device:03
device:04
device:05
device:06
device:07
device:08
device:09
device:0a
device:0b
device:0c
device:0d
device:0e
device:0f
device:10
device:11
device:12
device:13
device:14
device:15
device:16
device:17
device:18
device:19
device:1a
device:1b
device:1c
device:1d
device:1e
device:1f
device:20
device:21
device:22
device:23
device:24
device:25
device:26
device:27
device:28
device:29
device:2a
device:2b
device:2c
device:2d
device:2e
device:2f
device:30
device:31
device:32
device:33
device:34
device:35
device:36
device:37
device:38
device:39
device:3a
device:3b
device:3c
device:3d
device:3e
device:3f
device:40
device:41
device:42
device:43
device:44
device:45
device:46
device:47
device:48
device:49
device:4a
device:4b
device:4c
device:4d
device:4e
device:4f
device:50
device:51
device:52
device:53
device:54
device:55
device:56
device:57
device:58
device:59
device:5a
device:5b
device:5c
device:5d
device:5e
device:5f
device:60
device:61
device:62
device:63
device:64
device:65
device:66
device:67
device:68
device:69
device:6a
device:6b
device:6c
device:6d
device:6e
device:6f
device:70
device:71
device:72
device:73
device:74
device:75
device:76
device:77
device:78
device:79
device:7a
device:7b
device:7c
device:7d
device:7e
device:7f
device:80
INT0800:00
INT0E0C:00
INT33A1:00
INT33BE:00
INT3400:00
INT3403:00
INT3403:01
INT3403:02
INT3403:03
INT3403:04
INT3403:05
INT3403:06
INT3403:07
INT3403:08
INT3407:00
INT343D:00
INT343E:00
INT3440:00
INT3441:00
INT3446:00
INT3447:00
INT3449:00
INT344A:00
INT344B:00
INT3470:00
INT3472:00
INT3472:01
INT3472:02
INT347A:00
INT347E:00
INT3F0D:00
LNXCPU:00
LNXCPU:01
LNXCPU:02
LNXCPU:03
LNXCPU:04
LNXCPU:05
LNXCPU:06
LNXCPU:07
LNXPOWER:00
LNXPOWER:01
LNXPOWER:02
LNXPOWER:03
LNXPOWER:04
LNXPOWER:05
LNXPOWER:06
LNXPOWER:07
LNXPOWER:08
LNXPOWER:09
LNXPOWER:0a
LNXPOWER:0b
LNXPOWER:0c
LNXPOWER:0d
LNXSYBUS:00
LNXSYBUS:01
LNXSYSTM:00
LNXVIDEO:00
MSFT0101:00
MSHW0005:00
MSHW0006:00
MSHW0008:00
MSHW0029:00
MSHW0036:00
MSHW0040:00
MSHW0045:00
MSHW0048:00
MSHW0081:00
MSHW0084:00
MSHW0091:00
MSHW0102:00
MSHW0125:00
MSHW0131:00
PNP0000:00
PNP0100:00
PNP0103:00
PNP0A08:00
PNP0B00:00
PNP0C02:00
PNP0C02:01
PNP0C02:02
PNP0C02:03
PNP0C02:04
PNP0C02:05
PNP0C04:00
PNP0C0A:00
PNP0C0D:00
PNP0C0F:00
PNP0C0F:01
PNP0C0F:02
PNP0C0F:03
PNP0C0F:04
PNP0C0F:05
PNP0C0F:06
PNP0C0F:07

@jakeday jakeday changed the title Battery Status on Surface Pro 2017 Surface Pro 2017: Battery Status Not Working Nov 14, 2017
@jakeday jakeday changed the title Surface Pro 2017: Battery Status Not Working Surface Pro 2017 / Book 2: Battery Status Not Working Nov 18, 2017
@jakeday
Copy link
Owner

jakeday commented Nov 18, 2017

The Surface Pro 2017 and Surface Book 2 both share the same MSHW0040 to read battery stats. I'll have to brush up on my DSDT to fix this unless someone is kind enough to help.

@demlow
Copy link

demlow commented Dec 1, 2017

I am keen to get this working (I have a SP2017) but am new to DSDT. So far I've dumped and decompiled the DSDT DSL block. Any pointers would be appreciated.

@demlow
Copy link

demlow commented Dec 12, 2017

@dwitvliet
Copy link

Is there anything the average Linux user can do to help solving this issue? I'm not familiar with DSDT, but I am anxious to get this solved.

@versipellis
Copy link

Likewise, here.

@maflin18
Copy link

maflin18 commented Feb 2, 2018

Same issue here, but on Surface Laptop

@WindChimeRan
Copy link

I guess this one is helpful.
2015 battery bug on Surface3

@jakeday jakeday added surface-acpi module Bug/feature-request for the surface-acpi module and removed bug labels Feb 14, 2018
@forrestblade
Copy link

I believe I have this same issue. I am running a flavor of ubuntu called Pop!_OS and I cannot get my battery to register.

@nish-astuff
Copy link

Based on the dmesg output from my Surface Laptop, this patch may be worth looking into:

https://patchwork.kernel.org/patch/10186187/

@jakeday
Copy link
Owner

jakeday commented Mar 15, 2018

@nish-astuff That is part of a patchset that delays the _STA checks until dependencies are met. However, that's not our issue here. We need the _SAN device further exposed and to handle the RQST calls to _SAN from the other devices (such as BAT1 and BAT2).

@Fabyao
Copy link

Fabyao commented Mar 30, 2018

@jakeday Thank you for the explanations. I am sure you have noticed this guide from ubuntu help:
ACPIBattery. As my knowledge with ACPI is fairly limited, I will start with this guide and report back on my finding.

@zhang-rui
Copy link

I believe this is the same problem discussed in this thread https://bugzilla.kernel.org/show_bug.cgi?id=198145
To me, the problem is that we're missing driver support for SAN in Linux.

@Catley94
Copy link

Catley94 commented Jun 8, 2018

Do you have any repos so I can just update my machine and it will be pushed to my surface? Or do I need to reinstall the kernel everytime there is an update?

Thanks,

@krifisk
Copy link

krifisk commented Dec 3, 2018

ok, so one that is definitely needed is CONFIG_SERIAL_8250_DW , I also added a few others including CONFIG_DMA_ENGINE=y and CONFIG_DMA_ACPI=y that seems likely to be related but I haven't tested in isolation, the full diff of config changes I made to now have a displaying battery monitor is uploaded to https://download.sumptuouscapital.com/tmp/linux-surface/diff.txt

now to figure out if it works correctly, as it doesn't seem to be updating regularly, but at least https://download.sumptuouscapital.com/tmp/linux-surface/Screenshot%20from%202018-12-03%2018-30-11.png is quite a bit better than earlier today :)

And now also;
cpupower -c all frequency-info | grep "current CPU frequency" | grep assert
current CPU frequency: 700 MHz (asserted by call to kernel)
current CPU frequency: 700 MHz (asserted by call to kernel)
current CPU frequency: 700 MHz (asserted by call to kernel)
current CPU frequency: 700 MHz (asserted by call to kernel)
current CPU frequency: 700 MHz (asserted by call to kernel)
current CPU frequency: 700 MHz (asserted by call to kernel)
current CPU frequency: 700 MHz (asserted by call to kernel)
current CPU frequency: 700 MHz (asserted by call to kernel)

@qzed
Copy link
Collaborator

qzed commented Dec 3, 2018

@krifisk Thanks for the diff! The battery estimations fluctuate quite a bit, at least for me. They should also update from time to time, I can't say much to the regularity of this though. The EC does send some update events (or at least I'm interpreting them as such), which, as far as I can tell, don't seem to be regular (I'd say their frequency is power draw related, but I haven't really tested that theory). Also I'm currently using UPower as frontend, which polls the status, so there might be differences.

@krifisk
Copy link

krifisk commented Dec 3, 2018

yes, it fluctuates quite a bit, and indeed it does update, just on infrequent intervals, e.g it updates if detaching / attaching tablet, otherwise it seems to be about every 2-3 minutes or so, so I'll live with that as long as I know it works :) Again, thanks for your work on this.

@qzed
Copy link
Collaborator

qzed commented Dec 3, 2018

e.g it updates if detaching / attaching tablet

Yeah, detaching the tablet causes the EC to send a power state event that also updates the internal battery, so I think that should be the correct behavior.

Again, thanks for your work on this.

No problem. To be honest, I'm mostly doing this for myself, and if I can help others while I'm at it, why not :-)

@thmichel
Copy link

thmichel commented Dec 4, 2018

@qzed: Thanks for your hard work on this.

Could you be so kind to release a recent prebuilt kernel? I am still struggling with compiling a working kernel for my Surface Book 2. I either get battery status or buttons working, but never both :-(

@qzed
Copy link
Collaborator

qzed commented Dec 4, 2018

@thmichel The latest I can give you is 4.18.20 (the IPTS patch isn't ready for 4.19.y). There shouldn't be much of a difference to the 4.18.16 kernel currently available, but I can have a look at it this evening.

@qzed
Copy link
Collaborator

qzed commented Dec 4, 2018

@thmichel 4.18.20 is now available here.

This will probably be the last pre-release build. I'm working on cleaning up the module and integrating it here now.

@efriedli
Copy link

efriedli commented Dec 6, 2018

@thmichel 4.18.20 is now available here.

This will probably be the last pre-release build. I'm working on cleaning up the module and integrating it here now.

Best news I've heard today! Waiting with much anticipation to have some battery readings on my SB2!

@qzed
Copy link
Collaborator

qzed commented Dec 16, 2018

I've just renamed the module to better reflect its purpose (as this has somewhat shifted over time). In case you have the module installed with dkms, this means you should uninstall the module with sudo make dkms-uninstall before you update it (e.g. with git) and then install it Otherwise it may cause some trouble.

@carrylook
Copy link

I haven’t been active on this for a while due to other commitments but I'd like to wade in on the bounty discussion that @remingtonlang brought up earlier this month. First of all, I’d like to point out that the bounty was specifically created for the battery issue because there were many people that desperately needed that feature, including myself. @jakeday jumped in on this issue but his contributions went down the wrong path and he dropped out of the mix early. My contributions were basically a bunch of raw data and some hints as to the direction we needed to move in. @qzed picked up the ball and ran with it, pulling in the open source community and turning it into a ball game. @bpasteur and @Fireobridy had some contributions as well but I’d have to award the MVP to @qzed. If not for his efforts, we would not have battery (and a bunch of other functionality that came with it) today. While I can’t speak for @bpasteur and @Fireobridy I feel that @qzed should claim that bounty, consider it a Christmas present and a thank you from all of us that already got what we wanted, battery status.

@bpasteur
Copy link

Good call @carrylook, I totally agree and would like to add that it's a small reward for all of the time and effort that @qzed has already put in and continues to put into this project... and I have a feeling that the rest of the community monitoring this will agree as well. Thank You!!!

@leonm1
Copy link

leonm1 commented Dec 22, 2018

As the original poster of the bounty, I concur with what @carrylook has said as well. It has definitely been a team effort, but @qzed looks to be MVP. Nothing wrong with taking it! As I said in the original bounty post, if you really don't need it then I think it should still be released to you for a charity of your choice.

@thmichel
Copy link

@thmichel 4.18.20 is now available here.

This will probably be the last pre-release build. I'm working on cleaning up the module and integrating it here now.

Thanks, works perfectly! Hope this will be integrated into the standard Fedora kernel some time...

@nkkollaw
Copy link

nkkollaw commented Dec 23, 2018

Hi, I downloaded and installed all deb files from https://github.com/qzed/linux-surface/releases/tag/v4.18.20-pre1/, and it looks like I'm running 4.18.20, but my battery is still not detected. Are there any additional commands I have to execute besides installing the deb files..?

@qzed
Copy link
Collaborator

qzed commented Dec 24, 2018

@nkkollaw You need to install this module (see "Testing" in the readme for details).

Alternatively you could wait a bit until it's merged into this repo, once that's done you'll only need the kernel. I'll try to get this done in the next couple of days.

@qzed
Copy link
Collaborator

qzed commented Dec 24, 2018

@thmichel

Hope this will be integrated into the standard Fedora kernel some time...

I hope so too! But it'll be a long way until then. There are currently three bugs in the kernel blocking this, and it may take a while to get this sorted out properly (the fixes in the module repo are just quick-fixes). I'll start working on that once the module is integrated here.

@doomdevelop
Copy link

Hi , first thank you so much for so gut job !
I get stuck on building module linux-surfacegen5-acpi, maybe could any one look in to the error >
linux-surface/surface-aggregator-module#11

Thank you !

@jakeday
Copy link
Owner

jakeday commented Dec 27, 2018

Sorry for not updating in awhile, I had some personal stuff that kept me from it. My vote is 100% the bounty should go to @qzed

@jakeday
Copy link
Owner

jakeday commented Dec 28, 2018

This has been merged in and is now working.

@jakeday jakeday closed this as completed Dec 28, 2018
@nkkollaw
Copy link

Not working here despite compiling kernel from master (sorry, I did open another issue #323, I didn't know I could comment on closed issues).

@qzed
Copy link
Collaborator

qzed commented Dec 30, 2018

As you've all decided, I have now claimed the bounty. Thank you all! I really appreciate it! (Also I again want to empathize without your support I would not have been able to fix it!)

@lynscott
Copy link

Hi, just to

This has been merged in and is now working.

Just for clarity, these updates are merged into the latest kernel just released(like 8mins ago)? Eagerly awaiting the acpi-module update. Much thanks to you an all contributors for the work on this.

@jakeday
Copy link
Owner

jakeday commented Dec 31, 2018

@lynscott yes, they are merged into the latest prebuilt!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
surface-acpi module Bug/feature-request for the surface-acpi module
Projects
None yet
Development

No branches or pull requests