linux-surface
linux-surface copied to clipboard
[Surface Laptop 2] Internal keyboard doesn't work.
Hi. Thank you for supporting this great hardware! I just bought Surface Laptop 2 2018 and trying to get Linux work on it. At this point most hardware works fine but not internal keyboard. Evtest shows both Microsoft Virtual HID Framework Device Keyboard and Microsoft Virtual HID Framework Device Consumer Control but there is no events comes from. I tried ACPI from this repo https://github.com/qzed/linux-surfacegen5-acpi but it change nothing. Could you please help me to solve this problem. Thank you!
Ubuntu 19.04
[ 0.000000] Linux version 5.0.10-surface-linux-surface (jake@jake-Surface-Book-2) (gcc version 8.3.0 (Ubuntu 8.3.0-6ubuntu1~18.10)) #5 SMP Wed May 1 06:29:54 EDT 2019 [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.0.10-surface-linux-surface root=UUID=b059c592-0f21-4534-bf0f-3d5854f76465 ro quiet splash vt.handoff=1 [ 0.107531] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.0.10-surface-linux-surface root=UUID=b059c592-0f21-4534-bf0f-3d5854f76465 ro quiet splash vt.handoff=1 [ 1.554329] usb usb1: Manufacturer: Linux 5.0.10-surface-linux-surface xhci-hcd [ 1.556351] usb usb2: Manufacturer: Linux 5.0.10-surface-linux-surface xhci-hcd [ 4.455908] surfacegen5_acpi_san MSHW0091:00: Linked as a consumer to serial0-0 [ 4.473696] surfacegen5_acpi_vhf MSHW0096:00: Linked as a consumer to serial0-0 [ 546.069707] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 546.171513] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 546.273013] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 546.273032] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 546.374585] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 546.475077] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.075890] surfacegen5_acpi_ssh serial0-0: rqst: communication timed out [ 547.075908] surfacegen5_acpi_san MSHW0091:00: surfacegen5_ec_rqst: IO error occured, trying again [ 547.078952] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.078965] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.180686] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.282326] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.383695] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.484442] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.484460] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 548.099775] surfacegen5_acpi_ssh serial0-0: rqst: communication timed out [ 548.099783] surfacegen5_acpi_san MSHW0091:00: surfacegen5_ec_rqst: IO error occured, trying again [ 3028.026353] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 3028.127481] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message
@AlexeyPogorelov This seems to be the same underlying issue as https://github.com/qzed/linux-surfacegen5-acpi/issues/19. Can you try a hard-reset and check if it's some kind of EC hangup (unfortunately the communication there does not seem as stable as on Windows). According to https://support.microsoft.com/en-us/help/4036280/surface-force-a-shut-down-and-restart-your-surface, for the Surface Laptop 2 this works as follows:
Press and hold down the power button until your Surface restarts and you see the Windows logo screen (this takes about 20 seconds), then release the power button.
@qzed thank you for your response. I just tried several times but problem is not fixed(
@AlexeyPogorelov Sorry for the delay. Can you try the surface-acpi development module (the one you linked above) and get some logs from it? For this you may need to enable debug messages (i.e. run sudo dmesg -n 8
), unload the module included in the kernel and then load the module from the repo (i.e. run sudo modprobe -r surface_acpi
and sudo insmod surfacegen5_acpi.ko
from inside the module directory of the repo, alternatively you could also install the module via sudo make dkms-install
and blacklist suface_acpi
). This should give more information, specifically the bytes received and sent.
Something that could also reset the EC (if that is really the problem here) is a restart from inside windows. You could also check if there is any error-indication in the windows "Event Viewer" (under "Windows Logs") that could relate to the EC.
The same happens at my Surface Laptop (1). I installed everything like in the readme. What informations do you need for troublesooting? Let me know and I send you all data I can find :) Or should I open a seperated issue for the SL1?
@emha No need to open a new issue, looks like it's the same.
A dmesg
log with the module loaded would be helpful. This should show the messages being sent between the EC and host (you should see something like ... sent:
or ...received:
and then some bytes). I think it might also help if you just press a few keys on the keyboard, should give us more data to work with.
Attached my dmesg
output. I hope it helps. The Logitech
keyboard is an external keyboard I use to handle the terminal. I tried dmesg -w
to watch live changes when I press the keys of the built in keyboard but nothing happened. If the data is not correct or you need more please let me know.
I didn't paste the lines because I think that are too much :)
[dmesg.txt](https://github.com/jakeday/linux-surface/files/3307008/dmesg.txt)
@emha Are you sure you have installed and loaded the module as described above? I can't see any EC communication. Should look something like this:
[ 143.489926] recv: 00000000: aa 55 80 18 00 c9 5f fb 80 02 00 01 02 40 06 03
[ 143.489962] surfacegen5_acpi_ssh serial0-0: recv: received buffer (size: 18)
[ 143.489962] recv: 00000000: 00 00 00 00 00 00 00 00 16 e4 00 00 09 33 00 00
[ 143.489963] recv: 00000010: b8 42
[ 143.489965] surfacegen5_acpi_ssh serial0-0: recv: valid command message received
[ 143.489973] surfacegen5_acpi_ssh serial0-0: sending message
[ 143.489974] send: 00000000: aa 55 40 00 00 c9 39 a2 ff ff
[ 143.490474] surfacegen5_acpi_ssh serial0-0: sending message
[ 143.490476] send: 00000000: aa 55 80 08 00 33 69 f6 80 02 01 00 01 60 06 0d
[ 143.490476] send: 00000010: 28 7f
[ 143.490904] surfacegen5_acpi_ssh serial0-0: recv: received buffer (size: 10)
[ 143.490908] recv: 00000000: aa 55 40 00 00 33 6c ec ff ff
[ 143.490911] surfacegen5_acpi_ssh serial0-0: recv: valid control message received (type: 0x40)
[ 143.491674] surfacegen5_acpi_ssh serial0-0: recv: received buffer (size: 22)
[ 143.491675] recv: 00000000: aa 55 80 0c 00 ca 9f 54 80 02 00 01 01 60 06 0d
[ 143.491676] recv: 00000010: 01 00 00 00 2e 4b
[ 143.491677] surfacegen5_acpi_ssh serial0-0: recv: valid command message received
[ 143.491681] surfacegen5_acpi_ssh serial0-0: sending message
[ 143.491682] send: 00000000: aa 55 40 00 00 ca 5a 92 ff ff
I think so. I did the following instruction from the readme:
(Prep) Install Dependencies:
sudo apt install git curl wget sed
Clone the linux-surface repo:
git clone --depth 1 https://github.com/jakeday/linux-surface.git ~/linux-surface
Change directory to linux-surface repo:
cd ~/linux-surface
Run setup script:
sudo sh setup.sh
Reboot on installed kernel.
With Reboot on installed kernel
you mean just a normal reboot? The installation finished without any errors.
@emha Ah, sorry I thought you were following the instructions to install/compile the surface-acpi module. Unfortunately, you need to install the surface-acpi module separately for all the debugging functionality. For that you need to run
git clone https://github.com/qzed/linux-surfacegen5-acpi
cd linux-surfacegen5-acpi/module
make
then unload the in-kernel module via sudo modprobe -r surface_acpi
and load the module you just compiled via sudo insmod surfacegen5_acpi.ko
. After that you should see the messages in the log. Let me know if you have any questions.
Oh I'am sorry. I looked into the surfacegen5 repo and in the readme they wrote that it has been merged into this project so I thought this wouldn't be necessary. Attached the new file. Now with the matching messages.
@emha Nothing to be sorry for! It's only required for debugging, as I've disabled most of the logs for this repo here to not flood the output.
Your logs look good, have you typed anything? I can only see battery messages. If you did, it looks like we need to specifically enable keyboard events (this is already done for other event sources, i.e. thermal and battery, for the keyboard it until now seemed to work without doing this, but that assumption might be wrong).
To enable it you can run the following script (as root):
#!/usr/bin/env python3
import sys
import os
def main(path):
fd = os.open(path, os.O_RDWR | os.O_SYNC)
# [ TC, IID, CID, SNC, CDL, payload...]
data = bytes([0x01, 0x00, 0x0b, 0x01, 0x04, 0x01, 0x01, 0x01, 0x00])
os.write(fd, data)
os.lseek(fd, 0, os.SEEK_SET)
length = os.read(fd, 1)[0]
data = os.read(fd, length)
os.close(fd)
print(' '.join(['{:02x}'.format(x) for x in data]))
if __name__ == '__main__':
main('/sys/bus/serial/devices/serial0-0/rqst')
I think this should enable it, but I'm not sure if the target controller (first byte, 0x01
, in the payload) is correct. Also: You again need to have the module loaded for the script to work.
So if all of my assumptions above are correct, after you've run the script (with the module loaded) you should have keyboard input.
Ok, I did the following steps:
sudo modprobe -r surface_acpi
sudo insmod surfacegen5_acpi.ko
After that i saved the script into keyboard.py
and executed it as sudo python3 keyboard.py
. But that didn't work. Attached a new dmesg file where I grepped the results for easier reading. I added many many key presses :) Or were my steps wrong?
@emha Your steps look correct. I've only had a quick look at it and it seems like the command that should enable it is not correct. (Indicated by a aa 55 04
message). As I've mentioned before, this might mean that the target controller byte is wrong. There is also a "magic" byte that I just assume to be 0x01
(haven't seen it take any other values in the logs from windows) but that assumption could also be wrong. I'm not at my PC at the moment, so I'll check back later, but you could try and play around with changing the target controller value (first 0x01 in payload part). 0x02 is for battery, 0x03 for thermals, 0x11 for sb2 base detachment, so any other value could work. (Playing around with this shouldn't break anything, as always I cant give you any hard guarantees though.)
I have no idea what I did but 0x08
did the trick :) So the complete line looks like this:
data = bytes([0x01, 0x00, 0x0b, 0x01, 0x04, 0x08, 0x01, 0x01, 0x00])
Do I have to do these steps every time after system startup? So would it make sense for me to write a small script which does this automatically?
@emha That's awesome, thank you!
Do I have to do these steps every time after system startup? So would it make sense for me to write a small script which does this automatically?
Until I integrate that into the module/it gets integrated into this kernel, yeah. I'll integrate it into the module right away, but the kernel patches and inclusion in this repo here might take a couple of days.
Alternatively to the script you could also install the dev module via dkms and blacklist surface_acpi
until it's included in the kernel. I'll ping this issue once I've updated the module, shouldn't take long.
@emha Alright, can you try the updated module? Should work now without the script.
@emha Also, if you have Windows installed and want to help implement support for the caps-lock light, please have a look at https://github.com/qzed/linux-surfacegen5-acpi/issues/8. Basically all I need for that are some logs from Windows, however it's a bit intricate to get them.
@qzed Alright, no problem. I thought it would maybe take several weeks or months to implement it :)
At this time I don't have windows installed anymore, sorry :(
Thank you very much for your awesome help!
Will be fixed by #540.
I've uploaded two new releases to https://github.com/qzed/linux-surface/releases containing the fix (5.2.14 and 4.19.72). Would be neat if you could check if the fix works, thanks!
I've uploaded two new releases to https://github.com/qzed/linux-surface/releases containing the fix (5.2.14 and 4.19.72). Would be neat if you could check if the fix works, thanks!
@qzed may a little howto get it persistent then if load module acpi5 is needed ?
Loading the module should not be necessary on those releases. The keyboard should work without the modules (in these releases the kernel contains the exact same code as provided by the module, so there shouldn't be any different behavior unless it's caused by something non-deterministic or the EC).
Edit: I've updated the readme of the module with info on how to persistently use the module.
@qzed
thanks alot, tested ubuntu 19 with 5.2.14 and all is good ;)
no module change needed as expected from you
Awesome, thanks. Let me know if there are any more keyboard issues.
Awesome, thanks. Let me know if there are any more keyboard issues.
@qzed
some excessive tests today morning, also all good, reboots, suspend (short and long), all good
now i wait for update main so i hope the touchscreen is working again
@alturismo Touchscreen should be working on those releases.
@alturismo Touchscreen should be working on those releases.
@qzed
run the seup.sh from the 5.1.15 instructions now, just without kernel download and install, so more or less just libwacom driver or so and now touchscreen also works ;) but not by default and just installing the 5.2.14 kernel.
last step here to get wlan always working when resuming from suspend, but thats another topic, have to check wich devicename my wifi has to modprobe -r and ...
@qzed little update on your 5.3.1 release keyboard check, all good. touchscreen gone, also not when manually running setup.sh from linux-surface repo libwacom ...
just as note
wlen suspend issue i still need to check here
@alturismo The touchscreen worked on the 5.2.x kernels though, right? I suspect this might be an issue with some changes to IPTS that we introduced in 5.3. See also https://github.com/jakeday/linux-surface/issues/574.
Also CC @StollD, but let's move the conversation about touchscreen to #574.
@qzed exactly, with 5.2 it worked after manually triggering setup.sh from linux-surface repo
suspend, still dead wifi after wakup
@alturismo thanks, for the wifi problems you may want to check some of the other issues here. Unfortunately I'm currently not up-to-date on them, so I'm not much help there.
Hi. Thank you for supporting this great hardware! I just bought Surface Laptop 2 2018 and trying to get Linux work on it. At this point most hardware works fine but not internal keyboard. Evtest shows both Microsoft Virtual HID Framework Device Keyboard and Microsoft Virtual HID Framework Device Consumer Control but there is no events comes from. I tried ACPI from this repo https://github.com/qzed/linux-surfacegen5-acpi but it change nothing. Could you please help me to solve this problem. Thank you!
Ubuntu 19.04
[ 0.000000] Linux version 5.0.10-surface-linux-surface (jake@jake-Surface-Book-2) (gcc version 8.3.0 (Ubuntu 8.3.0-6ubuntu1~18.10)) #5 SMP Wed May 1 06:29:54 EDT 2019 [ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.0.10-surface-linux-surface root=UUID=b059c592-0f21-4534-bf0f-3d5854f76465 ro quiet splash vt.handoff=1 [ 0.107531] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.0.10-surface-linux-surface root=UUID=b059c592-0f21-4534-bf0f-3d5854f76465 ro quiet splash vt.handoff=1 [ 1.554329] usb usb1: Manufacturer: Linux 5.0.10-surface-linux-surface xhci-hcd [ 1.556351] usb usb2: Manufacturer: Linux 5.0.10-surface-linux-surface xhci-hcd [ 4.455908] surfacegen5_acpi_san MSHW0091:00: Linked as a consumer to serial0-0 [ 4.473696] surfacegen5_acpi_vhf MSHW0096:00: Linked as a consumer to serial0-0 [ 546.069707] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 546.171513] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 546.273013] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 546.273032] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 546.374585] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 546.475077] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.075890] surfacegen5_acpi_ssh serial0-0: rqst: communication timed out [ 547.075908] surfacegen5_acpi_san MSHW0091:00: surfacegen5_ec_rqst: IO error occured, trying again [ 547.078952] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.078965] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.180686] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.282326] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.383695] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.484442] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 547.484460] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 548.099775] surfacegen5_acpi_ssh serial0-0: rqst: communication timed out [ 548.099783] surfacegen5_acpi_san MSHW0091:00: surfacegen5_ec_rqst: IO error occured, trying again [ 3028.026353] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message [ 3028.127481] surfacegen5_acpi_ssh serial0-0: recv: invalid start of message
could you solve this problem,I have same problem ,please help me.thank you?
could you solve this problem?I have same problem,please help me.I need you help.
@TSWorld1314 have a look at https://github.com/linux-surface/linux-surface/. There have been a couple of updates on the driver handling the keyboard which are integrated there.
@TSWorld1314 have a look at https://github.com/linux-surface/linux-surface/. There have been a couple of updates on the driver handling the keyboard which are integrated there.
thanks for you,really thanks.