linux-surface / linux-surface

Linux Kernel for Surface Devices
4.68k stars 205 forks source link

SLS1 Gnome Settings not detecting touchscreen or stylus NixOS #1440

Open Ai-Elias opened 1 month ago

Ai-Elias commented 1 month ago

I can't seem to be able to get Gnome to recognize my Touchscreen or Stylus on NixOS despite having no issues on Debian. I'm wondering is there is something nix specific that I'm missing here, but I've done quite a bit of digging and the only discrepancy I'm seeing is that libwacom-surface correctly identifies one of the /dev/input/eventXX via the libwacom-list-local-devices command on Debian but says both are unsupported on NixOS. Maybe I'm failing to properly load a Kernel Module? The touchscreen itself works for gnome gestures and whatnot.

Environment

Hardware model: SLS1 & Slim Pen 2 Kernel version: Linux ibis 6.8.9 #1-NixOS SMP PREEMPT_DYNAMIC Thu May 2 14:35:35 UTC 2024 x86_64 GNU/Linux Distribution: NixOS 24.11 nixos-hardware modules: microsoft-surface-pro-intel <- This enables iptsd microsoft-surface-common

`dmesg` output + Nix Config attached as dmesg.txt as it was too long for github [dmesg.txt](https://github.com/linux-surface/linux-surface/files/15226999/dmesg.txt) ``` { config, inputs, lib, pkgs, modulesPath, ... }: { imports = [ inputs.hardware.nixosModules.microsoft-surface-pro-intel inputs.hardware.nixosModules.microsoft-surface-common inputs.home-manager.nixosModules.default ]; boot.initrd.availableKernelModules = [ "nvme" "sd_mod" "thunderbolt" "usb_storage" "xhci_pci" "sd_mod" #Surface Laptop Studio Specific "8250_dw" "intel_lpss" "intel_lpss_pci" "pinctrl_tigerlake" "surface_aggregator" "surface_aggregator_hub" "surface_aggregator_registry" "surface_hid" "surface_hid_core" ]; boot.initrd.kernelModules = [ "surface_aggregator_hub" ]; boot.kernelModules = [ "kvm-intel" ]; environment = { #Surface Touch Screen systemPackages = with pkgs; [ iptsd libwacom-surface ]; }; } ```
StollD commented 1 month ago

We don't support NixOS - nobody of us uses it and we don't maintain it's packages. Please report issues to them, as they are the only ones capable of fixing them.

That said, it looks like their libwacom-surface package isn't applying the patch for your device.

Ai-Elias commented 1 month ago

Understand, thanks for the info! Also understand that Nix is an odd one to support. Maybe, if it's not to complicated of a question, I may ask how these patches work? Specifically I'm interested in how these patches differ from the .Tablet files libwacom talks about putting in /etc/libwacom/ then running libwacom-update-db? I'm looking at this patch:

https://github.com/linux-surface/libwacom-surface/blob/v2.10.0-1/patches/v2/0016-data-Add-Microsoft-Surface-Laptop-Studio.patch

vs this .Tablet example: https://github.com/linux-surface/linux-surface/discussions/983

StollD commented 1 month ago

They aren't different. But we have to patch the libwacom source to support the virt bus: https://github.com/linux-surface/libwacom-surface/blob/v2.10.0-1/patches/v2/0001-Add-support-for-BUS_VIRTUAL.patch, so shipping it all as patches is easier.

As long as your libwacom has that patch applied, putting the files in /etc/libwacom will work too.

Ai-Elias commented 1 month ago

Awesome, thank you! I'll see about opening up a PR with nixpkgs to downstream the patches. Is there any documentation for the .Tablet files that you can point me to? I'd like to understand why some of the options differ in my above examples.

Ai-Elias commented 2 weeks ago

@StollD I've made a little progress on this, after downstreaming 2.10.0 the nixos repo, I am able to get libwacom-list-local-devices to identify the device. However gnome settings Wacom Tablet section still doesn't see the touchscreen. Would you happen to have any other troubleshooting advice for me?

libwacom-list-local-devices output if relevant. Seems to coincide with the output I was getting on Debian. Thanks in advance!

/dev/input/event20 is a tablet but not supported by libwacom
devices:
- name: 'Microsoft Surface Laptop Studio'
  bus: 'unknown'
  vid: '0x045e'
  pid: '0x0c1b'
  nodes: 
  - /dev/input/event23: 'IPTS Stylus'
  styli:
   - id: 0xffffe
     name: 'General Pen Eraser'
     type: 'general'
     axes: ['x', 'y' , 'tilt', 'distance', 'pressure']
     buttons: 2
     is_eraser: 'true'
     eraser_type: 'invert'
   - id: 0xfffff
     name: 'General Pen'
     type: 'general'
     axes: ['x', 'y' , 'tilt', 'distance', 'pressure']
     buttons: 2
     erasers: [0xffffe]
StollD commented 1 week ago

Do you mean that it sees the pen but not the touchscreen? Or that it sees nothing at all?

Ai-Elias commented 1 week ago

It doesn't see anything at all as far as I can tell.

image

StollD commented 1 week ago

Is it possible that gnome-settings pulls in the standard libwacom next to the patched one?

Ai-Elias commented 1 week ago

I'm not sure, I do have both in my nix store after garbage collection however if I do which libwacom-list-devices it is coming from libwacom-surface specifically. Is there any way for me to see which gnome depends on?