Contexto:
Devido à falta de drivers para o meu conversível 2-em-1, dobrar a parte traseira da tela apenas aciona um evento de troca de tampa. Isso faz com que o laptop seja suspenso ou, quando "Suspender quando a tampa do laptop está fechada" estiver desabilitado no Gnome, ainda faz com que todos os dispositivos de entrada sejam desabilitados (inclusive a tela sensível ao toque, que inutiliza o modo de tablet).
Como solução alternativa, gostaria de manipular o switch para o modo tablet manualmente. Isso requer a inibição de todos os eventos de troca de tampa.
Pergunta:
Como posso inibir completamente os eventos de troca de tampa no Linux?
Alternativamente, encontrar uma maneira de listar / desabilitar os processos respondendo ao switch lidaria com o problema.
Atualmente, dobrar a tela no modo tablet e voltar registra os seguintes eventos:
Jul 25 23:58:54 jl-xps systemd-logind[816]: Lid closed.
Jul 25 23:58:58 jl-xps systemd-logind[816]: Lid opened.
O evento de troca de tampa é mapeado para /dev/input/event0
. /proc/bus/input/devices
listas (truncadas):
I: Bus=0019 Vendor=0000 Product=0005 Version=0000
N: Name="Lid Switch"
P: Phys=PNP0C0D/button/input0
S: Sysfs=/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0
U: Uniq=
H: Handlers=event0
B: PROP=0
B: EV=21
B: SW=1
Tentativas:
Método 1 : systemd-inhibit
, retirado de
# systemd-inhibit --what=handle-lid-switch sleep 1m
e, em seguida, inverta o ecrã antes do fim do temporizador. Eventos de troca de tampa ainda são registrados por systemd-logind
, e posso ver que /dev/input/event0
está sendo gravado (e outros dispositivos de entrada ainda estão desativados).
Método 2 : ACPI
$ echo "LID0" | sudo tee /proc/acpi/wakeup
e verifique se está realmente desativado:
LID0 S3 *disabled platform:PNP0C0D:00
com o mesmo systemd-logind
log e /dev/input/event0
ainda sendo gravados em.
Método 3 : força bruta
# mv /dev/input/event0 /dev/input/event0-off
# ln -s /dev/null /dev/input/event0
Os eventos de troca de tampa ainda são registrados por systemd-logind
. Então, parece que /dev/input/event0
é apenas informativo.
Informações do sistema:
$ inxi -Fxmz
System: Host: jl-xps Kernel: 4.18.0-0.rc5.git4.1.fc29.x86_64 x86_64 bits: 64 compiler: gcc v: 8.1.1
Desktop: Gnome 3.28.3 Distro: Fedora release 28 (Twenty Eight)
Machine: Type: Laptop System: Dell product: XPS 15 9575 v: N/A serial: <filter>
Mobo: Dell model: 0C32VW v: A00 serial: <filter> UEFI: Dell v: 1.1.5 date: 05/30/2018
Battery: ID-1: BAT0 charge: 72.3 Wh condition: 72.3/75.0 Wh (96%) model: BYD DELL TMFYT84 status: Full
Memory: RAM Report: permissions: Unable to run dmidecode. Are you root?
CPU: Topology: Quad Core model: Intel Core i7-8705G bits: 64 type: MT MCP arch: Skylake rev: 9
L2 cache: 8192 KiB
flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 49536
Speed: 900 MHz min/max: 800/4100 MHz Core speeds (MHz): 1: 900 2: 900 3: 900 4: 900 5: 900 6: 900
7: 900 8: 900
Graphics: Card-1: Intel driver: i915 v: kernel bus ID: 00:02.0
Card-2: Advanced Micro Devices [AMD/ATI] Polaris 22 [Radeon RX Vega M GL] driver: amdgpu v: kernel
bus ID: 01:00.0
Display: wayland server: Fedora Project X.org 11.0 driver: amdgpu resolution: 3840x2160~60Hz
OpenGL: renderer: Mesa DRI Intel HD Graphics 630 (Kaby Lake GT2) v: 4.5 Mesa 18.1.4
direct render: Yes
Audio: Card-1: Intel CM238 HD Audio driver: snd_hda_intel v: kernel bus ID: 00:1f.3
Card-2: N/A type: USB driver: snd-usb-audio bus ID: 3:2
Sound Server: ALSA v: k4.18.0-0.rc5.git4.1.fc29.x86_64
Network: Card-1: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter driver: ath10k_pci v: kernel
bus ID: 02:00.0
IF: wlp2s0 state: up mac: <filter>
Card-2: Intel I210 Gigabit Network Connection driver: igb v: 5.4.0-k port: 2000 bus ID: 40:00.0
IF: enp64s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
Card-3: Realtek RTL8153 Gigabit Ethernet Adapter type: USB driver: r8152 bus ID: 10:3
IF: enp65s0u2u2 state: down mac: <filter>
IF-ID-1: tap0 state: unknown speed: 10 Mbps duplex: full mac: <filter>
IF-ID-2: virbr0 state: up speed: N/A duplex: N/A mac: <filter>
IF-ID-3: virbr0-nic state: down mac: <filter>
Drives: HDD Total Size: 232.89 GiB used: 77.91 GiB (33.5%)
ID-1: /dev/sda type: USB vendor: Samsung model: Portable SSD T3 size: 232.89 GiB
RAID: Hardware-1: Intel 82801 Mobile SATA Controller [RAID mode] driver: ahci v: 3.0 bus ID: 00:17.0
Partition: ID-1: / size: 114.35 GiB used: 77.69 GiB (67.9%) fs: ext4 dev: /dev/sda3
ID-2: /boot size: 975.9 MiB used: 202.9 MiB (20.8%) fs: ext4 dev: /dev/sda2
ID-3: swap-1 size: 16.00 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/sda4
Sensors: System Temperatures: cpu: 50.0 C mobo: 37.0 C gpu: amdgpu temp: 49 C
Fan Speeds (RPM): cpu: 0
Info: Processes: 381 Uptime: 3h 01m Memory: 15.36 GiB used: 7.66 GiB (49.9%) Init: systemd runlevel: 5
Compilers: gcc: 8.1.1 Shell: fish v: 2.7.1 inxi: 3.0.14
$ xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ xwayland-pointer:15 id=6 [slave pointer (2)]
⎜ ↳ xwayland-relative-pointer:15 id=7 [slave pointer (2)]
⎜ ↳ xwayland-touch:15 id=9 [slave pointer (2)]
⎜ ↳ xwayland-stylus:15 id=10 [slave pointer (2)]
⎜ ↳ xwayland-eraser:15 id=11 [slave pointer (2)]
⎜ ↳ xwayland-cursor:15 id=12 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ xwayland-keyboard:15 id=8 [slave keyboard (3)]
Abaixo está a saída de sudo libinput debug-events
ao mudar para o modo tablet e de volta para o modo laptop (com o dispositivo de comutação da tampa desativado):
-event3 DEVICE_ADDED Power Button seat0 default group1 cap:k
-event5 DEVICE_ADDED Video Bus seat0 default group2 cap:k
-event1 DEVICE_ADDED Power Button seat0 default group3 cap:k
-event2 DEVICE_ADDED Sleep Button seat0 default group4 cap:k
-event9 DEVICE_ADDED Integrated_Webcam_HD: Integrate seat0 default group5 cap:k
-event10 DEVICE_ADDED Integrated_Webcam_HD: Integrate seat0 default group5 cap:k
-event13 DEVICE_ADDED Wacom HID 486A Pen seat0 default group6 cap:T size 344x194mm calib
-event14 DEVICE_ADDED Wacom HID 486A Finger seat0 default group6 cap:t size 344x194mm ntouches 10 calib
-event12 DEVICE_ADDED DELL080D:00 06CB:7A13 Touchpad seat0 default group7 cap:pg size 102x77mm tap(dl off) left scroll-nat scroll-2fg-edge click-buttonareas-clickfinger dwt-on
-event15 DEVICE_ADDED CalDigit, Inc. CalDigit Thunderbolt 3 Audio seat0 default group8 cap:k
-event16 DEVICE_ADDED Razer Razer Imperator seat0 default group9 cap:p left scroll-nat scroll-button
-event23 DEVICE_ADDED Razer Razer Imperator Keyboard seat0 default group9 cap:k
-event24 DEVICE_ADDED Razer Razer Imperator Consumer Control seat0 default group9 cap:kp scroll-nat
-event25 DEVICE_ADDED Razer Razer Imperator System Control seat0 default group9 cap:k
-event26 DEVICE_ADDED TypeMatrix.com USB Keyboard seat0 default group10 cap:k
-event27 DEVICE_ADDED TypeMatrix.com USB Keyboard System Control seat0 default group10 cap:k
-event28 DEVICE_ADDED TypeMatrix.com USB Keyboard Consumer Control seat0 default group10 cap:kp scroll-nat
-event8 DEVICE_ADDED Intel Virtual Button driver seat0 default group11 cap:kS
-event17 DEVICE_ADDED HDA Intel PCH Headphone Mic seat0 default group12 cap:
-event18 DEVICE_ADDED HDA Intel PCH HDMI/DP,pcm=3 seat0 default group12 cap:
-event19 DEVICE_ADDED HDA Intel PCH HDMI/DP,pcm=7 seat0 default group12 cap:
-event20 DEVICE_ADDED HDA Intel PCH HDMI/DP,pcm=8 seat0 default group12 cap:
-event21 DEVICE_ADDED HDA Intel PCH HDMI/DP,pcm=9 seat0 default group12 cap:
-event22 DEVICE_ADDED HDA Intel PCH HDMI/DP,pcm=10 seat0 default group12 cap:
-event6 DEVICE_ADDED Intel HID events seat0 default group13 cap:k
-event7 DEVICE_ADDED Intel HID 5 button array seat0 default group14 cap:k
-event11 DEVICE_ADDED Dell WMI hotkeys seat0 default group15 cap:k
-event4 DEVICE_ADDED AT Translated Set 2 keyboard seat0 default group16 cap:k
-event8 SWITCH_TOGGLE +3.90s switch tablet-mode state 1
event8 SWITCH_TOGGLE +5.44s switch tablet-mode state 0
Mais detalhes sobre este "Intel Virtual Button driver", que parece ser responsável pela mudança para tablet-mode
:
I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="Intel Virtual Button driver"
P: Phys=
S: Sysfs=/devices/pci0000:00/0000:00:1f.0/PNP0C09:00/INT33D6:00/input/input8
U: Uniq=
H: Handlers=kbd event8
B: PROP=0
B: EV=33
B: KEY=2000000000000 0 0 0 0 1000000000000 0 201c000000000000 0
B: MSC=10
B: SW=2
$ find /sys/bus/ -name 'PNP0C09:00'
/sys/bus/platform/devices/PNP0C09:00
/sys/bus/acpi/devices/PNP0C09:00
/sys/bus/acpi/drivers/ec/PNP0C09:00
$ find /sys/devices/ -name 'PNP0C09:00'
/sys/devices/pci0000:00/0000:00:1f.0/PNP0C09:00
/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:11/PNP0C09:00
$ udevadm info /sys/class/input/event8
P: /devices/pci0000:00/0000:00:1f.0/PNP0C09:00/INT33D6:00/input/input8/event8
N: input/event8
S: input/by-path/pci-0000:00:1f.0-platform-INT33D6:00-event
E: DEVLINKS=/dev/input/by-path/pci-0000:00:1f.0-platform-INT33D6:00-event
E: DEVNAME=/dev/input/event8
E: DEVPATH=/devices/pci0000:00/0000:00:1f.0/PNP0C09:00/INT33D6:00/input/input8/event8
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_SWITCH=1
E: ID_PATH=pci-0000:00:1f.0-platform-INT33D6:00
E: ID_PATH_TAG=pci-0000_00_1f_0-platform-INT33D6_00
E: MAJOR=13
E: MINOR=72
E: SUBSYSTEM=input
E: TAGS=:power-switch:
E: USEC_INITIALIZED=5811208