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 laptop studio 2 #1272

Open
deb75 opened this issue Oct 18, 2023 · 133 comments
Open

Surface laptop studio 2 #1272

deb75 opened this issue Oct 18, 2023 · 133 comments
Labels
D: Surface Laptop Studio 2 Device: Surface Laptop Studio 2

Comments

@deb75
Copy link

deb75 commented Oct 18, 2023

The surface laptop studio seems well supported by linux-surface.

Do you think linux-surface would also support the surface laptop studio 2 ?

Regards

@qzed
Copy link
Member

qzed commented Oct 18, 2023

It's hard to answer that without knowing anything about the device. If we're lucky, not much has changed under the hood. I'll certainly try to support it if I get some reports.

@CiaranWinna
Copy link

Hi @qzed & @deb75

Here is the dmesg file:
dmesg.txt

Device: Surface Laptop Studio 2
Distribution: Ubuntu (PopOS)
Kernel version: Linux pop-os 6.5.6-surface #3 SMP PREEMPT_DYNAMIC Sun Oct 15 20:52:00 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

@qzed if you require any further logs, please feel free to mention

@qzed
Copy link
Member

qzed commented Oct 25, 2023

Thanks! The output of our diagnostics script (see https://github.com/linux-surface/linux-surface/wiki/Testers-and-Contributing#support-for-new-devices) would be great. That basically collects all the data we (generally) need to provide initial support (except for the additional testing that someone with a device would need to do, of course).

@CiaranWinna
Copy link

Hi @qzed,

Sure! Here is the requested diagnostic files:

diagnostics.tar.gz
acpidump.txt

@qzed
Copy link
Member

qzed commented Oct 26, 2023

Thanks! I've got something to test for you now. Hopefully, this should enable the EC-related components (battery info, platform profile, tablet switch, keyboard/touchpad and related input devices). Essentially, I've copied the stuff that we use for the SLS1 and applied it to the SLS2, so if nothing changed it should work. It will definitely require a bit of follow-up testing (even if it works), but should hopefully get (at least some) things started.

To test, can you follow what I wrote here, just replace the feature/slg3 with feature/sls2.

@CiaranWinna
Copy link

Hi @qzed ,
I have followed the steps here but the following error is coming up for "make clean all":

`user@pop-os:~/Desktop/Surface Linux/surface-aggregator-module/module$ make clean all

make -C /lib/modules/"6.5.7-surface-2"/build M=/home/user/Desktop/Surface Linux/surface-aggregator-module/module/src clean
make[1]: Entering directory '/usr/src/linux-headers-6.5.7-surface-2'
make[3]: *** No rule to make target 'Linux/surface-aggregator-module/module/src'. Stop.
make[2]: *** [/usr/src/linux-headers-6.5.7-surface-2/Makefile:359: __build_one_by_one] Error 2
make[1]: *** [Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.5.7-surface-2'
make: *** [Makefile:31: clean] Error 2

user@pop-os:~/Desktop/Surface Linux/surface-aggregator-module/module
`

@qzed
Copy link
Member

qzed commented Nov 1, 2023

Ahh, took me a while to spot the issue: Paths in the makefile were not quoted, so it broke due to the witespace. This should be fixed now.

Can you run git pull in the surface-aggregator-module directory (or any of its subdirectories) and then try again from the make clean all?

@quo
Copy link

quo commented Nov 1, 2023

So apparently the SLS2 has two Touch Host Controller devices:

00:10.6 Digitizer Pen [0901]: Intel Corporation Device [8086:51d0] (rev 01)
        Subsystem: Microsoft Corporation Device [1414:0077]
00:10.7 Digitizer Pen [0901]: Intel Corporation Device [8086:51d1] (rev 01)
        Subsystem: Intel Corporation Device [8086:7270]

Presumably the first is the touchscreen, but I wonder what the second one is used for?

Unfortunately ithc currently fails to initialize them:

[    3.045865] ithc 0000:00:10.6: timed out waiting for reg 0x10bc mask 0x0000000f val 0x00000002
[   16.162518] ithc 0000:00:10.7: timed out waiting for reg 0x10bc mask 0x0000000f val 0x00000002

Can you please post your dmesg after restarting ithc with debugging enabled?

sudo modprobe -r ithc
sudo modprobe ithc logregs=1 dyndbg=+pflmt

@CiaranWinna
Copy link

CiaranWinna commented Nov 2, 2023

Hi @qzed & @quo

Here is the output from running make clean all after pulling latest changes:
`user@pop-os:~/Desktop/Surface Linux/surface-aggregator-module/module$ make clean all

make -C /lib/modules/"6.5.7-surface-2"/build M="/home/user/Desktop/Surface Linux/surface-aggregator-module/module/src" clean
make[1]: Entering directory '/usr/src/linux-headers-6.5.7-surface-2'
Makefile:145: *** building multiple external modules is not supported. Stop.
make[1]: Leaving directory '/usr/src/linux-headers-6.5.7-surface-2'
make: *** [Makefile:31: clean] Error 2

user@pop-os:~/Desktop/Surface Linux/surface-aggregator-module/module$ `

After restarting ithc with debugging enabled, here is the dmesg file:
dmesg.log

@qzed
Copy link
Member

qzed commented Nov 2, 2023

If I understand that error correctly, it's another issue with the space in the path. Only this time it seems to be caused by the kernel makefile and not ours. Could you try moving the directory to some path without a space?

@quo
Copy link

quo commented Nov 3, 2023

Thanks. So from the dmesg it looks like the state register isn't doing anything.

I had a look inside the driver package for the SLS2. It looks like the THC has been renamed to the "Quick SPI" Host Controller. While the PCI device ID is the same and many of the old THC registers still seem to be used, the new UEFI Quick SPI driver also uses a bunch of previously unused/unknown registers. I haven't looked at the Windows Quick SPI driver yet.

I may try to continue reverse engineering this a bit more. But I think it's unlikely I'll be able to get it working without access to the actual hardware.

@CiaranWinna
Copy link

CiaranWinna commented Nov 3, 2023

Hi @qzed ,
As you mentioned, changing the directory corrected the issue.
I got the following fatal error when running make modprobe-unload:
user@pop-os:~/Desktop/Surface_Linux/surface-aggregator-module/module$ make modprobe-unload [sudo] password for ciaranwinnan: modprobe: FATAL: Module battery is builtin. modprobe: FATAL: Module ac is builtin. user@pop-os:~/Desktop/Surface_Linux/surface-aggregator-module/module$

After running make insmod battery stats and percentage now show up:
Screenshot from 2023-11-03 00-51-25
Screenshot from 2023-11-03 01-11-06

Profiles are also active now:
Screenshot from 2023-11-03 00-55-18

Keyboard is also working now.

Touchpad and touchscreen is not working

@qzed
Copy link
Member

qzed commented Nov 3, 2023

@CiaranWinna Thanks! Could you also upload a dmesg log while the modules are loaded so that I can check that there are no other (obvious) issues?

For the touchpad, I'm assuming it's a similar issue as on the SLS1, so you could try adapting the quirk from here. You will likely need to change the MatchProduct line to the touchpad product ID (which you should be able to find via the dmesg log or sysfs).

We should also do some more proper testing on the HID-via-SAM devices and other SAM/EC components to make sure they haven't changed. But that's for after we have some preliminary support in the kernel.

@qzed
Copy link
Member

qzed commented Nov 3, 2023

The modprobe: FATAL: Module ac is builtin you can ignore. The script responsible for loading/unloading the modules tries to unload the ac and battery modules before unloading the surface/SAM related modules. But we just do that so that userspace doesn't think that there's something wrong with the battery.

In your case, it seems that ac is built in and hence cannot be unloaded. It should just print the error but then continue on with the rest. In case of newer devices like the SLS2, it's also not really necessary to unload those two modules because they're not used in the first place.

@CiaranWinna
Copy link

Hi @qzed ,
Thank you I will give that a go! Here is the
dmesg.log
after the modules have been loaded.

@qzed
Copy link
Member

qzed commented Nov 5, 2023

Okay, so it looks like two HID devices have changed. Either they moved their address or removed them:

[  354.730342] surface_hid 01:15:01:03:00: unexpected descriptor length: got 0, expected 9
[  354.730358] surface_hid: probe of 01:15:01:03:00 failed with error -71
[  354.732415] surface_hid 01:15:01:08:00: unexpected descriptor length: got 0, expected 9
[  354.732432] surface_hid: probe of 01:15:01:08:00 failed with error -71

So the affected devices are

01:15:01:03:00 - previously touchpad
01:15:01:08:00 - previously sysctrl

So unless they merged the touchpad and keyboard HID devices, that might explain why the touchpad isn't working.

To figure out which HID devices are present on which addresses, can you run (with the modules loaded) the following commands and post their outputs? The script is also in the SAM repo. In particular, run

sudo ./scripts/ssam/hid.py hid-get-descriptor 1 x 1

replacing x with 0 up to (including) 15. This essentially tries to read the HID descriptor from the (sub-)device identified by the number x.

With x=1 and x=2. the command should definitely print something (1 was the keyboard, 2 was the pen stash on the SLS1). The x=3 should print an empty array (that was the touchpad, but as I've written above, that seems to have changed). If the script throws any errors, please post them as well (this should normally not happen).

We also may need to look at adding an entry for our Surface GPE driver, but that's for later after the other things work I guess.

@quo
Copy link

quo commented Nov 5, 2023

I suspect the touchpad is connected to the second THC.

From SurfaceLaptopStudio2_Win11_22621_23.074.39397.0/SurfaceUpdate/surfacehidfriendlynames/SurfaceHIDFriendlyNames.inf:

; Surface Laptop Studio 2 Touchpad
%DeviceDesc% = PenUtilityDesc, HID\VID_045E&UP:FF0D_U:0001
%DeviceDesc% = TouchpadCommunicationsDesc, HID\VID_045E&UP:FF0B_U:000F

And from SurfaceLaptopStudio2_Win11_22621_23.074.39397.0/SurfaceUpdate/surfacetrackpadcfu/SurfaceTouchpadG7CfuOverHidExtnPackage.inf:

%SurfaceTouchpadG7CfuOverHidExtnPackage.ExtensionDesc%=SurfaceTouchpadG7CfuOverHidExtnPackage, HID\VEN_8086&DEV_51D1&SUBSYS_72708086&Col03

PCI device ID 8086:51d1 is the second THC. The subsystem ID also matches.

The UP:FF0B makes me a little worried that it's not standard HID, and maybe heatmap based like the touchscreen.

The THC registers contain some left-over values from the UEFI Quick SPI initialization which contain the VID/PID of the touch devices:

[ 4861.318505] ithc 0000:00:10.6: reg 105c: 00000000 -> 0c5d045e
[ 4874.517427] ithc 0000:00:10.7: reg 105c: 00000000 -> 0c46045e

So THC0 = 045e:0c5d, THC1 = 045e:0c46.
0c5d shows up in filenames for touch/pen in the update package, but I can't find any references to 0c46.

@StollD
Copy link
Member

StollD commented Nov 5, 2023

0c5d shows up in filenames for touch/pen in the update package, but I can't find any references to 0c46.

There is a TouchPenProcessor dll with that ID in the name:

dorian@desktop ~/Downloads/SurfaceUpdate % find . -name 'TouchPenProcessor*'
./surfacetouchmw/TouchPenProcessor0C5D.dll
./surfacetrackpadmw/TouchPenProcessor0C46.dll

These two dlls are also 19M each so maybe they forgot to strip the debug symbols again?

@quo
Copy link

quo commented Nov 5, 2023

You're right, I missed that dll somehow!
Doesn't look like there's full debug symbols, but the dlls do contains some absolutely massive functions. Possibly someone cranked up the inlining settings to the max.

@qzed
Copy link
Member

qzed commented Nov 5, 2023

Urgh... so looks like even the touchpad now needs a user-space service. That will probably be slightly annoying.

@CiaranWinna
Copy link

CiaranWinna commented Nov 5, 2023

Hi @qzed ,
Here is the requested output with modules loaded:
ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 0 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 1 1 [5, 1, 9, 6, 161, 1, 133, 1, 21, 0, 37, 1, 117, 1, 149, 8, 5, 7, 25, 224, 41, 231, 129, 2, 117, 8, 149, 10, 25, 0, 41, 145, 38, 255, 0, 129, 0, 5, 12, 10, 192, 2, 161, 2, 26, 193, 2, 42, 198, 2, 149, 6, 177, 3, 192, 5, 8, 25, 1, 41, 3, 117, 1, 149, 3, 37, 1, 145, 2, 149, 5, 145, 1, 192, 5, 1, 9, 128, 161, 1, 133, 91, 21, 0, 37, 1, 117, 1, 149, 3, 9, 151, 9, 152, 9, 153, 129, 2, 149, 5, 129, 1, 192, 5, 12, 9, 1, 161, 1, 133, 3, 149, 1, 117, 16, 21, 0, 38, 255, 3, 25, 0, 42, 255, 3, 129, 0, 192, 5, 1, 9, 19, 161, 1, 133, 94, 117, 1, 149, 1, 21, 0, 37, 1, 5, 1, 9, 225, 129, 2, 149, 7, 129, 1, 192] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 2 1 [5, 1, 9, 6, 161, 1, 133, 92, 21, 0, 37, 1, 117, 1, 149, 8, 5, 7, 25, 224, 41, 231, 129, 2, 25, 109, 41, 111, 117, 1, 149, 3, 129, 2, 149, 5, 129, 3, 192, 6, 244, 255, 9, 10, 161, 1, 9, 11, 161, 2, 133, 20, 9, 2, 21, 0, 38, 255, 0, 117, 8, 149, 6, 130, 2, 1, 9, 8, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 9, 13, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 9, 14, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 117, 5, 149, 1, 129, 3, 9, 12, 21, 0, 37, 100, 117, 8, 149, 1, 129, 2, 192, 192, 6, 244, 255, 9, 1, 161, 1, 9, 7, 161, 2, 133, 84, 6, 15, 255, 9, 80, 21, 0, 38, 255, 0, 117, 8, 149, 4, 130, 2, 1, 6, 244, 255, 9, 2, 21, 0, 38, 255, 0, 117, 8, 149, 6, 130, 2, 1, 9, 8, 21, 0, 37, 1, 117, 1, 149, 1, 129, 2, 117, 7, 149, 1, 129, 1, 192, 9, 5, 161, 2, 133, 85, 6, 15, 255, 9, 80, 21, 0, 38, 255, 0, 117, 8, 149, 4, 146, 2, 1, 6, 244, 255, 9, 2, 21, 0, 38, 255, 0, 117, 8, 149, 6, 146, 2, 1, 9, 8, 21, 0, 37, 1, 117, 1, 149, 1, 145, 2, 117, 7, 149, 1, 145, 1, 9, 4, 21, 0, 38, 255, 0, 117, 8, 149, 8, 146, 2, 1, 192, 9, 6, 161, 2, 133, 86, 9, 3, 21, 0, 38, 255, 0, 117, 8, 149, 6, 178, 2, 1, 9, 9, 21, 0, 37, 1, 117, 1, 149, 1, 177, 2, 117, 7, 149, 1, 177, 1, 192, 192] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 3 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 4 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 5 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 6 1 [5, 32, 9, 1, 161, 1, 133, 137, 5, 32, 9, 65, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 255, 117, 32, 149, 1, 85, 0, 177, 2, 10, 209, 228, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 14, 177, 2, 10, 209, 20, 177, 2, 10, 212, 20, 85, 12, 177, 2, 10, 213, 20, 177, 2, 10, 226, 4, 21, 0, 37, 1, 117, 8, 149, 1, 85, 0, 177, 2, 10, 227, 4, 177, 2, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 209, 4, 23, 0, 0, 0, 0, 39, 255, 255, 255, 255, 117, 32, 149, 1, 85, 14, 129, 2, 10, 212, 4, 22, 0, 0, 38, 255, 255, 117, 16, 85, 12, 149, 1, 129, 2, 10, 213, 4, 129, 2, 192, 133, 177, 5, 32, 9, 138, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 131, 20, 21, 0, 38, 160, 140, 117, 16, 149, 1, 85, 14, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 131, 4, 23, 1, 0, 0, 128, 39, 255, 255, 255, 127, 117, 32, 149, 4, 101, 0, 85, 10, 129, 2, 10, 136, 4, 22, 0, 0, 38, 255, 255, 117, 16, 149, 1, 161, 2, 10, 224, 8, 10, 225, 8, 10, 226, 8, 129, 0, 192, 192, 133, 161, 5, 32, 9, 115, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 82, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 13, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 83, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 13, 129, 2, 10, 84, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 13, 129, 2, 10, 85, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 13, 129, 2, 192, 133, 180, 5, 32, 9, 118, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 86, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 14, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 87, 4, 23, 1, 0, 0, 128, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 10, 129, 2, 10, 88, 4, 23, 1, 0, 0, 128, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 10, 129, 2, 10, 89, 4, 23, 1, 0, 0, 128, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 10, 129, 2, 192, 133, 165, 5, 32, 9, 124, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 82, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 13, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 83, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 13, 129, 2, 10, 84, 4, 129, 2, 10, 85, 4, 129, 2, 192, 133, 179, 5, 32, 9, 134, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 126, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 14, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 127, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 14, 129, 2, 10, 128, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 14, 129, 2, 10, 129, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 14, 129, 2, 10, 136, 4, 22, 0, 0, 38, 255, 255, 117, 16, 149, 1, 161, 2, 10, 224, 8, 10, 225, 8, 10, 226, 8, 129, 0, 192, 192, 133, 178, 5, 32, 9, 131, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 113, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 14, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 118, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 15, 129, 2, 10, 136, 4, 22, 0, 0, 38, 255, 255, 117, 16, 149, 1, 161, 2, 10, 224, 8, 10, 225, 8, 10, 226, 8, 129, 0, 192, 192, 133, 166, 5, 32, 9, 123, 161, 0, 5, 32, 10, 9, 3, 21, 0, 37, 2, 117, 8, 149, 1, 161, 2, 10, 48, 8, 10, 49, 8, 10, 50, 8, 177, 0, 192, 10, 22, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 64, 8, 10, 65, 8, 10, 66, 8, 10, 67, 8, 10, 68, 8, 10, 69, 8, 177, 0, 192, 10, 25, 3, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 80, 8, 10, 81, 8, 10, 82, 8, 10, 83, 8, 10, 84, 8, 10, 85, 8, 177, 0, 192, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 177, 0, 192, 10, 14, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 4, 3, 21, 0, 39, 255, 255, 255, 127, 117, 32, 149, 1, 85, 0, 177, 2, 10, 82, 20, 21, 0, 38, 255, 255, 117, 16, 149, 1, 85, 13, 177, 2, 5, 32, 5, 32, 10, 1, 2, 21, 0, 37, 6, 117, 8, 149, 1, 161, 2, 10, 0, 8, 10, 1, 8, 10, 2, 8, 10, 3, 8, 10, 4, 8, 10, 5, 8, 10, 6, 8, 129, 0, 192, 10, 2, 2, 21, 0, 37, 5, 117, 8, 149, 1, 161, 2, 10, 16, 8, 10, 17, 8, 10, 18, 8, 10, 19, 8, 10, 20, 8, 10, 21, 8, 129, 0, 192, 10, 83, 4, 22, 1, 128, 38, 255, 127, 117, 16, 149, 1, 85, 13, 129, 2, 10, 84, 4, 129, 2, 10, 85, 4, 129, 2, 192, 192] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 7 1 [6, 0, 255, 10, 0, 249, 161, 1, 133, 50, 117, 16, 149, 2, 21, 0, 39, 255, 255, 0, 0, 10, 1, 249, 10, 6, 249, 177, 2, 117, 32, 149, 1, 39, 255, 255, 255, 127, 10, 2, 249, 177, 2, 117, 8, 149, 8, 38, 255, 0, 10, 3, 249, 178, 2, 1, 149, 16, 10, 4, 249, 178, 2, 1, 10, 5, 249, 178, 2, 1, 117, 16, 149, 1, 39, 255, 255, 0, 0, 10, 6, 249, 129, 2, 117, 8, 149, 1, 133, 51, 21, 0, 38, 255, 0, 10, 7, 249, 177, 2, 38, 1, 0, 10, 8, 249, 177, 2, 192] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 8 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 9 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 10 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 11 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 12 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 13 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 14 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo ./scripts/ssam/hid.py hid-get-descriptor 1 15 1 [] ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$

@deb75
Copy link
Author

deb75 commented Nov 11, 2023

Hi,

As far as I understand, up to now, battery stats and keyboard are working, but not touchpad and touchscreen.

I just wanted to know at this stage if you think that linux-surface may support the SLS2 with some work, or
if support will hopelessly be limited in some ways (no touchscreen, pen and/or touchpad)

Regards

@qzed
Copy link
Member

qzed commented Nov 11, 2023

@deb75 I can't say... Touchpad and touchscreen depend on ITHC, which I know next to nothing about. I guess @quo could make a more educated guess here. If ITHC works, we'll quite likely at least have touchscreen support. Depends on how similar the touchpad is to the touchscreen, but I guess that might also need some special processing or even a separate IPTSd. Unless we're in luck and it sends standard HID data (... but I guess that's unlikely since they ship a processor dll and drive it via ITHC in the first place). So that might take longer.

Apart from that, I'm confident that EC support (keyboard, battery stats) will land in our kernel soon, after which I'll send them upstream.

@qzed
Copy link
Member

qzed commented Nov 11, 2023

@CiaranWinna Thanks, that looks good so far. Now, there's two things we should still check: Enabling/disabling of HID devices and the tablet mode switch.

For the first, can you (again with the modules loaded) run

./scripts/ssam/evreg.py reg1-disable 0x15 0x00 0x01

and verify that this disables the keyboard? Similarly, running

./scripts/ssam/evreg.py reg1-enable 0x15 0x00 0x01

should enable it again.

For the tablet mode/orientation switch, can you run sudo evtest and select the device with a name similar to Microsoft Surface POS Tablet Mode Switch. Then while that is running flip the display around into a tablet-like state and check that there is some output that indicates those changes (in particular, there should be a SW_TABLET_MODE value changing from 0 to 1. In addition can you run

cat /sys/bus/surface_aggregator/devices/01:26:01:00:01/state

in various states (e.g. tent-mode, tablet-mode, normal laptop mode). The output should also change accordingly.

It would be great if you could also post a dmesg log from doing those things, so that we can check if there were any errors.

@StollD
Copy link
Member

StollD commented Nov 11, 2023

Depends on how similar the touchpad is to the touchscreen, but I guess that might also need some special processing or even a separate IPTSd. Unless we're in luck and it sends standard HID data (... but I guess that's unlikely since they ship a processor dll and drive it via ITHC in the first place). So that might take longer.

Dumping the HID report descriptor of the touchpad device and some HID traffic from windows could help, then I could start looking at the data and adapting iptsd.

Unfortunately, I have no idea how to do that under Windows.

@quo
Copy link

quo commented Nov 11, 2023

I've reverse engineered bits of the new touch stuff. Basically, the THC runs in an alternate mode called "Quick SPI". The mode is selected by the platform firmware, so I don't think we can set it back to "normal" mode.

Quick SPI aims to be compatible with the HID-over-SPI spec MS published. So theoretically, in this mode ithc should provide an SPI device which could then get picked up by Microsoft's spi-hid driver. (But it'll probably be easier to just handle the HID-over-SPI stuff inside ithc, at least initially.)

