Gentoo on a laptop: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
mNo edit summary
 
(7 intermediate revisions by the same user not shown)
Line 4: Line 4:


* It's highly recommended to install the NetworkManager (it will be pulled as a dependency by emerging kde-misc/networkmanagement) as it allows to easily connect to networks through a GUI. You can change networks easily.
* It's highly recommended to install the NetworkManager (it will be pulled as a dependency by emerging kde-misc/networkmanagement) as it allows to easily connect to networks through a GUI. You can change networks easily.
 
* NetworkManager needs to launch wpa_supplicant in -u mode. If something strange is happening (for instance no networks show up), activate syslog-ng and look in the logs.
* Another network manager is wicd, untried yet.
* Another network manager is wicd, untried yet.


= Touchpad =
= Touchpad =


* To support the touchpad the kernel should be configured with PS/2 mouse support and INPUT_DEVICES in /etc/make.conf should contain "synaptics".
* To support the touchpad the kernel should be configured with PS/2 mouse support and / or the correct driver for your touchpad model, and INPUT_DEVICES in /etc/make.conf should contain "synaptics".
* The xorg.conf file should have the following section:
* The xorg.conf file should have the following section:


Line 23: Line 23:


* [http://en.gentoo-wiki.com/wiki/Synaptics_Touchpad Link on the Gentoo wiki.]
* [http://en.gentoo-wiki.com/wiki/Synaptics_Touchpad Link on the Gentoo wiki.]
* Modern touchpads can use the I2C system. First thing to get your touchpad working is to configure kernel support and check via cat /proc/bus/input/devices that it is present. It can be hard to detect which particular hardware is used (I had a Designware I2C model on an ASUS UX330-UA model). In this case it is best to activate all kernel modules, get your touchpad model working, then slowly remove modules to pinpoint which were the modules actually needed .
* You may also need the HID_MULTITOUCH kernel module.
* Once kernel support is working, you can configure X.org. It seems that the newest driver / input subsystem is now libinput, not evdev (or synaptics).
= Keyboard =
* On the Lenovo Yoga 9i Slim laptop (14IAP7 model), the '''i8042.dumbkbd''' kernel boot parameter was needed to get the keyboard to work normally. Else it would only activate randomly after some time (and sometimes would never activate). It has the side effect of disabling the LED for the toggle key.


= Battery =
= Battery =
Line 33: Line 40:


* If you cannot see the ACPI event, it means there is a problem with your kernel configuration / BIOS / DSDT. For example on my Asus M51Sn the ACPI video module was needed in order to get the events from the brightness keys. Check if you have all the needed ACPI modules.
* If you cannot see the ACPI event, it means there is a problem with your kernel configuration / BIOS / DSDT. For example on my Asus M51Sn the ACPI video module was needed in order to get the events from the brightness keys. Check if you have all the needed ACPI modules.
== Default actions ==
* By default, pressing the power button initiates a shutdown. This is generally stupid (eg, very easy to press the power button inadvertently). You can remove this behavior by editing  /etc/acpi/actions/powerbtn.sh and just returning at the beginning.
* In fact, the script should not do that, but it detects wrongly the KDE 5 power manager, so it's better to comment out the last line.


== Debugging ACPI ==
== Debugging ACPI ==
Line 54: Line 66:
* The Ubuntu acpi-support package was previously used to provide scripts ran for some ACPI events. In Gentoo it is available in the Sunrise overlay.
* The Ubuntu acpi-support package was previously used to provide scripts ran for some ACPI events. In Gentoo it is available in the Sunrise overlay.
* In Ubuntu most of the ACPI scripts just generate a key event (via acpi_fakekey command). This indeed shows that the new way of generating directly events within the kernel is better than this roundtrip to userspace land.
* In Ubuntu most of the ACPI scripts just generate a key event (via acpi_fakekey command). This indeed shows that the new way of generating directly events within the kernel is better than this roundtrip to userspace land.
== USB autosuspend ==
* Sometimes USB autosuspend is active even for devices like mice. You can issue the following command at runtime to disable USB autosuspend:
echo -1 >/sys/module/usbcore/parameters/autosuspend
* Or you can permanently disable it with the following kernel boot parameter:
usbcore.autosuspend=-1
* The correct way would be to edit an udev rules file and specifically exclude the target mouse from autosuspend. With laptop-mode 1.66 or higher, you can simply edit /etc/laptop-mode/conf.d/runtime-pm.conf and disable autosuspend globally (CONTROL_RUNTIME_AUTOSUSPEND=0).


= Hotkeys (volume up, etc) =
= Hotkeys (volume up, etc) =


* acpi_fakekey no longer correctly works on newer kernels, so the acpi-support package should not be installed. The correct way is now to use a proper kernel driver that will correctly generate the key presses events, depending on your laptop model. For ASUS laptops, kernel-2.6.29 already handles this.
* acpi_fakekey no longer correctly works on newer kernels, so the acpi-support package should not be installed. The correct way is now to use a proper kernel driver that will correctly generate the key presses events, depending on your laptop model. For ASUS laptops, kernel-2.6.29 already handles this.

Latest revision as of 16:12, 13 July 2023

This page contains additional information for installing Gentoo on a laptop computer.

Networking

  • It's highly recommended to install the NetworkManager (it will be pulled as a dependency by emerging kde-misc/networkmanagement) as it allows to easily connect to networks through a GUI. You can change networks easily.
  • NetworkManager needs to launch wpa_supplicant in -u mode. If something strange is happening (for instance no networks show up), activate syslog-ng and look in the logs.
  • Another network manager is wicd, untried yet.

Touchpad

  • To support the touchpad the kernel should be configured with PS/2 mouse support and / or the correct driver for your touchpad model, and INPUT_DEVICES in /etc/make.conf should contain "synaptics".
  • The xorg.conf file should have the following section:
Section "InputDevice"
    Driver         "synaptics"
    Identifier "TouchPad"
    Option         "SendCoreEvents"
    Option         "Protocol" "auto-dev"
    Option         "SHMConfig" "on"
EndSection
  • Link on the Gentoo wiki.
  • Modern touchpads can use the I2C system. First thing to get your touchpad working is to configure kernel support and check via cat /proc/bus/input/devices that it is present. It can be hard to detect which particular hardware is used (I had a Designware I2C model on an ASUS UX330-UA model). In this case it is best to activate all kernel modules, get your touchpad model working, then slowly remove modules to pinpoint which were the modules actually needed .
  • You may also need the HID_MULTITOUCH kernel module.
  • Once kernel support is working, you can configure X.org. It seems that the newest driver / input subsystem is now libinput, not evdev (or synaptics).

Keyboard

  • On the Lenovo Yoga 9i Slim laptop (14IAP7 model), the i8042.dumbkbd kernel boot parameter was needed to get the keyboard to work normally. Else it would only activate randomly after some time (and sometimes would never activate). It has the side effect of disabling the LED for the toggle key.

Battery

  • To install a base KDE applet to monitor your battery, emerge klaptopdaemon. This will add a new control panel in Control Center, and will start the applet (KLaptop).
  • You don't need to start the acpi daemon (acpid) to have the battery monitor working.
  • If you have a recent kernel (like 2.6.28), you need to build the deprecated /proc/acpi files and directories, else klaptopdaemon won't work. This will probably be fixed in future versions of KDE (as userspace programs will move to the new ACPI APIs). You don't need the deprecated APM drivers.

ACPI

  • If you cannot see the ACPI event, it means there is a problem with your kernel configuration / BIOS / DSDT. For example on my Asus M51Sn the ACPI video module was needed in order to get the events from the brightness keys. Check if you have all the needed ACPI modules.

Default actions

  • By default, pressing the power button initiates a shutdown. This is generally stupid (eg, very easy to press the power button inadvertently). You can remove this behavior by editing /etc/acpi/actions/powerbtn.sh and just returning at the beginning.
  • In fact, the script should not do that, but it detects wrongly the KDE 5 power manager, so it's better to comment out the last line.

Debugging ACPI

  • To debug ACPI (if some keys are not working for example):
    • Try to cat the keyboard device. Real ACPI events won't generate an output; keypresses will.
    • Check if your DSDT has a known problem (a DSDT can be decompiled to human form by running cat /proc/acpi/dsdt > dsdt; iasl -d dsdt).

Hotkeys

  • Warning: deprecated architecture, see below.

Previous (Ubuntu) architecture

  • A nice overall explanation.
  • Some keypresses generate ACPI events caught by the ACPI daemon, not standard X events. You can see if some ACPI events were generated by starting a logging daemon and doing a tail /var/log/messages.
  • Normally the ACPI daemon can launch scripts to handle the event action. Currently it seems there are plans to bypass the use of acpid (which runs in the userspace), and use the kernel (in conjunction with HAL) to generate direct X input events that can be used directly by your desktop manager. This is for example detailed in this blog.

ACPI scripts

  • The Ubuntu acpi-support package was previously used to provide scripts ran for some ACPI events. In Gentoo it is available in the Sunrise overlay.
  • In Ubuntu most of the ACPI scripts just generate a key event (via acpi_fakekey command). This indeed shows that the new way of generating directly events within the kernel is better than this roundtrip to userspace land.

USB autosuspend

  • Sometimes USB autosuspend is active even for devices like mice. You can issue the following command at runtime to disable USB autosuspend:
echo -1 >/sys/module/usbcore/parameters/autosuspend
  • Or you can permanently disable it with the following kernel boot parameter:
usbcore.autosuspend=-1
  • The correct way would be to edit an udev rules file and specifically exclude the target mouse from autosuspend. With laptop-mode 1.66 or higher, you can simply edit /etc/laptop-mode/conf.d/runtime-pm.conf and disable autosuspend globally (CONTROL_RUNTIME_AUTOSUSPEND=0).

Hotkeys (volume up, etc)

  • acpi_fakekey no longer correctly works on newer kernels, so the acpi-support package should not be installed. The correct way is now to use a proper kernel driver that will correctly generate the key presses events, depending on your laptop model. For ASUS laptops, kernel-2.6.29 already handles this.