73 lines
1.6 KiB
Diff
73 lines
1.6 KiB
Diff
diff -Nuar startdde-5.9.61/display/util.go startdde-5.9.61.new/display/util.go
|
|
--- startdde-5.9.61/display/util.go 2022-12-09 11:19:18.000000000 +0800
|
|
+++ startdde-5.9.61.new/display/util.go 2023-04-12 11:21:51.145365556 +0800
|
|
@@ -15,6 +15,7 @@
|
|
"sort"
|
|
"strconv"
|
|
"strings"
|
|
+ "os/exec"
|
|
|
|
"github.com/godbus/dbus"
|
|
hostname1 "github.com/linuxdeepin/go-dbus-factory/org.freedesktop.hostname1"
|
|
@@ -333,6 +334,32 @@
|
|
return chassis, nil
|
|
}
|
|
|
|
+func CheckKvm() string {
|
|
+ var maty string
|
|
+ out, err := exec.Command("systemd-detect-virt").Output()
|
|
+ if err != nil {
|
|
+ maty = ""
|
|
+ }else {
|
|
+ maty = string(out)
|
|
+ maty = strings.Replace(maty, "\n", "", -1)
|
|
+ }
|
|
+ return maty
|
|
+}
|
|
+
|
|
+func CheckArch() string {
|
|
+ var KArch string
|
|
+ out, err := exec.Command("arch").Output()
|
|
+
|
|
+ if err != nil {
|
|
+ KArch = ""
|
|
+ }else {
|
|
+ KArch = string(out)
|
|
+ KArch = strings.Replace(KArch,"\n","",-1)
|
|
+ }
|
|
+ return KArch
|
|
+}
|
|
+
|
|
+
|
|
func getGraphicsCardPciId() string {
|
|
var pciId string
|
|
subsystems := []string{"drm"}
|
|
@@ -362,6 +389,27 @@
|
|
}
|
|
}
|
|
}
|
|
+//qxl not support in arm/loongarch
|
|
+//just try drm/card0
|
|
+ if pciId == "" {
|
|
+ maty := CheckKvm()
|
|
+ KArch := CheckArch()
|
|
+ if maty == "kvm" {
|
|
+ if KArch == "aarch64" || KArch == "loongarch64" {
|
|
+ for _, dev := range devices {
|
|
+ name := dev.GetName()
|
|
+ if name == "card0" {
|
|
+ cardDevice := dev.GetParent()
|
|
+ parentDevice := cardDevice.GetParent()
|
|
+ pciId = parentDevice.GetProperty("PCI_ID")
|
|
+ cardDevice.Unref()
|
|
+ parentDevice.Unref()
|
|
+ break
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
|
|
return pciId
|
|
}
|