Initialization is a bit more involved than normal THC init. Some values need to be retrieved using ACPI calls and written to the correct registers. Reading the device config works a little differently. I think DMA works the same, although the buffers now use HID-over-SPI format.

I'll try to add Quick SPI support to the ithc driver when I have some time, maybe next month. Of course since I don't have the hardware myself, it's unlikely it'll work first try, we'll probably have to spend some time debugging.

@CiaranWinna
Copy link

Hi @qzed ,
Here is the dmesg logs from disabling/enabling the keyboard:

I can confirm that the keyboard was successfully disabled and enabled

In regards to running sudo evtest, the command is not recognized:
ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$ sudo evtest sudo: evtest: command not found ciaranwinnan@pop-os:~/Desktop/Surface_linux/surface-aggregator-module$
I have also tried looking in the script directory and I can't find the evtest script. Is there a specific directory that this command must be run from?

@qzed
Copy link
Member

qzed commented Nov 12, 2023

Thanks for checking! I guess you might need to install evtest first. E.g. run sudo apt install evtest.

@quo
Copy link

quo commented Nov 12, 2023

@StollD
I've extracted the HID descriptors from the firmware files: hiddesc.zip

The touchpad seems to have the same enable/metadata/data reports as the touchscreen. So maybe it'll just work with iptsd with no/minor changes. It also has generic mouse and touchpad reports, presumably those will be used in fallback mode if multitouch is not enabled.

