mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-06 12:06:25 +00:00
board_inspector: transform non-viewable characters in brand string
Some cpu reports a brand string with non-viewable characters. While XML string value can not contain NULL bytes or control characters. So replace non-viewable characters in brand string with spaces. Tracked-On: #7365 Signed-off-by: Qiang Zhang <qiang4.zhang@linux.intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
5130dfe08b
commit
b894b89f41
@ -5,6 +5,7 @@
|
||||
|
||||
import logging
|
||||
import lxml.etree
|
||||
import re
|
||||
|
||||
from cpuparser import parse_cpuid, get_online_cpu_ids
|
||||
from cpuparser.msr import *
|
||||
@ -44,7 +45,7 @@ def extract_model(processors_node, cpu_id, family_id, model_id, core_type, nativ
|
||||
for leaf in [0x80000002, 0x80000003, 0x80000004]:
|
||||
leaf_data = parse_cpuid(leaf, 0, cpu_id)
|
||||
brandstring += leaf_data.brandstring
|
||||
n.set("description", brandstring.decode())
|
||||
n.set("description", re.sub('[^!-~]+', ' ', brandstring.decode()).strip())
|
||||
|
||||
leaves = [(1, 0), (7, 0), (0x80000001, 0), (0x80000007, 0)]
|
||||
for leaf in leaves:
|
||||
|
Loading…
Reference in New Issue
Block a user