Bug 31444

Summary: Surface Pro 9 Keyboard and touch-pad are not recognized on MGA9
Product: Mageia Reporter: christian barranco <chb0>
Component: RPM PackagesAssignee: Kernel and Drivers maintainers <kernel>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: Normal CC: ezequiel_partida, ghibomgx
Version: Cauldron   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: kernel-6.1.7-2.mga9.src.rpm CVE:
Status comment:
Attachments: dmesg fom Fedora
dmesg MGA9 kernel-6.1.8
dmesg -t on Manjaro with Surface kernel 6.1.9
dmesg -t on Manjaro with stock kernel 6.1.11
dmesg with MGA9 kernel 6.1.12
lsmod 6.1.11-arch-surface
lsmod MGA9 6.1.12
lsmod Manjaro 6.1.11 unmodified
linux-surface patches added to MGA9 spec
adjustment of defconfig-x86_64-desktop
list of additional modules to load
adjustment of the spec file
conf file to adjust kernel with module to detect typecover keyboard
surface config file for 6.3
.config differences between 6.3.2-surface and 6.3.2-mga_initial
.config differences between 6.3.2-surface and 6.3.0-surface

Description christian barranco 2023-01-23 13:39:52 CET
Description of problem:
Despite the kernel belongs to the 6.1 series, the keyboard and the touchpad are not active on my Surface Pro 9.
Manjaro with kernel 6.1.1 detects them right away.
Installing Linux Mint and updating to kernel 6.1.7 allows to detect them as well.

Version-Release number of selected component (if applicable):


How reproducible: always


Steps to Reproduce:
1. Install Mageia 9 beta on Surface Pro 9

