我有一台 2022 HP 14 英寸 Spectre x360,它可以翻转为平板电脑模式,并配有加速度计来切换屏幕方向。但是,当我在其上安装 Ubuntu 22.04 时,我发现将其切换为或退出平板电脑模式、切换屏幕方向或关闭或打开盖子都会切换飞行模式。
这似乎是 HP 笔记本电脑的一个相对常见的问题(尽管我之前的 Spectre 从未遇到过这个问题)。在第一个答案中找到了解决方法这个帖子,但不幸的是它似乎无法在我的系统上运行。
此修复依赖于将“关闭盖子”和“方向”操作的键码(分别为 e057 和 e058)设置为“KEY_UNKNOWN”键码(240)。我认为它不适用于我的系统是因为出于某种原因,我的新笔记本电脑或 Ubuntu 22.04 更改了关闭盖子和更改方向的操作 ID。我尝试使用 找出新的键码 xev
,但切换方向/平板电脑模式没有显示任何内容,而关闭盖子给出的输出我认为没有帮助(如下所示):
MappingNotify event, serial 37, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
FocusOut event, serial 37, synthetic NO, window 0x3400001,
mode NotifyGrab, detail NotifyAncestor
FocusIn event, serial 38, synthetic NO, window 0x3400001,
mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 38, synthetic NO, window 0x0,
keys: 4294967225 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
FocusOut event, serial 38, synthetic NO, window 0x3400001,
mode NotifyGrab, detail NotifyAncestor
FocusIn event, serial 38, synthetic NO, window 0x3400001,
mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 38, synthetic NO, window 0x0,
keys: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
FocusOut event, serial 38, synthetic NO, window 0x3400001,
mode NotifyGrab, detail NotifyAncestor
FocusIn event, serial 38, synthetic NO, window 0x3400001,
mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 38, synthetic NO, window 0x0,
keys: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
MappingNotify event, serial 38, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
KeyPress event, serial 38, synthetic NO, window 0x3400001,
root 0x7b9, subw 0x0, time 3122108, (1160,-364), root:(1209,776),
state 0x0, keycode 248 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x3400001,
root 0x7b9, subw 0x0, time 3122125, (1160,-364), root:(1209,776),
state 0x0, keycode 248 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
PropertyNotify event, serial 39, synthetic NO, window 0x3400001,
atom 0x1a4 (_GTK_EDGE_CONSTRAINTS), time 3122199, state PropertyNewValue
PropertyNotify event, serial 39, synthetic NO, window 0x3400001,
atom 0x1a4 (_GTK_EDGE_CONSTRAINTS), time 3122203, state PropertyNewValue
KeyPress event, serial 39, synthetic NO, window 0x3400001,
root 0x7b9, subw 0x0, time 3123167, (1160,-364), root:(1209,776),
state 0x0, keycode 248 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 39, synthetic NO, window 0x3400001,
root 0x7b9, subw 0x0, time 3123184, (1160,-364), root:(1209,776),
state 0x0, keycode 248 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
PropertyNotify event, serial 39, synthetic NO, window 0x3400001,
atom 0x1a4 (_GTK_EDGE_CONSTRAINTS), time 3123191, state PropertyNewValue
PropertyNotify event, serial 39, synthetic NO, window 0x3400001,
atom 0x1a4 (_GTK_EDGE_CONSTRAINTS), time 3123197, state PropertyNewValue
MappingNotify event, serial 39, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
FocusOut event, serial 39, synthetic NO, window 0x3400001,
mode NotifyGrab, detail NotifyAncestor
FocusIn event, serial 40, synthetic NO, window 0x3400001,
mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 40, synthetic NO, window 0x0,
keys: 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
FocusOut event, serial 40, synthetic NO, window 0x3400001,
mode NotifyNormal, detail NotifyNonlinear
PropertyNotify event, serial 40, synthetic NO, window 0x3400001,
atom 0x175 (_NET_WM_STATE), time 3151384, state PropertyNewValue
PropertyNotify event, serial 40, synthetic NO, window 0x3400001,
atom 0x1a4 (_GTK_EDGE_CONSTRAINTS), time 3151384, state PropertyNewValue
MappingNotify event, serial 40, synthetic NO, window 0x0,
request MappingKeyboard, first_keycode 8, count 248
我还查看了journalctl -f
,它在切换平板电脑模式、切换方向或打开/关闭盖子时提供以下输出:
Aug 27 10:48:57 puter gnome-shell[2029]: Window manager warning: Overwriting existing binding of keysym 32 with keysym 32 (keycode b).
Aug 27 10:48:57 puter gnome-shell[2029]: Window manager warning: Overwriting existing binding of keysym 31 with keysym 31 (keycode a).
Aug 27 10:48:57 puter gnome-shell[2029]: Window manager warning: Overwriting existing binding of keysym 33 with keysym 33 (keycode c).
Aug 27 10:48:57 puter gnome-shell[2029]: Window manager warning: Overwriting existing binding of keysym 34 with keysym 34 (keycode d).
Aug 27 10:48:57 puter gnome-shell[2029]: Window manager warning: Overwriting existing binding of keysym 35 with keysym 35 (keycode e).
Aug 27 10:48:57 puter gnome-shell[2029]: Window manager warning: Overwriting existing binding of keysym 36 with keysym 36 (keycode f).
Aug 27 10:48:57 puter gnome-shell[2029]: Window manager warning: Overwriting existing binding of keysym 37 with keysym 37 (keycode 10).
Aug 27 10:48:57 puter gnome-shell[2029]: Window manager warning: Overwriting existing binding of keysym 39 with keysym 39 (keycode 12).
Aug 27 10:48:57 puter gnome-shell[2029]: Window manager warning: Overwriting existing binding of keysym 38 with keysym 38 (keycode 11).
Aug 27 10:48:57 puter systemd[1]: Starting Load/Save RF Kill Switch Status...
Aug 27 10:48:57 puter NetworkManager[675]: <info> [1661618937.7480] manager: rfkill: Wi-Fi now enabled by radio killswitch
Aug 27 10:48:57 puter systemd[1]: Started Load/Save RF Kill Switch Status.
Aug 27 10:48:58 puter NetworkManager[675]: <info> [1661618938.0189] manager: rfkill: WWAN hardware radio set enabled
Aug 27 10:48:58 puter NetworkManager[675]: <info> [1661618938.0193] audit: op="radio-control" arg="wwan-enabled:on" pid=2237 uid=1000 result="success"
Aug 27 10:48:58 puter NetworkManager[675]: <info> [1661618938.0543] device (wlo1): supplicant interface state: internal-starting -> disconnected
Aug 27 10:48:58 puter NetworkManager[675]: <info> [1661618938.0544] device (p2p-dev-wlo1): state change: unavailable -> unmanaged (reason 'removed', sys-iface-state: 'removed')
Aug 27 10:48:58 puter NetworkManager[675]: <info> [1661618938.0549] Wi-Fi P2P device controlled by interface wlo1 created
Aug 27 10:48:58 puter NetworkManager[675]: <info> [1661618938.0552] manager: (p2p-dev-wlo1): new 802.11 Wi-Fi P2P device (/org/freedesktop/NetworkManager/Devices/7)
Aug 27 10:48:58 puter NetworkManager[675]: <info> [1661618938.0554] device (p2p-dev-wlo1): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Aug 27 10:48:58 puter NetworkManager[675]: <info> [1661618938.0558] device (wlo1): state change: unavailable -> disconnected (reason 'supplicant-available', sys-iface-state: 'managed')
Aug 27 10:48:58 puter NetworkManager[675]: <info> [1661618938.0563] device (p2p-dev-wlo1): state change: unavailable -> disconnected (reason 'none', sys-iface-state: 'managed')
Aug 27 10:48:58 puter gnome-shell[2029]: Removing a network device that was not added
Aug 27 10:49:01 puter wpa_supplicant[696]: wlo1: CTRL-EVENT-REGDOM-CHANGE init=DRIVER type=COUNTRY alpha2=US
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2389] policy: auto-activating connection 'hcdj' (4888999a-9a1c-4c66-9e1a-a833d092f6c0)
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2396] device (wlo1): Activation: starting connection 'hcdj' (4888999a-9a1c-4c66-9e1a-a833d092f6c0)
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2397] device (wlo1): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2401] manager: NetworkManager state is now CONNECTING
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2403] device (wlo1): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2407] device (wlo1): Activation: (wifi) access point 'hcdj' has security, but secrets are required.
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2408] device (wlo1): state change: config -> need-auth (reason 'none', sys-iface-state: 'managed')
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2425] device (wlo1): state change: need-auth -> prepare (reason 'none', sys-iface-state: 'managed')
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2428] device (wlo1): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2431] device (wlo1): Activation: (wifi) connection 'hcdj' has security, and secrets exist. No new secrets needed.
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2432] Config: added 'ssid' value 'hcdj'
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2432] Config: added 'scan_ssid' value '1'
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2432] Config: added 'bgscan' value 'simple:30:-70:86400'
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2433] Config: added 'key_mgmt' value 'WPA-PSK WPA-PSK-SHA256 FT-PSK SAE FT-SAE'
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2433] Config: added 'auth_alg' value 'OPEN'
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2433] Config: added 'psk' value '<hidden>'
Aug 27 10:49:01 puter wpa_supplicant[696]: wlo1: SME: Trying to authenticate with 58:24:29:94:95:3a (SSID='hcdj' freq=5745 MHz)
Aug 27 10:49:01 puter kernel: wlo1: authenticate with 58:24:29:94:95:3a
Aug 27 10:49:01 puter kernel: wlo1: send auth to 58:24:29:94:95:3a (try 1/3)
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2651] device (wlo1): supplicant interface state: disconnected -> authenticating
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.2652] device (p2p-dev-wlo1): supplicant management interface state: disconnected -> authenticating
Aug 27 10:49:01 puter wpa_supplicant[696]: wlo1: Trying to associate with 58:24:29:94:95:3a (SSID='hcdj' freq=5745 MHz)
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.3030] device (wlo1): supplicant interface state: authenticating -> associating
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.3031] device (p2p-dev-wlo1): supplicant management interface state: authenticating -> associating
Aug 27 10:49:01 puter kernel: wlo1: authenticated
Aug 27 10:49:01 puter kernel: wlo1: associate with 58:24:29:94:95:3a (try 1/3)
Aug 27 10:49:01 puter kernel: wlo1: RX AssocResp from 58:24:29:94:95:3a (capab=0x1011 status=0 aid=8)
Aug 27 10:49:01 puter wpa_supplicant[696]: wlo1: Associated with 58:24:29:94:95:3a
Aug 27 10:49:01 puter wpa_supplicant[696]: wlo1: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
Aug 27 10:49:01 puter kernel: wlo1: associated
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.3324] device (wlo1): supplicant interface state: associating -> 4way_handshake
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.3324] device (p2p-dev-wlo1): supplicant management interface state: associating -> 4way_handshake
Aug 27 10:49:01 puter wpa_supplicant[696]: wlo1: WPA: Key negotiation completed with 58:24:29:94:95:3a [PTK=CCMP GTK=CCMP]
Aug 27 10:49:01 puter wpa_supplicant[696]: wlo1: CTRL-EVENT-CONNECTED - Connection to 58:24:29:94:95:3a completed [id=0 id_str=]
Aug 27 10:49:01 puter kernel: IPv6: ADDRCONF(NETDEV_CHANGE): wlo1: link becomes ready
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.3791] device (wlo1): supplicant interface state: 4way_handshake -> completed
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.3792] device (wlo1): Activation: (wifi) Stage 2 of 5 (Device Configure) successful. Connected to wireless network "hcdj"
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.3793] device (p2p-dev-wlo1): supplicant management interface state: 4way_handshake -> completed
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.3795] device (wlo1): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.3803] dhcp4 (wlo1): activation: beginning transaction (timeout in 45 seconds)
Aug 27 10:49:01 puter avahi-daemon[669]: Joining mDNS multicast group on interface wlo1.IPv6 with address fe80::821d:62c4:9abf:42fa.
Aug 27 10:49:01 puter avahi-daemon[669]: New relevant interface wlo1.IPv6 for mDNS.
Aug 27 10:49:01 puter avahi-daemon[669]: Registering new address record for fe80::821d:62c4:9abf:42fa on wlo1.*.
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.4146] dhcp4 (wlo1): state changed new lease, address=192.168.86.82
Aug 27 10:49:01 puter kernel: wlo1: Limiting TX power to 30 (30 - 0) dBm as advertised by 58:24:29:94:95:3a
Aug 27 10:49:01 puter avahi-daemon[669]: Joining mDNS multicast group on interface wlo1.IPv4 with address 192.168.86.82.
Aug 27 10:49:01 puter avahi-daemon[669]: New relevant interface wlo1.IPv4 for mDNS.
Aug 27 10:49:01 puter avahi-daemon[669]: Registering new address record for 192.168.86.82 on wlo1.IPv4.
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.4191] device (wlo1): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Aug 27 10:49:01 puter dbus-daemon[673]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.10' (uid=0 pid=675 comm="/usr/sbin/NetworkManager --no-daemon " label="unconfined")
Aug 27 10:49:01 puter systemd[1]: Starting Network Manager Script Dispatcher Service...
Aug 27 10:49:01 puter dbus-daemon[673]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Aug 27 10:49:01 puter systemd[1]: Started Network Manager Script Dispatcher Service.
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.4349] device (wlo1): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.4351] device (wlo1): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.4354] manager: NetworkManager state is now CONNECTED_LOCAL
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.4367] manager: NetworkManager state is now CONNECTED_SITE
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.4368] policy: set 'hcdj' (wlo1) as default for IPv4 routing and DNS
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.4380] device (wlo1): Activation: successful, device activated.
Aug 27 10:49:01 puter systemd-resolved[607]: wlo1: Bus client set search domain list to: lan
Aug 27 10:49:01 puter systemd-resolved[607]: wlo1: Bus client set default route setting: yes
Aug 27 10:49:01 puter systemd-resolved[607]: wlo1: Bus client set DNS server list to: 192.168.86.1
Aug 27 10:49:01 puter wpa_supplicant[696]: wlo1: CTRL-EVENT-SIGNAL-CHANGE above=1 signal=-54 noise=9999 txrate=234000
Aug 27 10:49:01 puter NetworkManager[675]: <info> [1661618941.5717] manager: NetworkManager state is now CONNECTED_GLOBAL
Aug 27 10:49:02 puter systemd[1]: systemd-rfkill.service: Deactivated successfully.
Aug 27 10:49:06 puter NetworkManager[675]: <info> [1661618946.0826] manager: rfkill: Wi-Fi now disabled by radio killswitch
Aug 27 10:49:06 puter NetworkManager[675]: <info> [1661618946.0827] device (wlo1): state change: activated -> unavailable (reason 'none', sys-iface-state: 'managed')
Aug 27 10:49:06 puter systemd[1]: Starting Load/Save RF Kill Switch Status...
Aug 27 10:49:06 puter kernel: wlo1: deauthenticating from 58:24:29:94:95:3a by local choice (Reason: 3=DEAUTH_LEAVING)
Aug 27 10:49:06 puter NetworkManager[675]: <info> [1661618946.0829] dhcp4 (wlo1): canceled DHCP transaction
Aug 27 10:49:06 puter NetworkManager[675]: <info> [1661618946.0829] dhcp4 (wlo1): activation: beginning transaction (timeout in 45 seconds)
Aug 27 10:49:06 puter NetworkManager[675]: <info> [1661618946.0830] dhcp4 (wlo1): state changed no lease
Aug 27 10:49:06 puter systemd[1]: Started Load/Save RF Kill Switch Status.
Aug 27 10:49:06 puter wpa_supplicant[696]: wlo1: CTRL-EVENT-DISCONNECTED bssid=58:24:29:94:95:3a reason=3 locally_generated=1
Aug 27 10:49:06 puter wpa_supplicant[696]: BSSID 58:24:29:94:95:3a ignore list count incremented to 2, ignoring for 10 seconds
Aug 27 10:49:06 puter avahi-daemon[669]: Interface wlo1.IPv6 no longer relevant for mDNS.
Aug 27 10:49:06 puter avahi-daemon[669]: Leaving mDNS multicast group on interface wlo1.IPv6 with address fe80::821d:62c4:9abf:42fa.
Aug 27 10:49:06 puter avahi-daemon[669]: Interface wlo1.IPv4 no longer relevant for mDNS.
Aug 27 10:49:06 puter avahi-daemon[669]: Leaving mDNS multicast group on interface wlo1.IPv4 with address 192.168.86.82.
Aug 27 10:49:06 puter avahi-daemon[669]: Withdrawing address record for fe80::821d:62c4:9abf:42fa on wlo1.
Aug 27 10:49:06 puter avahi-daemon[669]: Withdrawing address record for 192.168.86.82 on wlo1.
Aug 27 10:49:06 puter wpa_supplicant[696]: rfkill: WLAN soft blocked
Aug 27 10:49:06 puter wpa_supplicant[696]: rfkill: WLAN soft blocked
Aug 27 10:49:06 puter systemd-resolved[607]: wlo1: Bus client reset search domain list.
Aug 27 10:49:06 puter systemd-resolved[607]: wlo1: Bus client set default route setting: no
Aug 27 10:49:06 puter systemd-resolved[607]: wlo1: Bus client reset DNS server list.
Aug 27 10:49:06 puter NetworkManager[675]: <info> [1661618946.1568] manager: NetworkManager state is now DISCONNECTED
Aug 27 10:49:06 puter wpa_supplicant[696]: p2p-dev-wlo1: CTRL-EVENT-DSCP-POLICY clear_all
Aug 27 10:49:06 puter wpa_supplicant[696]: p2p-dev-wlo1: CTRL-EVENT-DSCP-POLICY clear_all
Aug 27 10:49:06 puter wpa_supplicant[696]: nl80211: deinit ifname=p2p-dev-wlo1 disabled_11b_rates=0
Aug 27 10:49:06 puter wpa_supplicant[696]: wlo1: CTRL-EVENT-DSCP-POLICY clear_all
Aug 27 10:49:06 puter NetworkManager[675]: <info> [1661618946.2158] device (p2p-dev-wlo1): state change: disconnected -> unavailable (reason 'supplicant-failed', sys-iface-state: 'managed')
Aug 27 10:49:06 puter NetworkManager[675]: <info> [1661618946.2379] manager: rfkill: WWAN hardware radio set disabled
Aug 27 10:49:06 puter NetworkManager[675]: <info> [1661618946.2380] audit: op="radio-control" arg="wwan-enabled:off" pid=2237 uid=1000 result="success"
Aug 27 10:49:06 puter wpa_supplicant[696]: wlo1: CTRL-EVENT-DSCP-POLICY clear_all
Aug 27 10:49:06 puter wpa_supplicant[696]: nl80211: deinit ifname=wlo1 disabled_11b_rates=0
Aug 27 10:49:08 puter google-chrome.desktop[2759]: [2753:2782:0827/104908.122472:ERROR:connection_factory_impl.cc(425)] Failed to connect to MCS endpoint with error -106
Aug 27 10:49:11 puter systemd[1]: systemd-rfkill.service: Deactivated successfully.
Aug 27 10:49:16 puter systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.
它以几个密钥 ID 开始,但更改其中任何一个都无法解决问题。
所以我想我的问题是,为了在更换笔记本电脑屏幕时防止进入飞行模式,最好的方法是什么,找出哪些按键 ID 应该设置为 240。
答案1
我遇到了同样的问题,即飞行模式会被激活和停用(至少在移动盖子时)。
- 设备:HP HP Spectre x360 二合一笔记本 14-ef2xxx
- 配有德语键盘
- Ubuntu 22.04 LTS
将扫描码 e057 和 e058 映射到键码 240 没有帮助。使用
sudo showkey
移动盖子表明,如果盖子在向前或向后方向上越过某些角度,即相对于桌子(或膝盖:D)大约 45 度,则按下并释放键 247(我的机器上的飞行模式)。
然而,重复同样的过程
sudo showkey -s
显示没有激活任何扫描码。因此,仅通过使用 将某些扫描码映射到某些键码可能无法解决这个问题setkeycodes
。
我在 [1] 的帮助下修复了这个问题,它与 [2] 类似。按照后者的一对一方法对我不起作用。显然,我需要一台与作者不同的设备才能受到按键映射的影响。
我花了很长时间寻找答案,反复试验,并被专家级的帖子弄糊涂了。至少我学到了一些东西。为了避免你和其他人遭受这些困扰,我尝试让这个分步解决方案尽可能适合新手。
查找负责的设备
通过 Ctrl + Alt + T 打开终端。
输入(然后按 Enter)
cat /proc/bus/input/devices
获取设备列表。名为“Intel HID events”的设备
I: Bus=0019 Vendor=0000 Product=0000 Version=0000
N: Name="Intel HID events"
P: Phys=
S: Sysfs=/devices/platform/INTC1070:00/input/input35
U: Uniq=
H: Handlers=rfkill kbd event17
B: PROP=0
B: EV=13
B: KEY=1000300000000 5000004000 1e294000000020 0
B: MSC=10
可能是负责任的,因为它有 rfkill(停用所有无线电,即 wlan、蓝牙等)作为处理程序。我将其称为设备从这里开始。
获取密钥代码
在测试设备并获取密钥代码之前,请安装 evtest。输入(然后输入)
sudo apt install -y evtest
如果出现提示,请输入您的密码。要测试设备是否负责并获取密钥代码,请打开虚拟终端(在普通终端 X 中,基本上是您的 Ubuntu GUI,可能会使此测试无法进行)。通常通过 Ctrl + Alt + F1 完成此操作,但就我而言,F1 必须替换为 F3。要返回 X,请按 Ctrl + Alt + F2(就我而言)。在其他机器上,它通常似乎是 F7。我通过反复试验找到了适合我的正确键。
提供您的用户名和密码。输入(然后按 Enter)
sudo evtest /dev/input/event17
在我的情况下是 event17,因为它位于设备的 Handler 字段中,见上文。我注意到,如果我将鼠标和键盘连接到笔记本电脑,该数字会发生变化。因此,在您的情况下,它可能是一个不同的数字。
接下来,关闭并打开盖子。通过 Ctrl + C 退出 evtest 的测试模式,并通过 Ctrl + Alt + F2 退出虚拟终端(在我的情况下)。在我的屏幕上,这是在 evtest 期间打印的:
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "Intel HID events"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 69 (KEY_NUMLOCK)
Event code 102 (KEY_HOME)
Event code 104 (KEY_PAGEUP)
Event code 107 (KEY_END)
Event code 109 (KEY_PAGEDOWN)
Event code 113 (KEY_MUTE)
Event code 114 (KEY_VOLUMEDOWN)
Event code 115 (KEY_VOLUMEUP)
Event code 116 (KEY_POWER)
Event code 142 (KEY_SLEEP)
Event code 164 (KEY_PLAYPAUSE)
Event code 166 (KEY_STOPCD)
Event code 224 (KEY_BRIGHTNESSDOWN)
Event code 225 (KEY_BRIGHTNESSUP)
Event code 240 (KEY_UNKNOWN)
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1684340717.813043, type 4 (EV_MSC), code 4 (MSC_SCAN), value 08
Event: time 1684340717.813043, type 1 (EV_KEY), code 247 (KEY_RFKILL), value 1
Event: time 1684340717.813043, -------------- SYN_REPORT ------------
Event: time 1684340717.813055, type 1 (EV_KEY), code 247 (KEY_RFKILL), value 0
Event: time 1684340717.813055, -------------- SYN_REPORT ------------
Event: time 1684340721.308956, type 4 (EV_MSC), code 4 (MSC_SCAN), value 08
Event: time 1684340721.308956, type 1 (EV_KEY), code 247 (KEY_RFKILL), value 1
Event: time 1684340721.308956, -------------- SYN_REPORT ------------
Event: time 1684340721.308963, type 1 (EV_KEY), code 247 (KEY_RFKILL), value 0
Event: time 1684340721.308963, -------------- SYN_REPORT ------------
如果你希望将其打印到文件中,比如主目录中的 evtest_output.txt ~
,请输入
sudo evtest /dev/input/event17 > ~/evtest_output.txt
而不是上面的步骤。请注意,在测试期间,您不会在屏幕上看到打印的输出。
让我们检查一下 evtest_output.txt 的内容。首先,它告诉我们一些设备规格和支持的事件。下面Testing...
有十个事件是在盖子移动期间打印的。前五个事件属于关闭,后五个事件属于打开盖子。请注意,我没有完全关闭它。我倾斜大约 45 度就足以触发飞行模式。这证实了设备“Intel HID 事件”是负责的。
使用 hwdb 修复
为了使用 hwdb 修复此问题,我通过在终端中输入以下内容创建了文件 intel-HID-events.hwdb(然后按 Enter)
sudo nano /etc/udev/hwdb.d/intel-HID-events.hwdb
我输入的内容是(就我而言)
evdev:input:b0019v0000p0000e0000-*
KEYBOARD_KEY_08=unknown
第一行中的数字是设备的总线 (0019)、供应商 (0000)、产品 (0000) 和版本 (0000) 字段(参见cat /proc/us/input/devices
上面的提示输出)。后面的星号*
是任意数量的符号的占位符。但是,我没有进一步指定,就像 [1] 中所做的那样。我的原因是,当我(断开)连接其他硬件(例如我的鼠标)时,设备的模式别名似乎会发生变化。
注意第二行的缩进,键08,也就是evtest中关闭或者打开时第一个事件的值(MSC_SCAN之后),被设置为unknown。
使用 Ctrl + O、Enter 保存,然后使用 Ctrl + X 关闭。然后通过以下方式更新
sudo systemd-hwdb update
sudo udevadm trigger
这来自[2]。
移动盖子。它应该不会再触发飞行模式。我不必像 [2] 中那样将这些更改“永久”化。重启后问题仍然得到解决。让我们看看下一次更新是否会解除这个问题……
我希望这对你或者任何人有帮助!
干杯 jk
参考
[1]https://yulistic.gitlab.io/2017/12/linux-keymapping-with-udev-hwdb/