当笔记本电脑盖子关闭时如何禁用指纹认证(ubuntu 24.04)?

To disable fingerprint authentication when the laptop lid is closed, and re-enable when it is reopened, we will use acpid to bind to the button/lid.* event to a custom script that will stop and mask the fprintd service on lid close, and unmask and start the fprintd service on lid open.

We also check that the HDMI cable is connected by testing the contents of /sys/class/drm/card1-HDMI-A-1/status.

Follow the steps below: (ThinkPad T440 ubunu 22.04)

  1. Create file /etc/acpi/laptop-lid.sh with the following contents:

  2. Make the file executable with

  3. Create file /etc/acpi/events/laptop-lid with the following contents:

  4. Restart the acpid service with:

Now the fingerprint will be used only when the lid is open.

In order to restore the correct state of the fprintd service if you disconnect/reconnect while the laptop is off, you may call the above script from a systemd init file. The steps to do this are the following:

  1. Create a file named /etc/systemd/system/laptop-lid.service with the following contents:

  2. Reload the systemd config files with

  3. Start the service with

  4. Enable the service so that it starts automatically on boot

    Now the status should be correct even after connecting/disconnecting when the computer is off.

    References used for creating the code in the answer:

    参考链接


发布者

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注