Add firmware versions for all components
Extract firmware from: - asset.json: BIOS, ME, BKC, CPU Microcode, HDD/SSD/NVMe - component.log: PSU firmware, Network adapter firmware Deduplicate entries to avoid showing same firmware twice. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+27
@@ -109,6 +109,7 @@ func ParseAssetJSON(content []byte) (*models.HardwareConfig, error) {
|
||||
}
|
||||
|
||||
// Parse CPU info
|
||||
seenMicrocode := make(map[string]bool)
|
||||
for i, cpu := range asset.CpuInfo {
|
||||
config.CPUs = append(config.CPUs, models.CPU{
|
||||
Socket: i,
|
||||
@@ -123,6 +124,15 @@ func ParseAssetJSON(content []byte) (*models.HardwareConfig, error) {
|
||||
TDP: cpu.CpuTdp,
|
||||
PPIN: cpu.PPIN,
|
||||
})
|
||||
|
||||
// Add CPU microcode to firmware list (deduplicated)
|
||||
if cpu.MicroCodeVer != "" && !seenMicrocode[cpu.MicroCodeVer] {
|
||||
config.Firmware = append(config.Firmware, models.FirmwareInfo{
|
||||
DeviceName: fmt.Sprintf("CPU%d Microcode", i),
|
||||
Version: cpu.MicroCodeVer,
|
||||
})
|
||||
seenMicrocode[cpu.MicroCodeVer] = true
|
||||
}
|
||||
}
|
||||
|
||||
// Memory info is parsed from component.log (RESTful Memory info) which has more details
|
||||
@@ -148,6 +158,7 @@ func ParseAssetJSON(content []byte) (*models.HardwareConfig, error) {
|
||||
}
|
||||
|
||||
// Parse storage info
|
||||
seenHDDFW := make(map[string]bool)
|
||||
for _, hdd := range asset.HddInfo {
|
||||
storageType := "HDD"
|
||||
if hdd.DiskInterfaceType == 5 {
|
||||
@@ -170,6 +181,22 @@ func ParseAssetJSON(content []byte) (*models.HardwareConfig, error) {
|
||||
Firmware: hdd.FirmwareVersion,
|
||||
Interface: diskInterfaceToString(hdd.DiskInterfaceType),
|
||||
})
|
||||
|
||||
// Add HDD firmware to firmware list (deduplicated by model+version)
|
||||
if hdd.FirmwareVersion != "" {
|
||||
fwKey := modelName + ":" + hdd.FirmwareVersion
|
||||
if !seenHDDFW[fwKey] {
|
||||
slot := hdd.LocationString
|
||||
if slot == "" {
|
||||
slot = fmt.Sprintf("%s %dGB", storageType, hdd.Capacity)
|
||||
}
|
||||
config.Firmware = append(config.Firmware, models.FirmwareInfo{
|
||||
DeviceName: fmt.Sprintf("%s (%s)", modelName, slot),
|
||||
Version: hdd.FirmwareVersion,
|
||||
})
|
||||
seenHDDFW[fwKey] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse PCIe info
|
||||
|
||||
Reference in New Issue
Block a user