Comments (22)
Ok, I got a working driver here. Feedback is appreciated. I've tested it on a Surface Book 2 (Debian Buster, 4.16) but it should also work on the Surface Pro (2017).
There is an issue though. Both, Surface Book 2/Surface Pro (2017) and Surface Pro 4 use the same _HID
(namely MSHW0040
) but the IO model is different. The Surface Pro 4 uses ACPI notifications, whereas the Surface Book 2 uses GPIO interrupts. The problem now is that both drivers want to be registered for MSHW0040
. So we need a way to differentiate between SB2 and SP4 when loading those drivers. I have no idea how that should be done, I'm open for hints/suggestions.
Also, this driver is largely based on soc_button_array.c
, so it might make sense to write a patch for this once the issue above has been handled.
from linux-surface.
I haven't finished the buttons for the Pro 2017 yet. I'll do that soon and report back here.
from linux-surface.
@andreweskild It's only an issue with the Pro 2017 and Book 2. The others use more of a standard DSDT from the BIOS.
from linux-surface.
Auto rotate screen dont work..
from linux-surface.
@qzed I agree, we could just add the device hid to the existing module and make the change for the mapping there. I went ahead and included your module next to the other surface button drivers (cause they mostly did the same thing) and it'll be in my next kernel release in a few minutes. Great job!
from linux-surface.
No worries, take your time
from linux-surface.
The Surface Pro 2017 and Surface Book 2 both share the same MSHW0040 to control the buttons. I'll have to brush up on my DSDT to fix this unless someone is kind enough to help.
from linux-surface.
I'm not entirely familiar with dsdt patching, I'll spend some time with over the next couple days, see what I can come up with. On that note, to your knowledge is this an issue that only affects the pro 17/book 2, because I was under the impression that the pro 4 also used the MSHW0040 device to control the buttons
from linux-surface.
I see. It would probably be helpful to have a look at the DSDT of the surface pro 4. I don't suppose you have a Surface Pro 4? And if so, would it be too much trouble to ask for a copy of your DSDT/SSDTs?
Thanks.
from linux-surface.
I happen to be decent at DSDT-related work. Can somebody dump theirs and post it here? (preferably with model info, etc.)
from linux-surface.
@npjohnson demlow posted this in another issue: https://bugzilla.kernel.org/show_bug.cgi?id=198145
I think you'll find what you need there.
For some reason my DSDT was different (9000 more lines) from the one posted in the link above. Here's a diff https://hastebin.com/talifiguka.php
from linux-surface.
@npjohnson I'm not sure how to dump the DSDT/SSDT, if there's something you can point me to, I'd be more than willing to help where I can.
from linux-surface.
@npjohnson Here is the DSDT for surface book 2 15" any help or tips will be greatly appreciated.
On the SurfacePro4 Device(VGBI)
handles the power/volume-keys but looking at the dsdt for the SP4 it has a different _DSM
and I see a few Notify(VGBI, 0xXX)
but i don't see those calls on the SB2
from linux-surface.
Hi all, I'm considering to buy a Surface Book 2 and run Linux on it (of course helping out this project with debugging and a donation). I was wondering: is it completely useless when the power button does not work. Or is it just that you have to type shutdown
to power it down, if so what if it hangs?
from linux-surface.
You can use shutdown or whatever shutdown utilities your window manager/bar/whatever provides. I can only speak for the surface pro 2017, but I believe this doesn't affect the long press of the power-button, as that's a hardware-level function. Thus, if your laptop hangs on shutdown (mine does pretty frequently) you can long-press the power button and that will force shutdown. One inconvenience of the issues with the buttons that you may not have anticipated is that if your computer goes into a lock/sleep state while it's in clipboard mode, there's no way to wake it up, as the touchscreen (purposefully) doesn't respond, and the buttons don't either.
from linux-surface.
@lucasvanlierop I have a Surface Book 2 and run Ubuntu 18.04 on it. I ran 17.10 previously, but 18.04 got rid of some of the bugs I was seeing, likely because 17.10 was running wayland vs. xorg. I can second what @andrew-w-sherman says about the unanticipated issue of not being able to wake it up (and yes, if you hold down the button on an SB2 it forces the machine off). That actually is the only major problem I have with the buttons not working, but I don't use mine as a tablet/undocked very often. I have faith jakeday will be able to come up with the ACPI module to fix this though. I know he's been working on it.
Since the SB2 is a very pricey machine I'll tell you a bit more on what my experience has been. The only other issues I have besides the buttons and battery reading is hibernation. It works for me but only one time, then I have to reboot again. If I try to hibernate a second time without rebooting, it just kills WiFi and locks the screen. Suspend is not possible so this may be a bigger deal than you think. The Wi-Fi also drops from time to time, although this is much less frequent for me now. I can get WiFi back up by reloading the modules which is pretty quick and painless so it isn't really a big deal to me.
So in short, depending on what distro/release you're planning to use, the only real issues for the SB2 that I've experienced at this point are the buttons not working, the lack of battery information, hibernating more than one time, and Wi-Fi randomly dropping, which happens < 1/day for me.
from linux-surface.
@andrew-w-sherman @forlornidealist Thanks sharing your experiences! I did buy a Surface book 2 in the meantime. It's not my main machine yet but I'll try to install Ubuntu 18.04 on it soon and see how that works out.
from linux-surface.
I've tinkered around with this a bit on the Surface Book 2 today. Basically, I have no idea of ACPI/Linux kernel development, but I've got some free time, so... If I've understood that correctly, the MSHW0040 is responsible for the buttons. However, it doesn't send ACPI notify signals, so a basic ACPI driver isn't going to work.
Now I found that this is quite similar to the Surface 3 (non-pro, DSDT, TEV2/MSHW0028 is the relevant device here), which has support in the kernel. As I understood, they're mapping the GPIO interrupts defined in the DSDT to ACPI events, which are then going to be handled by a generic ACPI button driver.
I tried to adapt this for the Surface Book 2, but I can't even get the probe function to be called. Basically I tried to compile this as a kernel module, changed the surface3_acpi_match
, SURFACE_BUTTON_OBJ_NAME
, and surface3_button_surface3
array using the Surface Book DSDT. Any Ideas what I'm doing wrong?
from linux-surface.
And apparently I'm stupid and missed that the Surface 3 has an I2C controller specified. So of course it will not probe because there's no I2C device for the I2C driver to probe. I guess I'll have a look at the ACPI spec then.
from linux-surface.
@qzed I just tested your module on my SB2 15 and holy crap all the buttons work, thats amazing!
Edit: I've also tested this on my SP2017 and it works! Both devices without the need to modprobe - rsurfacepro3_button
from linux-surface.
@gzed I am speechless 😲 you did an amazing job. Works also for me on SB2 15 on archlinux
from linux-surface.
Alright, very nice! I'll update my readme so that every one knows It's integrated with the new release.
from linux-surface.
Related Issues (20)
- Question on GPU throttling while on battery (SB2) HOT 2
- No NVIDIA HDMI sound card option HOT 1
- Is anyone try this on surface go2 ? HOT 2
- Using a Surface Pro 5 (Surface Pro 2017) and the battery isn't reconigized. Ubuntu 20.04 HOT 3
- Battery percentage is not visible on top bar of Ubuntu 20.04 LTS for Surface Pro (Surface_Pro_1796) HOT 7
- IPTS driver fails to find device after resume. HOT 2
- Has anyone tried this on a Surface Book 3? HOT 1
- Wifi adapter not found after installing Surface Book 2 HOT 1
- Surface laptop 2 -- unable to choose kernel. HOT 1
- Surface Book2 manjaro error HOT 1
- Surface Pro X SQ2 support HOT 1
- Surface Book 3 Support HOT 2
- It doesn't work on surface book3 HOT 1
- Surface Pro 4 touch screen experiencing phantom touches HOT 2
- What is the difference between this repository and linux-surface/linux-surface? HOT 3
- NEW ISSUES - Read this first
- Compiling kernel built-in.a Error 2
- Surface Book 2 laggy on battery
- Microsoft Surface Go 2nd Series - Battery drain after shutdown HOT 1
- Several of these devices are interrupting my everyday routine. It's one thing to make a whole Ilot for the privilege but it's another to have my family suffer due to unfriendly devices. I have several individuals who have invested and interest in what is being done but they have ill intentions and I will be pointing out as needed. Remember I am only human so I may get some advice or help with anyone who has signed in on the project in June of 2022 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from linux-surface.