Output of lspcidrake -v below. I had to plug a Logitech RF keyboard on a Dell D6000 dock to be able to interact with the laptop.
```
intel_vsec      : Intel Corporation|Platform Monitoring Technology [SIGNAL_OTHER] (vendor:8086 device:467d subv:8086 subd:7270) (rev: 01)
intel_lpss_pci  : Intel Corporation|Alder Lake PCH Serial IO I2C Controller #3 (vendor:8086 device:51eb subv:8086 subd:7270) (rev: 01)
unknown         : Intel Corporation|Device 465d [MULTIMEDIA_OTHER] (vendor:8086 device:465d subv:8086 subd:7270) (rev: 04)
xhci_pci        : Intel Corporation|Alder Lake PCH USB 3.2 xHCI Host Controller [SERIAL_USB] (vendor:8086 device:51ed subv:8086 subd:7270) (rev: 01)
i915            : Intel Corporation|Alder Lake-UP3 GT2 [Iris Xe Graphics] [DISPLAY_VGA] (vendor:8086 device:46a8 subv:1414 subd:0063) (rev: 0c)
unknown         : Intel Corporation|Device 51d0 [INPUT_PEN] (vendor:8086 device:51d0 subv:1414 subd:0064) (rev: 01)
unknown         : Intel Corporation|Alder Lake PCH Shared SRAM [MEMORY_RAM] (vendor:8086 device:51ef subv:8086 subd:7270) (rev: 01)
unknown         : Intel Corporation|Alder Lake-P Thunderbolt 4 PCI Express Root Port #3 [BRIDGE_PCI] (vendor:8086 device:461f subv:0061 subd:0000) (rev: 04)
unknown         : Intel Corporation|12th Gen Core Processor PCI Express x4 Controller #0 [BRIDGE_PCI] (vendor:8086 device:464d) (rev: 04)
intel_lpss_pci  : Intel Corporation|Alder Lake PCH Serial IO I2C Controller #0 (vendor:8086 device:51e8 subv:8086 subd:7270) (rev: 01)
intel_lpss_pci  : Intel Corporation|Alder Lake PCH Serial IO I2C Controller #2 (vendor:8086 device:51ea subv:8086 subd:7270) (rev: 01)
igen6_edac      : Intel Corporation|Device 4601 [BRIDGE_HOST] (vendor:8086 device:4601 subv:8086 subd:7270) (rev: 04)
snd_hda_intel   : Intel Corporation|Alder Lake PCH-P High Definition Audio Controller [MULTIMEDIA_AUDIO_DEV] (vendor:8086 device:51c8 subv:8086 subd:7270) (rev: 01)
intel_lpss_pci  : Intel Corporation|Alder Lake PCH UART #0 [COMMUNICATION_OTHER] (vendor:8086 device:51a8 subv:8086 subd:7270) (rev: 01)
thunderbolt     : Intel Corporation|Alder Lake-P Thunderbolt 4 NHI #1 [SERIAL_USB] (vendor:8086 device:466d subv:8086 subd:7270) (rev: 04)
spi_intel_pci   : Intel Corporation|Alder Lake-P PCH SPI Controller (vendor:8086 device:51a4 subv:8086 subd:7270) (rev: 01)
unknown         : Intel Corporation|Alder Lake-P Thunderbolt 4 PCI Express Root Port #2 [BRIDGE_PCI] (vendor:8086 device:462f subv:0060 subd:0000) (rev: 04)
mei_me          : Intel Corporation|Alder Lake PCH HECI Controller [COMMUNICATION_OTHER] (vendor:8086 device:51e0 subv:8086 subd:7270) (rev: 01)
iwlwifi         : Intel Corporation|Alder Lake-P PCH CNVi WiFi [NETWORK_OTHER] (vendor:8086 device:51f0 subv:8086 subd:0094) (rev: 01)
unknown         : Samsung Electronics Co Ltd|NVMe SSD Controller PM9B1 (vendor:144d device:a80b) (rev: 02)
intel_lpss_pci  : Intel Corporation|Alder Lake-P Serial IO I2C Controller #2 (vendor:8086 device:51d8 subv:8086 subd:7270) (rev: 01)
unknown         : Intel Corporation|Alder Lake PCH eSPI Controller [BRIDGE_ISA] (vendor:8086 device:5182 subv:8086 subd:7270) (rev: 01)
xhci_pci        : Intel Corporation|Alder Lake-P Thunderbolt 4 USB Controller [SERIAL_USB] (vendor:8086 device:461e subv:8086 subd:7270) (rev: 04)
unknown         : Intel Corporation|12th Gen Core Processor Gaussian & Neural Accelerator [SYSTEM_OTHER] (vendor:8086 device:464f subv:8086 subd:7270) (rev: 04)
hub             : Linux 6.1.7-desktop-1.mga9 xhci-hcd|xHCI Host Controller [Hub|Unused|Full speed (or root) hub] (vendor:1d6b device:0002)
hub             : Linux 6.1.7-desktop-1.mga9 xhci-hcd|xHCI Host Controller [Hub|Unused|Full speed (or root) hub] (vendor:1d6b device:0003)
hub             : GenesysLogic|USB3.1 Hub [Hub|Unused|Full speed (or root) hub] (vendor:05e3 device:0620)
snd_usb_audio   : DisplayLink|Dell Universal Dock D6000 [Audio|Control Device] (vendor:17e9 device:6006)
hub             : GenesysLogic|USB3.1 Hub [Hub|Unused|Full speed (or root) hub] (vendor:05e3 device:0620)
hub             : Linux 6.1.7-desktop-1.mga9 xhci-hcd|xHCI Host Controller [Hub|Unused|Full speed (or root) hub] (vendor:1d6b device:0002)
hub             : GenesysLogic|USB2.1 Hub [Hub|Unused|TT per port] (vendor:05e3 device:0610)
hub             : GenesysLogic|USB2.1 Hub [Hub|Unused|TT per port] (vendor:05e3 device:0610)
hub             : Genesys Logic, Inc.|USB2.0 Hub [Hub|Unused|Full speed (or root) hub] (vendor:05e3 device:0608)
usbhid          : Bizlink|D6000 Controller [Human Interface Device|No Subclass|None] (vendor:06c4 device:c411)
usbhid          : Logitech|USB Receiver [Human Interface Device|Boot Interface Subclass|Keyboard] (vendor:046d device:c52b)
btusb           : Intel Corp.|Unknown [Wireless|Radio Frequency|Bluetooth] (vendor:8087 device:0033)
hub             : Linux 6.1.7-desktop-1.mga9 xhci-hcd|xHCI Host Controller [Hub|Unused|Full speed (or root) hub] (vendor:1d6b device:0003)
hid_generic     : Logitech USB Receiver
hid_generic     : Logitech K400
hid_generic     : Logitech USB Receiver
hid_generic     : Logitech USB Receiver
hid_generic     : Bizlink D6000 Controller
```
christian barranco 2023-01-23 13:40:13 CET

Summary: Surface Pro 9 Keyboard and touch-pad are not recognized => Surface Pro 9 Keyboard and touch-pad are not recognized on MGA9

Comment 1 christian barranco 2023-01-23 14:36:47 CET
Hi. Just checked with Fedora: updating to kernel 6.1.7 allows getting to work the keyboard and the touchpad.
Comment 2 Lewis Smith 2023-01-23 20:04:29 CET
Thank you for the report, especially all the comparisons:
- Manjaro with kernel 6.1.1 detects them right away.
- Linux Mint and updating to kernel 6.1.7 allows to detect them
- Fedora: updating to kernel 6.1.7 allows getting to work the keyboard and the touchpad

Can you please attach a compressed journal .xz :
 $ journalctl -b --no-hostname > afile.txt
 $ xz afile.txt              (produces afile.txt.xz)

Assigning to kernel/drivers in anticipation.

Assignee: bugsquad => kernel

Comment 3 Thomas Backlund 2023-01-23 21:45:30 CET
Can you attach dmesg from mageia and from manjaro, mint or fedora too so I can compare what driver is active in their setup that we misses...

I've already queued support for:
- hid: Add support for Intel Precise Touch and Stylus
- hid: Add support for Intel Touch Host Controller

and adjusted the defconfigs a bit
Comment 4 christian barranco 2023-01-23 22:57:19 CET
Thanks Lewis and Thomas for your prompt support. 
I am travelling until the end of the week. I should be able to post all of that on Saturday. 
TomS, the additional support you are aiming for is gorgeous!
Comment 5 Thomas Backlund 2023-01-24 20:44:44 CET
Please try with kernel-6.1.8-1.mga9 and see if that works any better...
Comment 6 christian barranco 2023-01-24 20:54:00 CET
Created attachment 13659 [details]
dmesg fom Fedora

