Skip to content

blhoward2/yogabook_patches

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Steps Necessary for Linux Support of Lenovo YogaBook 9i Gen X (2025 model)

Most things work out of the box without issue, with a recent enough kernel and proper configuration.

Bootloader

Use rEFInd Boot Manager to allow for touch at the bootloader stage.

Kernel Command Lines

You need to use the following kernel command-line arguments when booting:

mem_sleep_default=deep
i915.force_probe=!7d51
xe.force_probe=7d51
video=eDP-1:panel_orientation=upside_down
xe.enable_dpcd_backlight=2

NixOS

With some scripting it is possible to create new entries when systemd-boot adds generations, or you can manually update rEFInd each time.

An example of how I do this is in rEFInd_example

Sound

A patch has been upstreamed to the kernel fixing how the amplifier is wired up. This patch was mainlined as part of 6.15. Distributions may have backported it to earlier stable kernels.

TODO: Currently, the sound channels are blended and GUI volume sliders do not work. Use alsamixer to set the Master, Speaker, and Bass Speaker channels to the same level.

Reference: Kernel Bugzilla

Input Devices

A few things need to be done to make the touch and input devices work correctly. This is still a work in progress but at least support at the kernel-level has been figured out.

Initially, multiple devices were combined into a single eventx device, and gnome/kde grouped the devices together resulting in the settings for one device overwriting the others.

Reference: Kernel Bugzilla

1. Apply Kernel Patch

Until upstreamed, you must manually apply the kernel patch to add the appropriate quirks to the device.

This is very distribution specific and I will not support this step.

2. Apply udev rules

You must apply udev rules to:

  • Ensure that libinput groups the devices by the physical screen instead of all as one device
  • Supply a CUSTOM_ID that allows the devices to be differentiated in window managers
  • Apply a matrix to the top touch and tablet

NixOS

{ pkgs, ... }:

{
  services.udev.extraRules = ''     
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Touchscreen Top", ENV{LIBINPUT_DEVICE_GROUP}="group_top", ENV{CUSTOM_ID}="touch_top", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1 0 0 1"
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Stylus Top", ENV{LIBINPUT_DEVICE_GROUP}="group_top", ENV{CUSTOM_ID}="tablet_top", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1 0 0 1"
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Touchscreen Bottom", ENV{LIBINPUT_DEVICE_GROUP}="group_bottom", ENV{CUSTOM_ID}="touch_bottom"
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Stylus Bottom", ENV{LIBINPUT_DEVICE_GROUP}="group_bottom", ENV{CUSTOM_ID}="tablet_bottom"
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Keyboard", ENV{LIBINPUT_IGNORE_DEVICE}="1"
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Emulated Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1"
  '';
}
sudo nixos-rebuild switch

Others

    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Touchscreen Top", ENV{LIBINPUT_DEVICE_GROUP}="group_top", ENV{CUSTOM_ID}="touch_top", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1 0 0 1"
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Stylus Top", ENV{LIBINPUT_DEVICE_GROUP}="group_top", ENV{CUSTOM_ID}="tablet_top", ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1 0 -1 1 0 0 1"
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Touchscreen Bottom", ENV{LIBINPUT_DEVICE_GROUP}="group_bottom", ENV{CUSTOM_ID}="touch_bottom"
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Stylus Bottom", ENV{LIBINPUT_DEVICE_GROUP}="group_bottom", ENV{CUSTOM_ID}="tablet_bottom"
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Keyboard", ENV{LIBINPUT_IGNORE_DEVICE}="1"
    ACTION=="add", SUBSYSTEM=="input", ATTRS{name}=="INGENIC Gadget Serial and keyboard Emulated Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1"

Then reboot

Testing

Running sudo libinput list-devices should now return:

Note: You should have separate eventx devices for each input. Here:

  • event9 = top touch
  • event10 = bottom touch
  • event 11 = top stylus
  • event 12 = bottom stylus

Note: Each screen's touch/stylus should be in the same group as reported by libinput.


Device:                  INGENIC Gadget Serial and keyboard Touchscreen Top
Kernel:                  /dev/input/event9
Id:                      usb:17ef:6161
Group:                   6
Seat:                    seat0, default
Size:                    302x189mm
Capabilities:            touch 
Tap-to-click:            n/a
Tap-and-drag:            n/a
Tap button map:          n/a
Tap drag lock:           n/a
Left-handed:             n/a
Nat.scrolling:           n/a
Middle emulation:        n/a
Calibration:             identity matrix
Scroll methods:          none
Scroll button:           n/a
Scroll button lock:      n/a
Click methods:           none
Clickfinger button map:  n/a
Disable-w-typing:        n/a
Disable-w-trackpointing: n/a
Accel profiles:          n/a
Rotation:                0.0
Area rectangle:          n/a

