-
Notifications
You must be signed in to change notification settings - Fork 11
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 Book 3 battery support #44
Comments
Preliminary support for this has been implemented in f2339db. @steveniemitz Can you test that this works as expected. Can you also check how this behaves when the clipboard is detached. Likely we'll have to remove the battery device, similar to the HID devices (touchpad/keyboard). |
According to the log in linux-surface/linux-surface#201 (comment), the events should be enabled via KIP and IID=0. @steveniemitz or @NickyTope, can you try to confirm this by commenting-in this line, building the module with debug output (or change surface-aggregator-module/module/surface_sam_sid_power.c Lines 581 to 582 in b1bd428
dev_info or something like that) and trying to trigger battery events on the second channel (e.g. disconnect AC and wait until the first events arrive, could take a bit; maybe detaching also works, but I have no clue how the second battery behaves with that yet)?
With debug output enabled or the line changed, you can grep dmesg for
and confirm that the events are disabled. After that, enable events again with
and confirm they're working again. |
@qzed I've tried to follow your guides (I also own SB3), but it seems I'm missing something - device is missing:
I've built module from |
Oh, right. I forgot to mention: You'll have to comment-in this line (and re-build the module) for the script to work. |
@qzed seems to be working as expected! boot
disconnecting AC
discharging...
AC back
Executing disconnecting AC
discharging...
AC back
Executing disconnecting AC
|
@xanf Perfect, thanks! I'll merge the current battery driver into master. The last thing we need to figure out is how the battery behaves when detaching. Could you try to detach the clipboard and check how upower/your desktop environment shows the second battery when detached (on Gnome, displays for both batteries individually can be found in the settings app). Specifically, does it show the second battery as present/having some charge/0% charge or does it (correctly) show the battery as disconnected/not present? |
@qzed on detaching it takes up to two minutes for extra battery to disappear. Offtopic: it seems HDMI is not restored on attaching device (and sometimes simply on resume from suspend) :( |
Neat, thanks for testing! So I think we should remove the battery device on detaching. Edit: I think the 2 minute timeout might come from upower, polling the device. So there doesn't seem to be any event/notification sent when the base is disconnected, meaning the disconnect is only noticed when upower actively polls the device the next time. I've merged the current state into the linux-surface repo, so there should now be basic battery, keyboard, and touchpad support for the SB3 built into the kernel packages. No clue what's wrong with the HDMI thing. AFAIK that's over USB? Could be that some PM quirk or something has to be set. |
"over USB" - kind of |
Ah, thanks for the link! |
@qzed just a quick check - should built-in keyboard / touchpad be non-functional on detach/reattach with latest master of this repo? |
IIRC @steveniemitz indicated that the keyboard works and touchpad does too, however only in single-touch mode. There could also be other problems (such as them not working at all). Essentially what we should do is disconnect/remove all of those devices (battery, keyboard, touchpad, ...) in-kernel when the base is detached and re-attach/re-create them when the base is re-attached. That's still on my todo-list and I'm probably going to open up a separate issue for that soon-ish. So TLDR: There currently isn't any handling at all for detach/re-attach in these driver (apart from DTX on feature/sb3-v3, which is another thing entirely), so behavior will depend on how the subsystem (and potentially user-space) handles that. |
yeah I think something might have regressed at some point, it looks like the keyboard/touchpad don't get re-enabled on re-attach anymore. I think this is also tracked in #42, but also agree it might be better to open a new issue for the device remove/add feature. |
In the mean time, you should be able to work around this issue by re-loading the |
As the main support for the battery has been implemented, I'm going to close this issue. The detach/attach issues will be handled via #46. |
The second battery in the Book 3 seems to use a separate event system, likely
KIP
. This has yet to be confirmed.The text was updated successfully, but these errors were encountered: