Path: csiph.com!fu-berlin.de!bofh.it!news.nic.it!robomod From: Haakon McKay Newsgroups: linux.debian.bugs.dist,linux.debian.kernel Subject: Bug#1056904: linux-image-amd64: Module hp_wmi is missing from the configuration. Required for 2 in 1 laptops. Date: Sun, 26 Nov 2023 13:00:01 +0100 Message-ID: X-Original-To: Debian Bug Tracking System X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org Sun Nov 26 11:51:15 2023 Old-Return-Path: X-Spam-Flag: NO X-Spam-Score: -3.96 Reply-To: Haakon McKay , 1056904@bugs.debian.org Resent-To: debian-bugs-dist@lists.debian.org Resent-Cc: hagar@aussiebroadband.com.au, Debian Kernel Team X-Debian-Pr-Message: report 1056904 X-Debian-Pr-Package: linux-image-amd64 X-Debian-Pr-Source: linux-latest, linux-latest-2.6, linux-signed-amd64 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Versions: 6.1.55-1 6.5.0.0 X-Mailer: reportbug 12.0.0 X-Debian-Message: from BTS X-Mailing-List: archive/latest/1807726 List-ID: List-URL: Approved: robomod@news.nic.it Lines: 327 Organization: linux.* mail to news gateway Sender: robomod@news.nic.it X-Original-Date: Sun, 26 Nov 2023 19:46:58 +0800 X-Original-Message-ID: <170099921859.298070.9470707660705068101.reportbug@pentacle.twilight.home> Xref: csiph.com linux.debian.bugs.dist:1176235 linux.debian.kernel:80950 Package: linux-image-amd64 Severity: normal X-Debbugs-Cc: hagar@aussiebroadband.com.au Dear Maintainer, I have been trying to get Tablet/Laptop switching working, along with touchscreen, rotation and stylus. The Laptop mode module was missing for the HP x360 2 in 1 laptop. I recompiled the 6.5.3 kernel with hp_wmi module enabled. Now the system can tell the difference between Laptop and Tablet modes. (Script included at end) The module should have already been enabled allowing easier debugging. -- System Information: Debian Release: 12.2 APT prefers stable APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 'stable-security'), (500, 'proposed-updates'), (100, 'bookworm-fasttrack'), (100, 'bookworm-backports-staging') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 6.5.3 (SMP w/8 CPU threads; PREEMPT) Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), LANGUAGE=en_AU:en Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages linux-image-amd64 depends on: ii linux-image-6.1.0-13-amd64 6.1.55-1 ii linux-image-6.1.0-13-amd64 6.5.0-0 linux-image-amd64 recommends no packages. linux-image-amd64 suggests no packages. -- no debconf information The following script uses hp_wmi to switch between Laptop and Tablet modes. It also confines the touchscreen to the laptop screen, rotates and redraws the desktop when required and turns the pen into a mouse. ~/bin/xautorotate.sh #!/bin/bash # # This script enables latop/tablet switching on 2 in 1 devices running # The Mate or Gnome desktops # # Copyright (C) 2023 Haakon McKay hagar@aussiebroadband.com.au # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # any later version. # # Autostart it on login # # Requires - # Kernel module hp_wmi (for HP models) # xrandr # udevadm # xinput # monitor-sensor # onboard # # 2 files in - /etc/acpi/events/ (for HP models) ###################################### # # /etc/acpi/events/hp-x360-tablet # event=Type: 5 Code: 1 Value: 1 # action=/etc/acpi/tablet.sh ###################################### # # /etc/acpi/events/hp-x360-laptop # event=Type: 5 Code: 1 Value: 0 # action=/etc/acpi/laptop.sh ###################################### # # # The screen connected to the touchscreen # #TD="eDP-1" TD=`xrandr --listmonitors | grep "^ *0:" | sed -e "s/.* //"` # # Find the touchscreen # function get-touchy () { NAME="" TOUCH=false udevadm info --export-db | while read X do case "x${X}" in "x") if ${TOUCH} -o ${DISP} then test "x${NAME}" != "x" && echo "${NAME}" fi NAME="" TOUCH=false ;; "xE: NAME="* ) NAME="${X##E: NAME=\"}" NAME="${NAME%%\"}" ;; "xE: ID_INPUT_TOUCHSCREEN=1" ) TOUCH=true ;; esac done } TS="`get-touchy`" TSP="${TS} Stylus Pen" TSE="${TS} Stylus Eraser" function check_inputs () { declare -A PENS while true do while read X do F=0 FL=${#PENS[*]} for (( x=0 ; x<${FL} ; x++)) do if test "${PENS[${x}]}" = "${X}" then F=1 break fi done if test ${F} -eq 0 then PENS[${FL}]="${X}" [[ "${X}" =~ "Pen" ]] && echo "Found: Pen: ${X}" [[ "${X}" =~ "Eraser" ]] && echo "Found: Eraser: ${X}" fi done </dev/null } function killem () { kill $(jobs -p) 2>/dev/null } trap killem EXIT SIGQUIT SIGKILL SIGABRT # # Make sure the touchpad is restricted to the correct display # xinput map-to-output "${TS}" "${TD}" # # Set the lock screen keyboard # case "${XDG_CURRENT_DESKTOP}" in MATE) gsettings set org.mate.screensaver embedded-keyboard-command 'onboard -e' gsettings set org.mate.screensaver embedded-keyboard-enabled true ;; GNOME) gsettings set org.gnome.screensaver embedded-keyboard-command 'onboard -e' gsettings set org.gnome.screensaver embedded-keyboard-enabled true ;; esac # # Loop through and test for orientation change # LORIENTATION="" run_em | while read X ; do # # Find the change and set the flags # case $X in *"orientation: normal"*) ORIENTATION=normal RFLAGS="1 0 0 0 1 0 0 0 1" ;; *"orientation changed: normal"*) ORIENTATION=normal RFLAGS="1 0 0 0 1 0 0 0 1" ;; *"orientation changed: left-up"*) ORIENTATION=left RFLAGS="0 -1 1 1 0 0 0 0 1" ;; *"orientation changed: right-up"*) ORIENTATION=right RFLAGS="0 1 0 -1 0 1 0 0 1" ;; *"orientation changed: bottom-up"*) ORIENTATION=inverted RFLAGS="-1 0 1 0 -1 1 0 0 1";; *"Found: Pen: "*) xinput set-button-map "${X##*: }" 1 2 ;; *"Found: Eraser: "*) xinput set-button-map "${X##*: }" 3 ;; "Laptop Mode") gsettings set org.onboard.icon-palette in-use false dbus-send --type=method_call --print-reply --dest=org.onboard.Onboard \ /org/onboard/Onboard/Keyboard org.onboard.Onboard.Keyboard.Hide \ >/dev/null 2>&1 ;; "Tablet Mode") dbus-send --type=method_call --print-reply --dest=org.onboard.Onboard \ /org/onboard/Onboard/Keyboard org.onboard.Onboard.Keyboard.Show \ >/dev/null 2>&1 gsettings set org.onboard.icon-palette in-use true ;; *"Connected Monitors: "*) # # Make sure the touchpad is restricted to the correct display # xinput | grep "${TS}.*pointer" | sed 's/^.[[:space:]]*.[[:space:]]*//g ; s/[[:space:]]*id=.*//;' \ | while read X do xinput map-to-output "${X}" "${TD}" done ND=${NT} case "${XDG_CURRENT_DESKTOP}" in MATE) gsettings set org.mate.background show-desktop-icons true sleep 0.5 gsettings set org.mate.background show-desktop-icons true ;; GNOME) gsettings set org.gnome.desktop.background show-desktop-icons true sleep 0.5 gsettings set org.gnome.desktop.background show-desktop-icons true ;; esac ;; esac # # Set the original orientation # test "x${LORIENTATION}" = "x" && LORIENTATION="${ORIENTATION}" # # Make the change if there is one # if test "x${ORIENTATION}" != "x" -a "${LORIENTATION}" != "${ORIENTATION}" then # # Set the last orientation # LORIENTATION="${ORIENTATION}" # # Rotate the screen Part 1 # # xrandr --output ${TD} -o ${ORIENTATION} xrandr --output ${TD} --rotate ${ORIENTATION} case "${XDG_CURRENT_DESKTOP}" in MATE) gsettings set org.mate.background show-desktop-icons false ;; GNOME) gsettings set org.gnome.desktop.background show-desktop-icons false ;; esac # # Set the inputs to the new orientation # xinput | grep "${TS}.*pointer" | sed 's/^.[[:space:]]*.[[:space:]]*//g ; s/[[:space:]]*id=.*//;' \ | while read X do xinput set-prop "${X}" \ --type=float "Coordinate Transformation Matrix" ${RFLAGS} done # # Reset the background (Mate Hack) Part 2 # sleep 0.5 case "${XDG_CURRENT_DESKTOP}" in MATE) gsettings set org.mate.background show-desktop-icons false ;; GNOME) gsettings set org.gnome.desktop.background show-desktop-icons false ;; esac # # Make sure the touchpad is restricted to the correct display # xinput | grep "${TS}.*pointer" | sed 's/^.[[:space:]]*.[[:space:]]*//g ; s/[[:space:]]*id=.*//;' \ | while read X do xinput map-to-output "${X}" "${TD}" done fi done