20
20
motor_trim_factor = float (bot_config .get ("move_motor_trim" , 1.0 )),
21
21
)
22
22
23
+ def getserial ():
24
+ # Extract serial from cpuinfo file
25
+ cpuserial = "0000000000000000"
26
+ try :
27
+ f = open ('/proc/cpuinfo' ,'r' )
28
+ for line in f :
29
+ if line [0 :6 ]== 'Serial' :
30
+ cpuserial = line [10 :26 ]
31
+ f .close ()
32
+ except :
33
+ cpuserial = "ERROR000000000"
34
+
35
+ return cpuserial
36
+
23
37
prog = None
24
38
prog_engine = ProgramEngine .get_instance ()
25
39
@@ -62,16 +76,16 @@ def info():
62
76
except :
63
77
backend_commit = 'undefined'
64
78
try :
65
- coderbot_version = subprocess .check_output (["cat" , "/etc/coderbot/version" ]).decode ('utf-8' )[: - 2 ]
79
+ coderbot_version = subprocess .check_output (["cat" , "/etc/coderbot/version" ]).decode ('utf-8' ). replace ( ' \n ' , '' )
66
80
except :
67
81
coderbot_version = 'undefined'
68
82
try :
69
- kernel = subprocess .check_output (["uname" , "-r" ]).decode ('utf-8' )[: - 2 ]
83
+ kernel = subprocess .check_output (["uname" , "-r" ]).decode ('utf-8' ). replace ( ' \n ' , '' )
70
84
except :
71
85
kernel = 'undefined'
72
86
73
87
try :
74
- update_status = subprocess .check_output (["cat" , "/etc/coderbot/update_status" ]).decode ('utf-8' )[: - 2 ]
88
+ update_status = subprocess .check_output (["cat" , "/etc/coderbot/update_status" ]).decode ('utf-8' ). replace ( ' \n ' , '' )
75
89
except :
76
90
update_status = 'undefined'
77
91
@@ -82,6 +96,7 @@ def info():
82
96
"backend commit build" : backend_commit ,
83
97
"kernel" : kernel ,
84
98
"update status" : update_status ,
99
+ "serial" : getserial ()
85
100
}
86
101
87
102
0 commit comments