Device:                  INGENIC Gadget Serial and keyboard Touchscreen Bottom
Kernel:                  /dev/input/event10
Id:                      usb:17ef:6161
Group:                   7
Seat:                    seat0, default
Size:                    302x189mm
Capabilities:            touch 
Tap-to-click:            n/a
Tap-and-drag:            n/a
Tap button map:          n/a
Tap drag lock:           n/a
Left-handed:             n/a
Nat.scrolling:           n/a
Middle emulation:        n/a
Calibration:             identity matrix
Scroll methods:          none
Scroll button:           n/a
Scroll button lock:      n/a
Click methods:           none
Clickfinger button map:  n/a
Disable-w-typing:        n/a
Disable-w-trackpointing: n/a
Accel profiles:          n/a
Rotation:                0.0
Area rectangle:          n/a

Device:                  INGENIC Gadget Serial and keyboard Stylus Up
Kernel:                  /dev/input/event11
Id:                      usb:17ef:6161
Group:                   6
Seat:                    seat0, default
Size:                    302x189mm
Capabilities:            tablet 
Tap-to-click:            n/a
Tap-and-drag:            n/a
Tap button map:          n/a
Tap drag lock:           n/a
Left-handed:             n/a
Nat.scrolling:           n/a
Middle emulation:        n/a
Calibration:             identity matrix
Scroll methods:          none
Scroll button:           n/a
Scroll button lock:      n/a
Click methods:           none
Clickfinger button map:  n/a
Disable-w-typing:        n/a
Disable-w-trackpointing: n/a
Accel profiles:          none
Rotation:                n/a
Area rectangle:          n/a

Device:                  INGENIC Gadget Serial and keyboard Stylus Bottom
Kernel:                  /dev/input/event12
Id:                      usb:17ef:6161
Group:                   7
Seat:                    seat0, default
Size:                    302x189mm
Capabilities:            tablet 
Tap-to-click:            n/a
Tap-and-drag:            n/a
Tap button map:          n/a
Tap drag lock:           n/a
Left-handed:             n/a
Nat.scrolling:           n/a
Middle emulation:        n/a
Calibration:             identity matrix
Scroll methods:          none
Scroll button:           n/a
Scroll button lock:      n/a
Click methods:           none
Clickfinger button map:  n/a
Disable-w-typing:        n/a
Disable-w-trackpointing: n/a
Accel profiles:          none
Rotation:                n/a
Area rectangle:          n/a

3. (Option 1) Patch Gnome

Both touch and stylus are now fully functional under gnome, once patches are applied. You must patch:

After restarting you must then tell gnome which screens are targeted by which touch/tablet.

In Control Center -> Graphics Tablets, change the first Ingenic Touch/Pen display to Map to Monitor to eDP-1, and the second to Map to Monitor to eDP-2. Disable Keep Aspect Ratio for each.

Then, for the touchscreens, in a terminal execute the following to retrieve the correct mappings from the tablets:

gsettings get org.gnome.desktop.peripherals.tablet:/org/gnome/desktop/peripherals/tablets/tablet_top/ output

gsettings get org.gnome.desktop.peripherals.tablet:/org/gnome/desktop/peripherals/tablets/tablet_bottom/ output

Those should output something like:

['BOE', 'NB140B9M-A62', '0x00000000', 'eDP-1']

['BOE', 'NB140B9M-A63', '0x00000000', 'eDP-2']

Then in a terminal:

gsettings set org.gnome.desktop.peripherals.touchscreen:/org/gnome/desktop/peripherals/touchscreens/touch_top/ output "['BOE', 'NB140B9M-A62', '0x00000000', 'eDP-1']"

gsettings set org.gnome.desktop.peripherals.touchscreen:/org/gnome/desktop/peripherals/touchscreens/touch_bottom/ output "['BOE', 'NB140B9M-A63', '0x00000000', 'eDP-2']"

3. (Option 2) Patch KDE

To come

Testing: AI Generated Summary - Do Not Use

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages