File tree 2 files changed +12
-16
lines changed
x86_64-juniper_qfx5200-r0/plugins
x86_64-juniper_qfx5210-r0/plugins
2 files changed +12
-16
lines changed Original file line number Diff line number Diff line change 33
33
# as noted in the Third-Party source code file.
34
34
35
35
import os
36
+ import shutil
36
37
import binascii
37
38
import subprocess
38
39
from sonic_eeprom import eeprom_tlvinfo
@@ -170,20 +171,17 @@ def main():
170
171
eeprom_file .write ("Main board eeprom (0x57)\r \n " )
171
172
eeprom_file .write ("===============================\r \n " )
172
173
173
- MainEepromCreate = 'sudo echo 24c02 0x57 > /sys/bus/i2c/devices/i2c-0/new_device'
174
+ MainEepromCreate = '24c02 0x57'
175
+ out_file = '/sys/bus/i2c/devices/i2c-0/new_device'
174
176
# Write the contents of Main Board EEPROM to file
175
- try :
176
- os .system (MainEepromCreate )
177
- except OSError :
178
- print ('Error: Execution of "%s" failed' , MainEepromCreate )
179
- return False
177
+ f = open (out_file , 'w' )
178
+ f .write (MainEepromCreate )
179
+ f .close ()
180
180
181
181
MainEepromFileCmd = 'cat /sys/bus/i2c/devices/i2c-0/0-0057/eeprom > /etc/init.d/MainEeprom_qfx5200_ascii'
182
- try :
183
- os .system (MainEepromFileCmd )
184
- except OSError :
185
- print ('Error: Execution of "%s" failed' , MainEepromFileCmd )
186
- return False
182
+ src_file = '/sys/bus/i2c/devices/i2c-0/0-0057/eeprom'
183
+ dst_file = '/etc/init.d/MainEeprom_qfx5200_ascii'
184
+ shutil .copy (src_file , dst_file )
187
185
188
186
maineeprom_ascii = '/etc/init.d/MainEeprom_qfx5200_ascii'
189
187
Original file line number Diff line number Diff line change @@ -82,12 +82,10 @@ def main():
82
82
eeprom_file .write ("Manufacture Name=%s\r \n " % eeprom_qfx5210 .manufacture_name_str ())
83
83
84
84
CPUeepromFileCmd = 'cat /sys/devices/pci0000:00/0000:00:1f.3/i2c-0/0-0056/eeprom > /etc/init.d/eeprom_qfx5210_ascii'
85
+ src_file = '/sys/devices/pci0000:00/0000:00:1f.3/i2c-0/0-0056/eeprom'
86
+ dst_file = '/etc/init.d/eeprom_qfx5210_ascii'
85
87
# Write the contents of CPU EEPROM to file
86
- try :
87
- os .system (CPUeepromFileCmd )
88
- except OSError :
89
- print ('Error: Execution of "%s" failed' , CPUeepromFileCmd )
90
- return False
88
+ shutil .copy (src_file , dst_file )
91
89
92
90
eeprom_ascii = '/etc/init.d/eeprom_qfx5210_ascii'
93
91
# Read file contents in Hex format
You can’t perform that action at this time.
0 commit comments