mirror of
https://github.com/fankes/komari-agent.git
synced 2026-03-26 21:35:12 +08:00
fix: 排除虚拟 drm 设备
This commit is contained in:
@@ -103,6 +103,19 @@ func getFromLspci() string {
|
|||||||
func getFromSysfsDRM() string {
|
func getFromSysfsDRM() string {
|
||||||
matches, _ := filepath.Glob("/sys/class/drm/card*")
|
matches, _ := filepath.Glob("/sys/class/drm/card*")
|
||||||
|
|
||||||
|
excludedDrivers := map[string]bool{
|
||||||
|
"virtio-pci": true,
|
||||||
|
"virtio_gpu": true,
|
||||||
|
"bochs-drm": true,
|
||||||
|
"qxl": true,
|
||||||
|
"vmwgfx": true,
|
||||||
|
"cirrus": true,
|
||||||
|
"vboxvideo": true,
|
||||||
|
"hyperv_fb": true,
|
||||||
|
"simpledrm": true,
|
||||||
|
"simplefb": true,
|
||||||
|
}
|
||||||
|
|
||||||
for _, path := range matches {
|
for _, path := range matches {
|
||||||
// 驱动名称
|
// 驱动名称
|
||||||
driverLink, err := os.Readlink(filepath.Join(path, "device", "driver"))
|
driverLink, err := os.Readlink(filepath.Join(path, "device", "driver"))
|
||||||
@@ -111,6 +124,10 @@ func getFromSysfsDRM() string {
|
|||||||
}
|
}
|
||||||
driverName := filepath.Base(driverLink)
|
driverName := filepath.Base(driverLink)
|
||||||
|
|
||||||
|
if excludedDrivers[driverName] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// 设备树 compatible 提取具体型号
|
// 设备树 compatible 提取具体型号
|
||||||
// /sys/class/drm/card0/device/of_node/compatible
|
// /sys/class/drm/card0/device/of_node/compatible
|
||||||
// "qcom,adreno-750.1\0qcom,adreno"
|
// "qcom,adreno-750.1\0qcom,adreno"
|
||||||
|
|||||||
Reference in New Issue
Block a user