@bowdrillGit
Copy link

Touchpad is working great on my brand-new SLS2! Thank you @StollD

@StollD
Copy link
Member

StollD commented May 24, 2024

@StollD thanks for all your help, I followed this thread and can confirm that the IPTSD touchpad branch pretty much got my SLS2 working fine. Are we able to merge this, or is there still work to be done?

Code-wise it should be ready, but I still need to document the new helper scripts (e.g. iptsd-foreach, iptsd-systemd). Unfortunately I am pretty busy right now, so I don't know when I will get to it.

@ndavis6
Copy link

ndavis6 commented Jun 13, 2024

Screenshot from 2024-06-13 06-14-29

@CiaranWinna
Are you able to get dGPU profiles working on the stock surface-kernel? Or does that still require a the feature/sls2 from the SAM repo?

I am on Fedora 40 and I don't see any option to turn on or off the dGPU. Battery life is terrible (~2 hours), and I am wondering if it is due to this.

uname -a
Linux fedora 6.8.8-1.surface.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 30 08:25:23 UTC 2024 x86_64 GNU/Linux

surface status
Platform Profile: low-power [balanced] balanced-performance performance

Discrete GPU:
Vendor: 10de
Device: 28a0
Power State: D3cold
Runtime PM: On

@CiaranWinna
Copy link

