Skip to content

Commit 5752f09

Browse files
authored
fix: add cpu key for loong arch (#350)
Bug: https://pms.uniontech.com/bug-view-355167.html
1 parent 012ceeb commit 5752f09

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

src/internal/updateplatform/systeminfo_utils.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ import (
2929
)
3030

3131
const (
32-
cpuInfoFilePath = "/proc/cpuinfo"
33-
cpuKeyDelim = ":"
34-
cpuKeyName = "model name"
35-
cpuKeySWCPU = "cpu"
36-
cpuKeyARMProcessor = "Processor"
37-
cpuKeyHWHardware = "Hardware"
32+
cpuInfoFilePath = "/proc/cpuinfo"
33+
cpuKeyDelim = ":"
34+
cpuKeyLoongArchCPUModel = "Model Name"
35+
cpuKeyName = "model name"
36+
cpuKeySWCPU = "cpu"
37+
cpuKeyARMProcessor = "Processor"
38+
cpuKeyHWHardware = "Hardware"
3839

3940
lscpuKeyModelName = "Model name"
4041
lscpuKeyDelim = ":"
@@ -278,7 +279,13 @@ func getProcessorInfo(file string) (string, error) {
278279
return "", err
279280
}
280281

281-
cpu, _ := getCPUInfoFromMap(cpuKeySWCPU, data)
282+
// loongarch
283+
cpu, _ := getCPUInfoFromMap(cpuKeyLoongArchCPUModel, data)
284+
if len(cpu) != 0 {
285+
return cpu, nil
286+
}
287+
288+
cpu, _ = getCPUInfoFromMap(cpuKeySWCPU, data)
282289
if len(cpu) != 0 {
283290
return cpu, nil
284291
}

0 commit comments

Comments
 (0)