Hi. I am travelling and I don't have an external keyboard with me, to connect to Mageia.
Meanwhile, here is dmesg output from Fedora.
Comment 7 christian barranco 2023-01-29 16:00:15 CET
Hi. Did more tests. For some reasons, installing from DVD iso leads, after restart, either to a black screen with the mouse pointer for KDE or a black screen for Cinnamon.
I have tried the installations with and without updating the packages; same issues.

The only way to install Mageia 9 is through a live KDE ISO beta1 (I have created it).
After restarting, I get the windows to configure the user and I updated the system. I have then kernel-6.1.8-1

The graphical interface is buggy; cannot select precisely the menu items of KDE system settings, for instance.
The keyboard and the touchpad of the Surface don't work. HOWEVER, touchscreen works! It is moving towards the right direction.

Here attached is a dmesg outpout for MGA9.
Comment 8 christian barranco 2023-01-29 16:01:30 CET
Created attachment 13662 [details]
dmesg MGA9 kernel-6.1.8

dmesg outpout, after a KDE live ISO installation with package updates and kernel 6.1.8
Comment 9 christian barranco 2023-01-29 21:59:05 CET
Hi Tomas. In case it would help, I have found this link:
https://github.com/linux-surface/linux-surface
Comment 10 christian barranco 2023-02-12 17:21:10 CET
Created attachment 13697 [details]
dmesg -t on Manjaro with Surface kernel 6.1.9

Hi Tomas. Unsure what the status is. In case you would need more info, here is the output of dmesg -t on Manjaro with the kernel 6.1.9 from the Linux-surface github. Link on the previous post.
With this kernel both keyboard/touchpad and touchscreen work.
Comment 11 christian barranco 2023-02-12 17:23:41 CET
Created attachment 13698 [details]
dmesg -t on Manjaro with stock kernel 6.1.11