Hi @ndavis6 ,
Currently I am not able to access the dGPU on the generic kernel or access the surface platform profile. I have the following 3 issues that have a knock on effect while running the kernel on PopOS:

  1. Kernel does not bootup from external nvme drive #1461 - This issue is stopping me from logging into the surface kernel. I am running the PopOs from an external nvme SSD.
  2. Surface Laptop 5 Fan problem  #1463 - Due to the fans not starting up, the core temperature continues to rise and reaches a critical level and emergency shuts down. This issue will occur even when the laptop is at idle.
  3. SLS2 - Debian - Device won't completely power off #1442 - When shutting down, the laptop does not completely power-off. This issue occurs specifically when gracefully shutting down the laptop and not during the emergency shutdown due to the fan issue.. The fans will go to full speed and continue to run indefinitely. The only way to shutdown the laptop is to hold the power button for 10 seconds.

@ndavis6
Copy link

ndavis6 commented Jun 19, 2024

@CiaranWinna Thanks!

A quick clarification if you don't mind. Were you able to access the dGPU on main-branch / generic surface-kernel? Or did you need to run a different branch of surface-kernel for the SLS2?

I am running 6.8.8-1.surface.fc40.x8 and while I can read the dGPU state, I don't see the dGPU options from your screenshot (see my screenshot above). I am not sure if that is a Fedora vs PopOS problem or if we were running different kernels.

