通用按钮设备是一种标准设备,用于通过硬件中断报告按钮事件,并将这些中断映射到人类接口设备(HID)规范中定义的特定用法。
为了向作系统表达按钮的功能,需要两条信息:
- HID 控件的使用
- 控件所属的 HID 集合的用法
用途是用途页和用途 ID 的组合。 例如,“调高音量”按钮在消费者控制集合(用途页0x0C,用途 ID 0x01)中标识为“音量增大用途”(用途页0x0C,用途 ID 0xE9)。
通用按钮设备的 ACPI 设备 ID 为 ACPI0011。 Windows 为该设备加载Microsoft提供的内置驱动程序,Hidinterrupt.sys。
有关通用按钮设备的详细信息,请访问 统一可扩展固件接口 规范网站,并下载 ACPI 规范版本 6.0 PDF 文档。 然后使用左侧窗格导航到 第 9.19 节。
适用于 Windows 10 核心操作系统版本的示例 ACPI 按钮设备
用于描述运行 Windows 10 核心 OS 的设备 ACPI 源语言(ASL) 中的按钮的示例。
// Sample Buttons in ACPI Source Language for Windows 10.
Device(BTNS)
{
Name(_HID, "ACPI0011")
Name(_CRS, ResourceTemplate() {
GpioInt(Edge, ActiveBoth,...) {pin} // Index 0: Power Button
GpioInt(Edge, ActiveBoth,...) {pin} // Index 1: Volume Up Button
GpioInt(Edge, ActiveBoth,...) {pin} // Index 2: Volume Down Button
GpioInt(Edge, ActiveHigh,...) {pin} // Index 3: Camera Auto-focus Button
GpioInt(Edge, ActiveLow,...) {pin} // Index 4: Camera Shutter Button
GpioInt(Edge, ActiveBoth,...) {pin} // Index 5: Back Button
GpioInt(Edge, ActiveBoth,...) {pin} // Index 6: Windows/Home Button
GpioInt(Edge, ActiveBoth,...) {pin} // Index 7: Search Button
})
Name(_DSD, Package(2) {
//UUID for HID Button Descriptors:
ToUUID("FA6BD625-9CE8-470D-A2C7-B3CA36C4282E"),
//Data structure for this UUID:
Package(9) {
Package(5) {
0, // This is a Collection
1, // Unique ID for this Collection
0, // This is a Top-Level Collection
0x01, // Usage Page ("Generic Desktop Page")
0x0D // Usage ("Portable Device Control")
},
Package(5) {
1, // This is a Control
0, // Interrupt index in _CRS for Power Button
1, // Unique ID of Parent Collection
0x01, // Usage Page ("Generic Desktop Page")
0x81 // Usage ("System Power Down")
},
Package(5) {
1, // This is a Control
1, // Interrupt index in _CRS for Volume Up Button
1, // Unique ID of Parent Collection
0x0C, // Usage Page ("Consumer Page")
0xE9 // Usage ("Volume Increment")
},
Package(5) {
1, // This is a Control
2, // Interrupt index in _CRS for Volume Down Button
1, // Unique ID of Parent Collection
0x0C, // Usage Page ("Consumer Page")
0xEA // Usage ("Volume Decrement")
},
Package(5) {
1, // This is a Control
3, // Interrupt index in _CRS for Camera Auto-focus Button
1, // Unique ID of Parent Collection
0x90, // Usage Page ("Camera Control Page")
0x20 // Usage ("Camera Auto-focus")
},
Package(5) {
1, // This is a Control
4, // Interrupt index in _CRS for Camera Shutter Button
1, // Unique ID of Parent Collection
0x90, // Usage Page ("Camera Control Page")
0x21 // Usage ("Camera Shutter")
},
Package(5) {
1, // This is a Control
5, // Interrupt index in _CRS for Back Button
1, // Unique ID of Parent Collection
0x0C, // Usage Page ("Consumer Page")
0x224 // Usage ("AC Back")
},
Package(5) {
1, // This is a Control
6, // Interrupt index in _CRS for Windows/Home Button
1, // Unique ID of Parent Collection
0x07, // Usage Page ("Keyboard Page")
0xE3 // Usage ("Keyboard Left GUI")
},
Package(5) {
1, // This is a Control
7, // Interrupt index in _CRS for Search Button
1, // Unique ID of Parent Collection
0x0C, // Usage Page ("Consumer Page")
0x221 // Usage ("AC Search")
}
}
})
}
运行 Windows 10 桌面版的设备 ACPI 中的示例按钮
用于描述运行 Windows 10 桌面版(家庭版、专业版、企业版和教育 版)的设备 ACPI 源语言(ASL) 中的按钮的示例。
Device(BTNS)
{
Name(_HID, "ACPI0011")
Name(_CRS, ResourceTemplate() {
GpioInt(Edge, ActiveBoth,...) {pin} // Index 0: Power Button
GpioInt(Edge, ActiveBoth,...) {pin} // Index 1: Volume Up Button
GpioInt(Edge, ActiveBoth,...) {pin} // Index 2: Volume Down Button
GpioInt(Edge, ActiveBoth,...) {pin} // Index 3: Windows/Home Button
GpioInt(Edge, ActiveBoth,...) {pin} // Index 4: Rotation Lock Button
})
Name(_DSD, Package(2) {
//UUID for HID Button Descriptors:
ToUUID("FA6BD625-9CE8-470D-A2C7-B3CA36C4282E"),
//Data structure for this UUID:
Package(6) {
Package(5) {
0, // This is a Collection
1, // Unique ID for this Collection
0, // This is a Top-Level Collection
0x01, // Usage Page ("Generic Desktop Page")
0x0D // Usage ("Portable Device Control")
},
Package(5) {
1, // This is a Control
0, // Interrupt index in _CRS for Power Button
1, // Unique ID of Parent Collection
0x01, // Usage Page ("Generic Desktop Page")
0x81 // Usage ("System Power Down")
},
Package(5) {
1, // This is a Control
1, // Interrupt index in _CRS for Volume Up Button
1, // Unique ID of Parent Collection
0x0C, // Usage Page ("Consumer Page")
0xE9 // Usage ("Volume Increment")
},
Package(5) {
1, // This is a Control
2, // Interrupt index in _CRS for Volume Down Button
1, // Unique ID of Parent Collection
0x0C, // Usage Page ("Consumer Page")
0xEA // Usage ("Volume Decrement")
},
Package(5) {
1, // This is a Control
3, // Interrupt index in _CRS for Windows/Home Button
1, // Unique ID of Parent Collection
0x07, // Usage Page ("Keyboard Page")
0xE3 // Usage ("Keyboard Left GUI")
},
Package(5) {
1, // This is a Control
4, // Interrupt index in _CRS for Rotation Lock Button
1, // Unique ID of Parent Collection
0x01, // Usage Page ("Generic Desktop Page")
0xCA // Usage ("System Display Rotation Lock Slider Switch")
}
}
})
}