and now here the output of dmesg -t on Manjaro, with stock kernel 6.1.11
keyboard and touchpad work with this kernel.
touchscreen doesn't work.
Thanks for your great support.
Comment 12 Thomas Backlund 2023-02-12 18:42:56 CET
Does the Mageia kernel-6.1.11-3 improve anything ?
Comment 13 christian barranco 2023-02-12 19:22:52 CET
(In reply to Thomas Backlund from comment #12)
> Does the Mageia kernel-6.1.11-3 improve anything ?

Hi Tomas. I will still be working abroad for one more week. I will not be able to test before next weekend.
What changes have you made with 6.1.11-3?
Ideally, I need the installation ISO embarking it as well. But I will be able to do some tests, definitely.
Thanks
Comment 14 Thomas Backlund 2023-02-12 19:35:40 CET
(In reply to christian barranco from comment #13)
> (In reply to Thomas Backlund from comment #12)
> > Does the Mageia kernel-6.1.11-3 improve anything ?
> 
> Hi Tomas. I will still be working abroad for one more week. I will not be
> able to test before next weekend.
> What changes have you made with 6.1.11-3?

a lot :)

> Ideally, I need the installation ISO embarking it as well. But I will be
> able to do some tests, definitely.

Nonfree installer and current beta1 round 5 isos also have a kernel that has several changes
Comment 15 christian barranco 2023-02-13 22:19:29 CET
Hi. I succeeded to flash the beta1 iso5 on an usb drive. 
Live ISO Gnome boots on 6.1.10. 
The keyboard and the touchpad are not recognized. 
However, touchscreen works. 
I succeeded to start the installer only using the touchscreen. However, I was not able to change the downloader to get a network update. I then got an aria2 error. 
The laptop restarted and I was able to do the update to get the kernel 6.1.11. I have then access to the virtual visual keyboard. 
However the virtual visual keyboard cannot be used with the dark installer. It prevented to complete the full configuration. Especially as I was not able to open gedit for some reason, to do copy/paste. I read on the ML that Gnome has some issues?

I restarted once more to boot on 6.1.11. 
Then, I got a black screen after the grub, stating:
“ACPI error: could not disable RealTimeClock events (20220331/evxfevnt-243)”
Comment 16 christian barranco 2023-02-19 20:45:58 CET
Created attachment 13707 [details]
dmesg with MGA9 kernel 6.1.12

Hi. Some news: I succeeded a fresh full installation of Gnome, using Beta1 round6.
The installation went well but still no keyboard and touchpad; but touchscreen works. I had to connect an external keyboard.
After network update, reboot on 6.1.12. Still no keyboard and touchpad but touchscreen works. 
dmesg -t here attached.

It should be a major difference somewhere between the Manjaro/Arch kernel and the Mageia one.
Manjaro/Arch has always recognized the keyboard and touchpad, without touchscreen; with Mageia, it is the other way around.
To get touchscreen with Manjaro/Arch, I had to install the linux-surface kernel.
Comment 17 Thomas Backlund 2023-02-19 21:06:50 CET
can you on arch do an:

 lsmod 

and attach the output here
Comment 18 christian barranco 2023-02-19 21:21:52 CET
Created attachment 13708 [details]
lsmod 6.1.11-arch-surface

lsmod output requested by Tomas
Comment 19 Thomas Backlund 2023-02-19 21:24:23 CET
oh, and the same lsmod from Mageia
Comment 20 christian barranco 2023-02-19 21:45:14 CET
Created attachment 13709 [details]
lsmod MGA9 6.1.12

As requested by Thomas
Comment 21 Thomas Backlund 2023-02-19 22:05:55 CET
interestingly almost none of the surface mods is loaded in mageia.

What does happend if you  "modprobe surface_hid" ?
Comment 22 christian barranco 2023-02-19 22:46:53 CET
Created attachment 13710 [details]
lsmod Manjaro 6.1.11 unmodified

Sorry Thomas, my previous Manjaro lsmod might have been misleading. I did it using the modified linux-surface kernel (Github project).
Here is lsmod with the standard kernel shipped by Manjaro. With this kernel, keyboard and touchpad work, but not the touchscreen.
Comment 23 christian barranco 2023-02-20 09:46:36 CET
(In reply to Thomas Backlund from comment #21)
> interestingly almost none of the surface mods is loaded in mageia.
> 
> What does happend if you  "modprobe surface_hid" ?

Hi. Not enough at least; still don't get keyboard and touchpad.
Comment 24 christian barranco 2023-03-05 22:20:48 CET
Hi. Just updated to 6.2.2. Same issue.
Comment 25 christian barranco 2023-03-13 22:45:06 CET
Hi. Suggestion: what about adding all linux-surface patches? I just saw you have added a couple of them?
Thanks
Comment 26 christian barranco 2023-04-17 12:21:20 CEST
Hi. Still doesn't work with 6.2.11

I did a modprobe on all these modules, but it didn't help:
hid_multitouch
hid_sensor_accel_3d
hid_sensor_als
hid_sensor_custom
hid_sensor_gyro_3d
hid_sensor_hub
hid_sensor_iio_common
hid_sensor_incl_3d
hid_sensor_magn_3d
hid_sensor_rotation
hid_sensor_trigger
intel_gtt
mac_hid
nvme
nvme_common
nvme_core
surface_aggregator_hub
surface_battery
surface_charger
surface_hid
surface_hid_core
surface_platform_profile
thunderbolt

It looks like there might be something linked to surface-aggregator: https://github.com/linux-surface/linux-surface/issues/984

Any idea?
Comment 27 christian barranco 2023-04-26 19:12:45 CEST
Hi. Still don't work with 6.3.0
I start wondering whether the issue is only linked to the kernel?
Comment 28 christian barranco 2023-04-26 21:55:17 CEST
Would this link help? 
https://github.com/linux-surface/linux-surface/tree/master/pkg/fedora/kernel-surface
Comment 29 christian barranco 2023-04-26 22:10:57 CEST
(In reply to christian barranco from comment #28)
> Would this link help? 
> https://github.com/linux-surface/linux-surface/tree/master/pkg/fedora/kernel-
> surface

Actually, this one below might be better, or?
https://github.com/linux-surface/linux-surface/tree/master/patches/6.2
Comment 30 christian barranco 2023-04-29 08:08:53 CEST
Hi

News: 
1/ I have rebuilt the Mageia 6.3 kernel, using all the linux-surface patches, but the camera one. -> no luck, still no keyboard.
2/ In addition to the patches, I have modified the defconfig-x86_64-desktop file to reflect more the linux-surface config -> no luck, still no keyboard
3/ I have added a surface.conf in /etc/modules-load.d/ to load some modules I see with lsmod in Manjaro -> no luck, still no keyboard

Any ideas?
Comment 31 christian barranco 2023-04-29 08:16:56 CEST
Created attachment 13797 [details]
linux-surface patches added to MGA9 spec

I had also to embed zstd 1.5.4 to build locally with mock
Comment 32 christian barranco 2023-04-29 08:19:41 CEST
Created attachment 13798 [details]
adjustment of defconfig-x86_64-desktop
Comment 33 christian barranco 2023-04-29 08:21:01 CEST
Created attachment 13799 [details]
list of additional modules to load

placed in /etc/modules-load.d
Comment 34 christian barranco 2023-04-29 09:42:53 CEST
Comparing dmesg with Manjaro, it looks like hid-generic finds the keyboard, but not MGA9.

With Manjaro, I have this in dmesg:

hid-generic 0001:045E:0C52.0001: input,hidraw0: <UNKNOWN> HID v1.00 Device [Intel Touch Host Controller] on pci-0000:00:10.6/ithc

hid-generic 0019:045E:005D.0002: hidraw1: <UNKNOWN> HID v1.11 Device [Microsoft Surface 045E:005D] on 01:15:01:07:00


Looking at lsmod, Manjaro has hid_sensor_custom but it does not exist with MGA9
Comment 35 christian barranco 2023-04-29 09:47:19 CEST
Could it be something related to libinput?
Comment 36 Giuseppe Ghibò 2023-04-29 09:59:57 CEST
(In reply to christian barranco from comment #34)

> Comparing dmesg with Manjaro, it looks like hid-generic finds the keyboard,
> but not MGA9.
> 
> With Manjaro, I have this in dmesg:
> 
> hid-generic 0001:045E:0C52.0001: input,hidraw0: <UNKNOWN> HID v1.00 Device
> [Intel Touch Host Controller] on pci-0000:00:10.6/ithc
> 
> hid-generic 0019:045E:005D.0002: hidraw1: <UNKNOWN> HID v1.11 Device
> [Microsoft Surface 045E:005D] on 01:15:01:07:00
> 
> 
> Looking at lsmod, Manjaro has hid_sensor_custom but it does not exist with
> MGA9

to get it you need to change CONFIG_HID_SENSOR_CUSTOM_SENSOR to

CONFIG_HID_SENSOR_CUSTOM_SENSOR=m

in the defconfig-x86-64-desktop file.

CC: (none) => ghibomgx

Comment 37 christian barranco 2023-04-29 13:05:15 CEST
Thanks Giuseppe

Yes, meanwhile, I noticed this difference with the config file used by Arch.
I was not fully sure but, now, you confirm my feeling.
A new version of the kernel, is building ; answer soon !!!
Comment 38 christian barranco 2023-04-29 14:13:25 CEST
It is better. But it doesn't work yet. 

I have now:

hid-generic 0001:045E:0C52.0001: input,hidraw0: <UNKNOWN> HID v1.00 Device [Intel Touch Host Controller] on pci-0000:00:10.6/ithc


But I still don't have, like with Manjaro:
hid-generic 0019:045E:005D.0002: hidraw1: <UNKNOWN> HID v1.11 Device [Microsoft Surface 045E:005D] on 01:15:01:07:00


Any ideas ?


Note: meanwhile, I have update libinput to 1.23.0, but no effect.
Comment 39 Giuseppe Ghibò 2023-04-29 15:34:08 CEST
CONFIG_TOUCHSCREEN_HIDEEP=m
CONFIG_USB_CONN_GPIO=m

?

Furthermore is that a bluetooth device? Is bluetooth active/enabled?
Comment 40 christian barranco 2023-04-29 21:31:30 CEST
(In reply to Giuseppe Ghibò from comment #39)
> CONFIG_TOUCHSCREEN_HIDEEP=m
> CONFIG_USB_CONN_GPIO=m
> 
Didn't help

> 
> Furthermore is that a bluetooth device? Is bluetooth active/enabled?
BT is enabled but it is not such devive


I added as well
CONFIG_SERIAL_DEV_BUS=y
SERIAL_DEV_CTRL_TTYPORT=y

based on https://github.com/linux-surface/linux-surface/discussions/981

But, still no keyboard.

Other ideas?
Comment 41 Giuseppe Ghibò 2023-04-29 22:20:20 CEST
(In reply to christian barranco from comment #40)

> (In reply to Giuseppe Ghibò from comment #39)
> > CONFIG_TOUCHSCREEN_HIDEEP=m
> > CONFIG_USB_CONN_GPIO=m
> > 
> Didn't help
> 
> > 
> > Furthermore is that a bluetooth device? Is bluetooth active/enabled?
> BT is enabled but it is not such devive
> 
> 
> I added as well
> CONFIG_SERIAL_DEV_BUS=y
> SERIAL_DEV_CTRL_TTYPORT=y
> 
> based on https://github.com/linux-surface/linux-surface/discussions/981
> 
> But, still no keyboard.
> 
> Other ideas?

Maybe you need a custom/special udev rules in /usr/lib/udev/rules.d/ or /etc/udev/rules.d to emerge the extra /dev/hidraw1 ? Or also the iptsd.service service (from https://github.com/linux-surface/iptsd) is required too?
Comment 42 christian barranco 2023-04-29 22:33:21 CEST
iptsd is not required anymore with recent kernels; at least not for the keyboard.

I will compare the udev rules with Manjaro.

I have found more differences with Arch kernel config, especially for 8250_dw, required for communication with the embedded controller.
https://github.com/linux-surface/linux-surface/wiki/Disk-Encryption

I am building my 7th version of kernel :)

Let us see...
Comment 43 christian barranco 2023-04-30 13:43:17 CEST
Still no luck with my latest build…
I will look at udev, but without too many hopes there. 
I might file a bug report to Linux-surface GitHub to get some assistance.
Comment 44 Thomas Backlund 2023-05-01 10:09:30 CEST
there is now a kernel-6.3.1-1 building

please try that one once it's built and reaches your mirror...
Comment 45 christian barranco 2023-05-03 03:14:05 CEST
Thanks Thomas. It is not enough though to get the keyboard/touchpad to work. 
HID-generic finds ITHC; which is an improvement. 
I will look more in details tomorrow.
Comment 46 christian barranco 2023-05-09 22:53:03 CEST
Hi.
During the build, at some point by the end of PrepareKernel(), surface_hid and surface_hid_core got removed from .config
Is it expected?
Comment 47 christian barranco 2023-05-13 17:19:43 CEST
Hi. Hurray!
I solved it by, at least, setting:
CONFIG_SERIAL_DEV_BUS=y
CONFIG_SERIAL_DEV_CTRL_TTYPORT=y

I have also added the full surface config and patches, from 
https://github.com/linux-surface/linux-surface

What is the best way going forward to maintain this?
Should I create a kernel-surface-latest package?
Or, Thomas, can you introduce all these adjustments in kernel-desktop-latest?

Thanks!
Comment 48 christian barranco 2023-05-13 17:21:27 CEST
Created attachment 13835 [details]
adjustment of the spec file

spec file used to build the linux-surface kernel

Attachment 13797 is obsolete: 0 => 1
Attachment 13698 is obsolete: 0 => 1
Attachment 13662 is obsolete: 0 => 1
Attachment 13659 is obsolete: 0 => 1
Attachment 13710 is obsolete: 0 => 1
Attachment 13799 is obsolete: 0 => 1
Attachment 13798 is obsolete: 0 => 1

Comment 49 christian barranco 2023-05-13 17:22:18 CEST
Created attachment 13836 [details]
conf file to adjust kernel with module to detect typecover keyboard
Comment 50 christian barranco 2023-05-13 17:22:48 CEST
Created attachment 13837 [details]
surface config file for 6.3
Comment 51 Giuseppe Ghibò 2023-05-13 18:29:04 CEST
(In reply to christian barranco from comment #47)
> Hi. Hurray!
> I solved it by, at least, setting:
> CONFIG_SERIAL_DEV_BUS=y
> CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
> 
> I have also added the full surface config and patches, from 
> https://github.com/linux-surface/linux-surface
> 
> What is the best way going forward to maintain this?
> Should I create a kernel-surface-latest package?
> Or, Thomas, can you introduce all these adjustments in kernel-desktop-latest?
> 
> Thanks!

Nice catch, However what differences from comment #40 where you already added such options but no effects, and in comment #30 where you said you have already tried the extra patchset?

Was just that you used SERIAL_DEV_CTRL_TTYPORT=y instead of CONFIG_SERIAL_DEV_CTRL_TTYPORT=y?
Comment 52 christian barranco 2023-05-13 18:46:09 CEST
(In reply to Giuseppe Ghibò from comment #51)
> 
> Nice catch, However what differences from comment #40 where you already
> added such options but no effects, and in comment #30 where you said you
> have already tried the extra patchset?
> 
> Was just that you used SERIAL_DEV_CTRL_TTYPORT=y instead of
> CONFIG_SERIAL_DEV_CTRL_TTYPORT=y?

I have noticed at some point that suface_hid was not in the config file https://bugs.mageia.org/show_bug.cgi?id=31444#c46

It might be the way I made the changes. Using scripts/kconfig/merge_config.sh seems the way to go, instead of changing manually the default config file; as I used to do.
I might have also missed a parameter from the surface config file, when I tried to add some.
By adding the full surface config file and a few more parameters in mga_config, and by merging them with the script, I have here a more robust build.

It is the only explanation I can come with.
Comment 53 Giuseppe Ghibò 2023-05-13 18:53:40 CEST
(In reply to christian barranco from comment #52)
> (In reply to Giuseppe Ghibò from comment #51)
> > 
> > Nice catch, However what differences from comment #40 where you already
> > added such options but no effects, and in comment #30 where you said you
> > have already tried the extra patchset?
> > 
> > Was just that you used SERIAL_DEV_CTRL_TTYPORT=y instead of
> > CONFIG_SERIAL_DEV_CTRL_TTYPORT=y?
> 
> I have noticed at some point that suface_hid was not in the config file
> https://bugs.mageia.org/show_bug.cgi?id=31444#c46
> 
> It might be the way I made the changes. Using
> scripts/kconfig/merge_config.sh seems the way to go, instead of changing
> manually the default config file; as I used to do.
> I might have also missed a parameter from the surface config file, when I
> tried to add some.
> By adding the full surface config file and a few more parameters in
> mga_config, and by merging them with the script, I have here a more robust
> build.
> 
> It is the only explanation I can come with.

But in the end you can narrow the changes and diff the two defconfig-x86_64-desktop files, those from current working kernel, and from current mga kernel, or to be more precise diffying the RESULTING config file, from current installed /boot/config-6.3.2-desktop-2.mga9 to your working one in the same place.
Comment 54 christian barranco 2023-05-13 19:01:04 CEST
The difference should be most of the parameters in the 2 files: mga_surface.config and surface-6.3.config

I understand what you are saying. It is just that, from a maintenance stand point, I find it easier to merge the whole surface.config file with our defconfig-x86_64-desktop; plus 3 parameters from mga_surface.config, if not added into defconfig-x86_64-desktop
Comment 55 christian barranco 2023-05-14 09:58:32 CEST
Created attachment 13838 [details]
.config differences between 6.3.2-surface and 6.3.2-mga_initial

Besides the linux-surface patches added, there are not so many differences on the .config files generated during the build.

I think that the main difference is:
+CONFIG_SERIAL_DEV_BUS=y
+CONFIG_SERIAL_DEV_CTRL_TTYPORT=y

However, I have not set anything for CONFIG_BT_HCIUART_BCM
but the merge process results in:
+# CONFIG_BT_HCIUART_BCM is not set
Comment 56 christian barranco 2023-05-14 10:03:03 CEST
Created attachment 13839 [details]
.config differences between 6.3.2-surface and 6.3.0-surface

Here is an attempt to understand why my first attempts with 6.3.0 has not worked.
As I explained, for some reason, surface_hid parameters disappear during the build...
The way I was changing the parameters with 6.3.0 was to patch directly defconfig-x86_64-desktop, instead of using the merge script.
The patch I was using was removing the surface_hid already there, and it was adding at the end of defconfig-x86_64-desktop (before rust hack) the whole surface configuration block (where surface_hid* were set).
Comment 57 Thomas Backlund 2023-05-14 17:50:03 CEST
Please try kernel-6.3.2-3.mga9 and report how that one works...
Comment 58 christian barranco 2023-05-27 20:45:10 CEST
Hi
The keyboard and touchpad work now with the latest kernel update.
However, I face incomplete shutdown.

What would be the issue to include all Linux-surface kernel patches with our kernel?

Thanks for your support
Comment 59 Ezequiel Partida 2023-10-21 22:41:53 CEST
(In reply to christian barranco from comment #0)
> Description of problem:
> Despite the kernel belongs to the 6.1 series, the keyboard and the touchpad
> are not active on my Surface Pro 9.
> Manjaro with kernel 6.1.1 detects them right away.
> Installing Linux Mint and updating to kernel 6.1.7 allows to detect them as
> well.
> 
> Version-Release number of selected component (if applicable):
> 
> 
> How reproducible: always
> 
> 
> Steps to Reproduce:
> 1. Install Mageia 9 beta on Surface Pro 9
> 
> Output of lspcidrake -v below. I had to plug a Logitech RF keyboard on a
> Dell D6000 dock to be able to interact with the laptop.
> ```
> intel_vsec      : Intel Corporation|Platform Monitoring Technology
> [SIGNAL_OTHER] (vendor:8086 device:467d subv:8086 subd:7270) (rev: 01)
> intel_lpss_pci  : Intel Corporation|Alder Lake PCH Serial IO I2C Controller
> #3 (vendor:8086 device:51eb subv:8086 subd:7270) (rev: 01)
> unknown         : Intel Corporation|Device 465d [MULTIMEDIA_OTHER]
> (vendor:8086 device:465d subv:8086 subd:7270) (rev: 04)
> xhci_pci        : Intel Corporation|Alder Lake PCH USB 3.2 xHCI Host
> Controller [SERIAL_USB] (vendor:8086 device:51ed subv:8086 subd:7270) (rev:
> 01)
> i915            : Intel Corporation|Alder Lake-UP3 GT2 [Iris Xe Graphics]
> [DISPLAY_VGA] (vendor:8086 device:46a8 subv:1414 subd:0063) (rev: 0c)
> unknown         : Intel Corporation|Device 51d0 [INPUT_PEN] (vendor:8086
> device:51d0 subv:1414 subd:0064) (rev: 01)
> unknown         : Intel Corporation|Alder Lake PCH Shared SRAM [MEMORY_RAM]
> (vendor:8086 device:51ef subv:8086 subd:7270) (rev: 01)
> unknown         : Intel Corporation|Alder Lake-P Thunderbolt 4 PCI Express
> Root Port #3 [BRIDGE_PCI] (vendor:8086 device:461f subv:0061 subd:0000)
> (rev: 04)
> unknown         : Intel Corporation|12th Gen Core Processor PCI Express x4
> Controller #0 [BRIDGE_PCI] (vendor:8086 device:464d) (rev: 04)
> intel_lpss_pci  : Intel Corporation|Alder Lake PCH Serial IO I2C Controller
> #0 (vendor:8086 device:51e8 subv:8086 subd:7270) (rev: 01)
> intel_lpss_pci  : Intel Corporation|Alder Lake PCH Serial IO I2C Controller
> #2 (vendor:8086 device:51ea subv:8086 subd:7270) (rev: 01)
> igen6_edac      : Intel Corporation|Device 4601 [BRIDGE_HOST] (vendor:8086
> device:4601 subv:8086 subd:7270) (rev: 04)
> snd_hda_intel   : Intel Corporation|Alder Lake PCH-P High Definition Audio
> Controller [MULTIMEDIA_AUDIO_DEV] (vendor:8086 device:51c8 subv:8086
> subd:7270) (rev: 01)
> intel_lpss_pci  : Intel Corporation|Alder Lake PCH UART #0
> [COMMUNICATION_OTHER] (vendor:8086 device:51a8 subv:8086 subd:7270) (rev: 01)
> thunderbolt     : Intel Corporation|Alder Lake-P Thunderbolt 4 NHI #1
> [SERIAL_USB] (vendor:8086 device:466d subv:8086 subd:7270) (rev: 04)
> spi_intel_pci   : Intel Corporation|Alder Lake-P PCH SPI Controller
> (vendor:8086 device:51a4 subv:8086 subd:7270) (rev: 01)
> unknown         : Intel Corporation|Alder Lake-P Thunderbolt 4 PCI Express
> Root Port #2 [BRIDGE_PCI] (vendor:8086 device:462f subv:0060 subd:0000)
> (rev: 04)
> mei_me          : Intel Corporation|Alder Lake PCH HECI Controller
> [COMMUNICATION_OTHER] (vendor:8086 device:51e0 subv:8086 subd:7270) (rev: 01)
> iwlwifi         : Intel Corporation|Alder Lake-P PCH CNVi WiFi
> [NETWORK_OTHER] (vendor:8086 device:51f0 subv:8086 subd:0094) (rev: 01)
> unknown         : Samsung Electronics Co Ltd|NVMe SSD Controller PM9B1
> (vendor:144d device:a80b) (rev: 02)
> intel_lpss_pci  : Intel Corporation|Alder Lake-P Serial IO I2C Controller #2
> (vendor:8086 device:51d8 subv:8086 subd:7270) (rev: 01)
> unknown         : Intel Corporation|Alder Lake PCH eSPI Controller
> [BRIDGE_ISA] (vendor:8086 device:5182 subv:8086 subd:7270) (rev: 01)
> xhci_pci        : Intel Corporation|Alder Lake-P Thunderbolt 4 USB
> Controller [SERIAL_USB] (vendor:8086 device:461e subv:8086 subd:7270) (rev:
> 04)
> unknown         : Intel Corporation|12th Gen Core Processor Gaussian &
> Neural Accelerator [SYSTEM_OTHER] (vendor:8086 device:464f subv:8086
> subd:7270) (rev: 04)
> hub             : Linux 6.1.7-desktop-1.mga9 xhci-hcd|xHCI Host Controller
> [Hub|Unused|Full speed (or root) hub] (vendor:1d6b device:0002)
> hub             : Linux 6.1.7-desktop-1.mga9 xhci-hcd|xHCI Host Controller
> [Hub|Unused|Full speed (or root) hub] (vendor:1d6b device:0003)
> hub             : GenesysLogic|USB3.1 Hub [Hub|Unused|Full speed (or root)
> hub] (vendor:05e3 device:0620)
> snd_usb_audio   : DisplayLink|Dell Universal Dock D6000 [Audio|Control
> Device] (vendor:17e9 device:6006)
> hub             : GenesysLogic|USB3.1 Hub [Hub|Unused|Full speed (or root)
> hub] (vendor:05e3 device:0620)
> hub             : Linux 6.1.7-desktop-1.mga9 xhci-hcd|xHCI Host Controller
> [Hub|Unused|Full speed (or root) hub] (vendor:1d6b device:0002)
> hub             : GenesysLogic|USB2.1 Hub [Hub|Unused|TT per port]
> (vendor:05e3 device:0610)
> hub             : GenesysLogic|USB2.1 Hub [Hub|Unused|TT per port]
> (vendor:05e3 device:0610)
> hub             : Genesys Logic, Inc.|USB2.0 Hub [Hub|Unused|Full speed (or
> root) hub] (vendor:05e3 device:0608)
> usbhid          : Bizlink|D6000 Controller [Human Interface Device|No
> Subclass|None] (vendor:06c4 device:c411)
> usbhid          : Logitech|USB Receiver [Human Interface Device|Boot
> Interface Subclass|Keyboard] (vendor:046d device:c52b)
> btusb           : Intel Corp.|Unknown [Wireless|Radio Frequency|Bluetooth]
> (vendor:8087 device:0033)
> hub             : Linux 6.1.7-desktop-1.mga9 xhci-hcd|xHCI Host Controller
> [Hub|Unused|Full speed (or root) hub] (vendor:1d6b device:0003)
> hid_generic     : Logitech USB Receiver
> hid_generic     : Logitech K400
> hid_generic     : Logitech USB Receiver
> hid_generic     : Logitech USB Receiver
> hid_generic     : Bizlink D6000 Controller
> ```

Hello Christian,

I see you also have the next device:

snd_usb_audio   : DisplayLink|Dell Universal Dock D6000 [Audio|Control Device] (vendor:17e9 device:6006)

Is that connected to you Surface?

I have around 40 of those devices at work.

I've been waiting for support for this for a long time.

https://bugs.mageia.org/show_bug.cgi?id=21554

Regards
ZekeMX

CC: (none) => ezequiel_partida

Comment 60 christian barranco 2023-10-21 22:47:53 CEST
Hi @ZekeMX

Yes, I used to have it connected to my Surface Pro 9 and it worked with 6.1, 6.2 and 6.3 kernels.
Since I have been able to build my own kernel for the Surface Pro 9, keyboard and touchpad work. So, I don't use the docking station anymore.
However, I assume it should still work with MGA9.

Have you tried recently?

Take care
Comment 61 Ezequiel Partida 2023-10-22 04:10:13 CEST
Hello Christian,

I tested it and it doesn't work since lib64evdi is needed as well as the displaylink driver.

I am porting the package from OMV but I need help from mageia devs to add evdi in kernel. I have an package request since 2 years ago but as continued on a older request so there will be no duplicates.
Comment 62 christian barranco 2024-04-15 22:18:36 CEST
Fixed with kernel-6.3.2-3.mga9

Status: NEW => RESOLVED
Resolution: (none) => FIXED