I also have #1442 which is annoying

@castlenthesky
Copy link

castlenthesky commented Jun 25, 2024

Booting into a fresh install of vanilla Ubuntu 2024.04 LTS.

I was unable to checkout the feature/sls2 branch from the SAM repo.
I ran the following:

  1. git clone https://github.com/linux-surface/surface-aggregator-module
  2. cd surface-aggregator-module/module
  3. git checkout feature/sls2

And received the following error: error: pathspec 'feature/sls2' did not match any file(s) known to git

Did this branch get merged and deleted?

Running make clean all give the following error:

make -C /lib/modules/"6.8.0-35-generic"/build M="/home/bmoney/projects/surface-aggregator-module/module/src"  clean
make[1]: Entering directory '/usr/src/linux-headers-6.8.0-35-generic'
make[1]: Leaving directory '/usr/src/linux-headers-6.8.0-35-generic'
make -C /lib/modules/"6.8.0-35-generic"/build M="/home/bmoney/projects/surface-aggregator-module/module/src"  modules
make[1]: Entering directory '/usr/src/linux-headers-6.8.0-35-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0
  You are using:           
  CC [M]  /home/bmoney/projects/surface-aggregator-module/module/src/clients/surface_acpi_notify.o
/bin/sh: 1: gcc-13: not found
make[4]: *** [scripts/Makefile.build:243: /home/bmoney/projects/surface-aggregator-module/module/src/clients/surface_acpi_notify.o] Error 127
make[3]: *** [scripts/Makefile.build:481: /home/bmoney/projects/surface-aggregator-module/module/src/clients] Error 2
make[2]: *** [/usr/src/linux-headers-6.8.0-35-generic/Makefile:1926: /home/bmoney/projects/surface-aggregator-module/module/src] Error 2
make[1]: *** [Makefile:240: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.8.0-35-generic'
make: *** [Makefile:28: all] Error 2

@qzed
Copy link
Member

qzed commented Jun 25, 2024

@castlenthesky Yeah, the branch got merged. Support for the SLS2 is also in our kernel packages.

@CiaranWinna
Copy link

Hi @ndavis6 ,
Yes, correct, I was able to access the dGPU from the main-branch/generic surface-kernel

@castlenthesky
Copy link

Understood. Thank you for the clarification! I've followed the Installation and Setup guide and am still having issues. The keyboard is fully functional. The touchscreen is usable but does not recognized gestures and the touchpad is not usable. I have taken the following steps:

  1. Clean Install of Ubuntu
  2. Installed Surface Kernel and its dependencies
  3. Re-enabled Secure Boot
  4. Post-installation updates (firmware, touchscreen support, etc...)
  5. Ran iptsd-calibrate and copied the results to the configuration file
  6. Reboot

When using the touchpad my mouse disappears the moment I interact with it. If I stop using my mouse and use the touchpad with a single the system will scroll whatever window the pointer is over. It almost behaves as the touchpad is a touchscreen and just like the touchscreen, gestures are not recognized.

Do you have recommendations on steps I may have overlooked?

@Moareulf
Copy link

Hi @castlenthesky

I have mine working, what you describe sounds like what I had prior to installing the dev versions they suggested to use here.

I've had it working using the quick-spi branch of the ithc module and the touchpad branch of iptsd (use the pre-built packages from the actions).

My touchpad worked from there however I also had to apply some e settings to iptsd in a conf file, which are further back in this conversation.

[Contacts]
ActivationThreshold = 40
DeactivationThreshold = 36
OrientationThresholdMax = 15

Hope that helps?

@anultravioletaurora
Copy link

Hey all! I've followed this thread and have been pretty successful getting NixOS 24.05 running on my Laptop Studio 2. Trackpad is working excellent, along with the Pen 2! Multifinger gestures are excellent as well! Thank you to everyone for this hard work 🙏🙏

Below is a link to the configuration file I'm using with NixOS. I started with the configuration linked in the guide and then updated to include some of the latest changes:

Surface NixOS 24.05 Config

One last issue I'm having is that when I close the lid, hit suspend, or hit shutdown, the laptop just sits at a black screen and doesn't change the power state. Has anyone come across that at all? Or does anyone see an issue in my Nix config? 😅 I can gather whatever logs would be helpful!

@alessandrv
Copy link

Hello, I tried to install ubuntu, first 3 boot after install were fine, then it would get stuck during boot and not launch any graphical login or anything. Also my gpu was not getting used and not sure how to fix that

@anonemumei
Copy link

Hello, I installed arch on surface laptop studio 2
I Installed kde DE and almost everything works fine, touchscreen, pen, sound etc.

However I have an issue with shutdown, the laptop doesn't power off. I waited for a while thinking there was some process taking place but no. The fan keeps working and I can hear the sound of the laptop still working.

By the way the laptop also didn't power off when I used Pop distro bootable USB. I needed Pop's gparted to shrink the C drive. So on both distros: Pop and archlinux the laptop doesn't power off.

I attached two logs file. Appreciate your support with this issue

archlinux-log.txt
archlinux-log1.txt

@djkeyes
Copy link

djkeyes commented Aug 2, 2024

Just installed ubuntu 24.04 with the linux-surface repository package, and things seem to be running mostly smoothly. Of note, I had to add nomodeset to the grub config file, otherwise the graphics glitch out and I can only do things through the tty terminals. Not sure if I missed a step, or other people have experienced this and haven't mentioned it.

@djkeyes
Copy link

djkeyes commented Aug 2, 2024

I have also encountered the same touchpad issue mentioned earlier in this thread. I would follow the suggested approach to download IPTSD artifacts from the github actions page, but it seems the build artifacts are expired.

I am a noob with github actions--is it possible for a user to refresh the artifacts through the online UI, or is the easiest solution to just build locally?

@ndavis6
Copy link

ndavis6 commented Aug 16, 2024

I have been running Fedora40 on SLS2 for a few months now. Things are generally good, a few things still aren't working great.

Touchpad is very sensitive to clicks. It tends to send clicks when I try to drag and double clicks when I try to click once. I tried adjusting the 50-touchpad settings, but I haven't found the right combination. From iptsd-plot, it seems that the contacts are becoming unstable, but I can't find settings that recognize the fingers reliably and avoid unstable contacts. I believe I installed everything as in the guide.

Battery life is poor. I knew this going in, but it only lasts ~2 hrs on battery vs ~12 on windows. I tried powertop tune which helped a bit but still not much.

Latop won't power down. I can workaround this, but it is annoying.

Let me know if there is a better place to communicate on these bugs. Thanks for all the hard work here!!

@tmarkov
Copy link

tmarkov commented Aug 17, 2024

Shutdown seems to work fine with the kernel parameter pci=hpiosize=0 (see #1058).

Suspend also seems to work for me - the fans don't turn off immediately when suspending, but keep running until the CPU gets cool and then stop - but the CPU does reach the s0ix states.

@tmarkov
Copy link

tmarkov commented Aug 18, 2024

I'm getting system freezes on high system loads - for example, as some heavy packages build, the system stops responding and I have to hard reset from the power button. Anyone else observing something similar

Edit: Happens not only during heavy loads.

@knoahlr
Copy link

knoahlr commented Aug 25, 2024

Touchpad Issue

On both Fedora40 and Ubuntu24 I have been unable to get the touchpad to work as a mouse consistently. When I get it to work many of the features such as

  1. two finger scroll
  2. two finger click(to right click)
  3. swiping to change desktops

still don't work.

When I get the touchpad to work, it reverts back to default setting whenever my PC goes to sleep. I re-enable it by finding running
iptsd-findhidraw
to find the touchpad resource manager and passing it to iptsd .i.e.
sudo iptsd /dev/hidrawN

Honestly, if I could get the features to work (through configuration or however possible), I could find a way to make this behaviour consistent by having a background process monitoring iptsd devices.

I have tried alot of the fixes here .i.e. touchpad config files and a lot more but haven't been able to get the features listed above working.

Let me know if you can help,

Appreciate all the hard work already put in to get linux-surface to where it is !

@TannerNelson16
Copy link

Just bought a SLS2 today and would love to get things working from a linux standpoint. For some reason I can't download the .deb file to get the touchpad working. It says expired. Does anyone know why this would be?

As a side note, Would love to help with testing or getting any data that's needed. Battery life doesn't seem great but I can live with that for now. Excited to contribute to this project!

@TannerNelson16
Copy link

My touchpad still acts as if it's the touchscreen and I can't figure out what alterations I need to make to fix that. If anyone could provide some direction I'd appreciate that.

@TannerNelson16
Copy link

Just thought I'd include my observations. When I either install or uninstall libinput or libinput-tools after a reboot, the mouse works. But it also causes multi-touch on the touch screen to stop working and disables the pen. After a reboot when the mouse is not working, both of those function perfectly.

@Anodyine
Copy link

Hey @TannerNelson16, I forked the iptsd repo and tagged the touch branch. That caused the ci branch to run again. Everything but the arch package just built. Here's the link:

https://github.com/Anodyine/iptsd/actions/runs/10589327622

I installed the deb one on Ubuntu and the touchpad works well even without adding the config file. However, I have an issue where the laptop won't charge while plugged in.

@knoahlr
Copy link

knoahlr commented Aug 29, 2024

@Anodyine your solution to fork iptsd and duplicate the workflow file to build the touchpad branch through Github Actions helped me fixed my issues with Touchpad gestures. Thanks

@ndavis6
Copy link

ndavis6 commented Sep 3, 2024

@Moareulf Are you experiencing that the touchpad is very sensitive to clicks with those touchpad-conf settings? If I am the only one getting them, maybe I did something wrong on installation.

@anultravioletaurora
Copy link

Shutdown seems to work fine with the kernel parameter pci=hpiosize=0 (see #1058).

Suspend also seems to work for me - the fans don't turn off immediately when suspending, but keep running until the CPU gets cool and then stop - but the CPU does reach the s0ix states.

Can confirm that this kernel parameter fixed my shutdown issues I was having before, thank you!

@Lopicl
Copy link

Lopicl commented Oct 8, 2024

@Moareulf Are you experiencing that the touchpad is very sensitive to clicks with those touchpad-conf settings? If I am the only one getting them, maybe I did something wrong on installation.

I am having this problem too, even with the iptsd config fix the issue persists, it's better but still present and very annoying. I am running pop os. Especially when drawing circles the cursor halts and registers taps.

@tmarkov
Copy link

tmarkov commented Oct 9, 2024

I'm currently using these iptsd settings, not perfect but significantly better:

[Contacts]
OrientationThresholdMin = 0.01;
OrientationThresholdMax = 400;
SizeMin = 0.1;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D: Surface Laptop Studio 2 Device: Surface Laptop Studio 2
Projects
None yet
Development

No branches or pull requests