Open deb75 opened 1 year ago
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.
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
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).
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
.
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 `
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
?
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
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
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?
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.
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:
Profiles are also active now:
Keyboard is also working now.
Touchpad and touchscreen is not working
@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.
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.
Hi @qzed , Thank you I will give that a go! Here is the dmesg.log after the modules have been loaded.
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.
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.
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?
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.
Urgh... so looks like even the touchpad now needs a user-space service. That will probably be slightly annoying.
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$
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
@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.
@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.
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.
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.
Hi @qzed , Here is the dmesg logs from disabling/enabling the keyboard:
Before changes: dmesg.txt
After disabling the keyboard: dmesg_disable_keyboard.txt
After enabling the keyboard: dmesg_enable_keyboard.txt
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?
Thanks for checking! I guess you might need to install evtest
first. E.g. run sudo apt install evtest
.
@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.
I have also been trying to get linux to work on my SLS2, but have encountered some issues. I'm running ubuntu 20.04.6. The first problem is that ubuntu only boots if I first enter the Microsoft recovery menu, select "use a device" and choose ubuntu there. Putting ubuntu first in boot order and booting normally doesn't work. Grub shows up just fine, but when I choose ubuntu it shows these lines for a second or two, turns off and then goes back to Grub.
loading linux 5.15.0-88-generic...
Loading initial ramdisk...
The second problem is that I can't boot the surface kernel no matter what. I get maybe 10-20 errors like these and then it just gets stuck and I have to force a shutdown.
[ 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
I have tried all this with Secure Boot on and off and have gone through the mok key enrollment using Mint. Does anybody have any pointers as to what I'm doing wrong?
Hi @qzed ,
Laptop mode:
ciaranwinnan@pop-os:~$ cat /sys/bus/surface_aggregator/devices/01:26:01:00:01/state
laptop
ciaranwinnan@pop-os:~$
Tent/Slate mode:
ciaranwinnan@pop-os:~$ cat /sys/bus/surface_aggregator/devices/01:26:01:00:01/state
slate
ciaranwinnan@pop-os:~$
Tablet mode:
ciaranwinnan@pop-os:~$ cat /sys/bus/surface_aggregator/devices/01:26:01:00:01/state
tablet
ciaranwinnan@pop-os:~$
evtest (events from laptop mode -> slate mode -> tablet mode -> slate mode -> laptop mode ):
ciaranwinnan@pop-os:~/Desktop/surface/surface-aggregator-module/module$ sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Lid Switch
/dev/input/event1: Video Bus
/dev/input/event2: Logitech USB Optical Mouse
/dev/input/event3: Generic USB Audio Consumer Control
/dev/input/event4: Generic USB Audio
/dev/input/event5: Corsair Corsair Gaming K63 Keyboard
/dev/input/event6: Corsair Corsair Gaming K63 Keyboard
/dev/input/event7: Corsair Corsair Gaming K63 Keyboard
/dev/input/event8: gpio-keys
/dev/input/event9: gpio-keys
/dev/input/event10: HDA Intel PCH Mic
/dev/input/event11: HDA Intel PCH Headphone
/dev/input/event12: HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event13: HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event14: HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event15: HDA Intel PCH HDMI/DP,pcm=9
/dev/input/event16: Office (SONOS 51AC) (AVRCP)
/dev/input/event17: Microsoft Surface POS Tablet Mode Switch
/dev/input/event18: Microsoft Surface 045E:0C73 Keyboard
/dev/input/event19: Microsoft Surface 045E:0C73
/dev/input/event20: Microsoft Surface 045E:0C75 Keyboard
/dev/input/event21: Microsoft Surface 045E:0C75
/dev/input/event22: Microsoft Surface 045E:0C75
Select the device event number [0-22]: 17
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "Microsoft Surface POS Tablet Mode Switch"
Supported events:
Event type 0 (EV_SYN)
Event type 5 (EV_SW)
Event code 1 (SW_TABLET_MODE) state 0
Properties:
Testing ... (interrupt to exit)
Event: time 1700079366.535446, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 1
Event: time 1700079366.535446, -------------- SYN_REPORT ------------
Event: time 1700079617.188740, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 0
Event: time 1700079617.188740, -------------- SYN_REPORT ------------
Event: time 1700079618.124223, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 1
Event: time 1700079618.124223, -------------- SYN_REPORT ------------
Event: time 1700079629.729576, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 0
Event: time 1700079629.729576, -------------- SYN_REPORT ------------
Thanks, that looks good. I'll try to update the kernels on the weekend.
Great! Thank you @qzed
New kernels with the basic support from the SAM repo are building.
I've tried with the new kernel now and my system still doesn't boot. The ithc still fails to register the devices mentioned above, but then I get stuck on this:
[OK] Started Load/Save RF Kill Switch Status
Any ideas?
I think the [OK] Started Load/Save RF Kill Switch Status
very likely a false lead. Maybe you can try to blacklist ithc
(e.g. add modprobe.blacklist=ithc
to the kernel command line)?
Hi @qzed,
I have updated to the latest kernel and all the tested features work OK. The two issues that I currently run into is the following:
Fans do not turn on / no fan data: The laptop will quickly reach 80 degrees and then switch off.
Shutting down: the laptop never seems to completely shut down. You can only force a complete shut down by holding the power button
BR, Ciaran
The fans on Surface devices are generally controlled by the EC/SAM. Unfortunately so far we haven't found a way to directly control them or read out the fan speed (I'm not sure if there even is such an interface), but you should be able to (somewhat) influence that via the platform profile. So try setting that to "best performance" or something along those lines. With that, the fans should hopefully ramp up.
For the overheating: Generally the chipset and CPU should throttle and not shut down the system unless absolutely necessary. Older devices reportedly have clocked down to 400MHz (and stayed there for a while), which became noticeably slow. The problem is that the Linux kernel by itself doesn't really do thermal throttling, so you're basically left with what the chipset has by default. What you can do to avoid that is set up (and if necessary configure) thermald. There are some examples in the contrib folder of this repo and on the wiki. This should do proper (software-controlled) throttling and you should be able to configure it so that it doesn't hit the shutoff temperature.
Regarding shutdown, it might be the same issue as on the SLS1 and SP9 (https://github.com/linux-surface/linux-surface/issues/1058). Unfortunately I haven't found the time to revisit this, but we could try something similar on the SLS2 and see if it works. I'll try to look into that over the weekend.
Hi @qzed ,
BR, Ciaran
Alright, let's see if we can get touch working.
I've prepared some changes to ithc in a separate branch: https://github.com/quo/ithc-linux/tree/quickspi
If you want to test this please follow these steps:
echo options ithc logregs dyndbg=+pflmt | sudo tee /etc/modprobe.d/ithc-debug.conf
git clone -b quickspi https://github.com/quo/ithc-linux ithc-quickspi
Hi @quo ,
ciaranwinnan@pop-os:~/Desktop/ithc-quickspi$ echo options ithc logregs dyndbg=+pflmt | sudo tee /etc/modprobe.d/ithc-debug.conf
[sudo] password for ciaranwinnan:
options ithc logregs dyndbg=+pflmt
ciaranwinnan@pop-os:~/Desktop/ithc-quickspi$ make && sudo make install
mkdir -p build
find build/ -type l -exec rm {} +
ln -sr src/* build/
make -C /lib/modules/uname -r
/build M=/home/ciaranwinnan/Desktop/ithc-quickspi/build CONFIG_HID_ITHC=m
make[1]: Entering directory '/usr/src/linux-headers-6.6.1-surface-1'
warning: the compiler differs from the one used to build the kernel
The kernel was built by: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
You are using: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
CC [M] /home/ciaranwinnan/Desktop/ithc-quickspi/build/ithc-main.o
CC [M] /home/ciaranwinnan/Desktop/ithc-quickspi/build/ithc-regs.o
CC [M] /home/ciaranwinnan/Desktop/ithc-quickspi/build/ithc-dma.o
CC [M] /home/ciaranwinnan/Desktop/ithc-quickspi/build/ithc-hid.o
CC [M] /home/ciaranwinnan/Desktop/ithc-quickspi/build/ithc-legacy.o
CC [M] /home/ciaranwinnan/Desktop/ithc-quickspi/build/ithc-quickspi.o
CC [M] /home/ciaranwinnan/Desktop/ithc-quickspi/build/ithc-debug.o
LD [M] /home/ciaranwinnan/Desktop/ithc-quickspi/build/ithc.o
MODPOST /home/ciaranwinnan/Desktop/ithc-quickspi/build/Module.symvers
CC [M] /home/ciaranwinnan/Desktop/ithc-quickspi/build/ithc.mod.o
LD [M] /home/ciaranwinnan/Desktop/ithc-quickspi/build/ithc.ko
make[1]: Leaving directory '/usr/src/linux-headers-6.6.1-surface-1'
make -C /lib/modules/uname -r
/build M=/home/ciaranwinnan/Desktop/ithc-quickspi/build CONFIG_HID_ITHC=m modules_install
make[1]: Entering directory '/usr/src/linux-headers-6.6.1-surface-1'
INSTALL /lib/modules/6.6.1-surface-1/updates/ithc.ko
SIGN /lib/modules/6.6.1-surface-1/updates/ithc.ko
scripts/sign-file: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
DEPMOD /lib/modules/6.6.1-surface-1
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make[1]: Leaving directory '/usr/src/linux-headers-6.6.1-surface-1'
depmod -a
sync
ciaranwinnan@pop-os:~/Desktop/ithc-quickspi$ sudo modprobe ithc
ciaranwinnan@pop-os:~/Desktop/ithc-quickspi$
After the above steps, touch was not working
You are replacing the built-in module, did you unload ITHC before installing / loading the new module? Or did you reboot?
- For the shutdown issue, I would be more than happy to test any possible solution.
Sorry for the delay. So the idea would be to add the relevant PCI devices to https://github.com/linux-surface/kernel/blob/8cd23b1bb3a8b7a3ef7cec2c37e7e46e6397a858/drivers/pci/quirks.c#L6194-L6228. From what I can tell, those could be
8086:a71e Thunderbolt 4 USB Controller
8086:a73e Thunderbolt 4 NHI
8086:a7a0 GPU
8086:a76e Thunderbolt 4 (?) PCI Express Root Port
8086:a73f Thunderbolt 4 (?) PCI Express Root Port
Those are pretty much guesses though.
I'll try to prepare a patched kernel in the next couple of days.
Hi @StollD , During the test I rebooted the system. Would it be possible to mention how I would unload the ITHC? Apologies, I am still learning in regards to modules.
Thank you @qzed , I will test the changes when they are ready.
@CiaranWinna To unload/reload the module:
sudo modprobe -r ithc
sudo modprobe ithc
Hi @quo & @StollD ,
I ran the requested test:
ciaran@pop-os:~/Desktop/ithc-quickspi$ sudo modprobe -r ithc ciaran@pop-os:~/Desktop/ithc-quickspi$ echo options ithc logregs dyndbg=+pflmt | sudo tee /etc/modprobe.d/ithc-debug.conf options ithc logregs dyndbg=+pflmt ciaran@pop-os:~/Desktop/ithc-quickspi$ sudo make dkms-install test -e /usr/src/
sed -n '/^PACKAGE_NAME="(.)"$/s//\1/p' dkms.conf-
sed -n '/^PACKAGE_VERSION="(.)"$/s//\1/p' dkms.conf&& make dkms-uninstall make[1]: Entering directory '/home/ciaran/Desktop/ithc-quickspi' modprobe -r ithc dkms uninstall
sed -n '/^PACKAGE_NAME="(.)"$/s//\1/p' dkms.conf/
sed -n '/^PACKAGE_VERSION="(.)"$/s//\1/p' dkms.conf` --all
Module ithc-0.1 for kernel 6.6.6-76060606-generic (x86_64).
Before uninstall, this module version was ACTIVE on this kernel.
ithc.ko.zst:
depmod... Module ithc-0.1 for kernel 6.6.6-surface-1 (x86_64). Before uninstall, this module version was ACTIVE on this kernel.
ithc.ko.zst:
Removing original_module from DKMS tree for kernel 6.6.6-surface-1 (x86_64)
make[1]: [Makefile:31: dkms-uninstall] Error 1 (ignored)
dkms remove sed -n '/^PACKAGE_NAME="\(.*\)"$/s//\1/p' dkms.conf
/sed -n '/^PACKAGE_VERSION="\(.*\)"$/s//\1/p' dkms.conf
--all
Module ithc-0.1 for kernel 6.6.6-76060606-generic (x86_64).
This module version was INACTIVE for this kernel.
depmod...
Module ithc-0.1 for kernel 6.6.6-surface-1 (x86_64).
This module version was INACTIVE for this kernel.
depmod...
Deleting module ithc-0.1 completely from the DKMS tree.
rm -rf /usr/src/sed -n '/^PACKAGE_NAME="\(.*\)"$/s//\1/p' dkms.conf
-sed -n '/^PACKAGE_VERSION="\(.*\)"$/s//\1/p' dkms.conf
sync
make[1]: Leaving directory '/home/ciaran/Desktop/ithc-quickspi'
mkdir -p /usr/src/sed -n '/^PACKAGE_NAME="\(.*\)"$/s//\1/p' dkms.conf
-sed -n '/^PACKAGE_VERSION="\(.*\)"$/s//\1/p' dkms.conf
cp -r dkms.conf Makefile src /usr/src/sed -n '/^PACKAGE_NAME="\(.*\)"$/s//\1/p' dkms.conf
-sed -n '/^PACKAGE_VERSION="\(.*\)"$/s//\1/p' dkms.conf
dkms add sed -n '/^PACKAGE_NAME="\(.*\)"$/s//\1/p' dkms.conf
/sed -n '/^PACKAGE_VERSION="\(.*\)"$/s//\1/p' dkms.conf
Creating symlink /var/lib/dkms/ithc/0.1/source -> /usr/src/ithc-0.1
dkms build sed -n '/^PACKAGE_NAME="\(.*\)"$/s//\1/p' dkms.conf
/sed -n '/^PACKAGE_VERSION="\(.*\)"$/s//\1/p' dkms.conf
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
make -j20 KERNELRELEASE=6.6.6-surface-1 KDIR=/lib/modules/6.6.6-surface-1/build...
cleaning build area...
dkms install sed -n '/^PACKAGE_NAME="\(.*\)"$/s//\1/p' dkms.conf
/sed -n '/^PACKAGE_VERSION="\(.*\)"$/s//\1/p' dkms.conf
ithc.ko: Running module version sanity check.
depmod... sync ciaran@pop-os:~/Desktop/ithc-quickspi$ sudo modprobe ithc`
Steps taken in test:
sudo modprobe -r ithc
echo options ithc logregs dyndbg=+pflmt | sudo tee /etc/modprobe.d/ithc-debug.conf
git clone -b quickspi https://github.com/quo/ithc-linux ithc-quickspi
sudo make dkms-install
sudo modprobe ithc
Result: Touchscreen was not working after applying the ITHC module
Thanks! Pretty much the entire initialization sequence actually seems to be working correctly, that's already a lot better than I was expecting. Only the final step of reading the report descriptor is failing. I'll have a better look at it later.
@CiaranWinna Sorry for the delay. You're still on Ubuntu/Pop? I'll try to get a kernel built for you to test today (regarding shutdown issue).
Hi @qzed, no not a problem at all! Yes, I am still on PopOS :)
@CiaranWinna Alright, let me know if this helps: https://github.com/linux-surface/linux-surface/releases/tag/debian-6.6.6-1-sls2-shutdown. You will need to manually download and install those packages (e.g. with dpkg -i <files>
), and you will need to disable secureboot in order to boot into the kernel.
The surface laptop studio seems well supported by linux-surface.
Do you think linux-surface would also support the surface laptop studio 2 ?
Regards