当我向笔记本电脑发出断开连接信号时 Ubuntu 会做什么?

当我向笔记本电脑发出断开连接信号时 Ubuntu 会做什么?

当我按下底座上的断开连接按钮表示要断开笔记本电脑的连接时,Ubuntu 似乎会运行一些脚本或命令。最明显的变化是外部显示器的分辨率发生了变化。

准备断开连接后,我的笔记本电脑仍然通过底座连接到电源、VGA 输出和音频插孔,但没有连接到任何 USB 设备或光驱。我在带有 X6 UltraBase 的 ThinkPad X61s 上运行 11.04。

当我发出解除对接信号时会发生什么?

按下取消停靠按钮后,dmesg 显示的内容如下:

[81459.990682] ata1.00: disabled
[81459.990727] ata1.00: detaching (SCSI 0:0:0:0)
[81459.991722] ACPI: \_SB_.GDCK - undocking
[81460.009462] ehci_hcd 0000:00:1a.7: power state changed by ACPI to D0
[81460.020252] ehci_hcd 0000:00:1a.7: BAR 0: set to [mem 0xfe226c00-0xfe226fff] (PCI address [0xfe226c00-0xfe226fff])
[81460.020265] ehci_hcd 0000:00:1a.7: power state changed by ACPI to D0
[81460.020281] ehci_hcd 0000:00:1a.7: restoring config space at offset 0xf (was 0x300, writing 0x30b)
[81460.020309] ehci_hcd 0000:00:1a.7: restoring config space at offset 0x1 (was 0x2900000, writing 0x2900102)
[81460.020338] ehci_hcd 0000:00:1a.7: PME# disabled
[81460.020346] ehci_hcd 0000:00:1a.7: power state changed by ACPI to D0
[81460.020352] ehci_hcd 0000:00:1a.7: power state changed by ACPI to D0
[81460.020363] ehci_hcd 0000:00:1a.7: PCI INT C -> GSI 22 (level, low) -> IRQ 22
[81460.020372] ehci_hcd 0000:00:1a.7: setting latency timer to 64
[81460.020432] ehci_hcd 0000:00:1d.7: power state changed by ACPI to D0
[81460.040071] ehci_hcd 0000:00:1d.7: BAR 0: set to [mem 0xfe227000-0xfe2273ff] (PCI address [0xfe227000-0xfe2273ff])
[81460.040085] ehci_hcd 0000:00:1d.7: power state changed by ACPI to D0
[81460.040104] ehci_hcd 0000:00:1d.7: restoring config space at offset 0xf (was 0x400, writing 0x40b)
[81460.040133] ehci_hcd 0000:00:1d.7: restoring config space at offset 0x1 (was 0x2900000, writing 0x2900102)
[81460.040170] ehci_hcd 0000:00:1d.7: PME# disabled
[81460.040178] ehci_hcd 0000:00:1d.7: power state changed by ACPI to D0
[81460.040184] ehci_hcd 0000:00:1d.7: power state changed by ACPI to D0
[81460.040195] ehci_hcd 0000:00:1d.7: PCI INT D -> GSI 19 (level, low) -> IRQ 19
[81460.040204] ehci_hcd 0000:00:1d.7: setting latency timer to 64
[81460.040503] ehci_hcd 0000:00:1d.7: PCI INT D disabled
[81460.040552] ehci_hcd 0000:00:1d.7: PME# enabled
[81460.061657] ehci_hcd 0000:00:1d.7: power state changed by ACPI to D3
[81460.200414] usb 1-4: USB disconnect, address 14
[81462.220088] ehci_hcd 0000:00:1a.7: PCI INT C disabled
[81462.220169] ehci_hcd 0000:00:1a.7: PME# enabled
[81462.240115] ehci_hcd 0000:00:1a.7: power state changed by ACPI to D3

答案1

/etc/acpi/events/lenovo-undock或者与您的笔记本电脑相对应的其他类似文件定义了您的取消对接按钮的 ACPI 事件代码,并将其映射到对 的调用/etc/acpi/undock.sh

/etc/acpi/undock.sh通过与通过您的扩展坞热插拔的设备相对应的驱动程序运行,并向这些驱动程序发出断开连接的信号。

答案2

您还可以使用udev看这里

相关内容