Skip to content

Commit 11842e2

Browse files
gupurushgupurush
authored andcommitted
Added support for TLV_CODE_VENDOR_NAME
1 parent 3abd19e commit 11842e2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

scripts/decode-syseeprom

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,23 @@ def print_model(use_db=False):
206206
print(model)
207207

208208

209+
def print_vendor(use_db=False):
210+
vendor = None
211+
if use_db:
212+
vendor = get_tlv_value_from_db(TlvInfoDecoder._TLV_CODE_VENDOR_NAME)
213+
else:
214+
eeprom = instantiate_eeprom_object()
215+
if not eeprom:
216+
print('Failed to read system EEPROM info')
217+
return
218+
219+
try:
220+
vendor = eeprom.vendorstr()
221+
except TypeError:
222+
vendor = eeprom.vendorstr(eeprom.read_eeprom())
223+
224+
print(vendor)
225+
209226
#-------------------------------------------------------------------------------
210227
#
211228
# sets global variable "optcfg"
@@ -220,6 +237,9 @@ def get_cmdline_opts():
220237
help='print the device product name')
221238
optcfg.add_option('-m', dest='mgmtmac', action='store_true', default=False,
222239
help='print the base mac address for management interfaces')
240+
optcfg.add_option('-v', dest='vendorstr', action='store_true', default=False,
241+
help='print the vendor string for the platform')
242+
223243
return optcfg.parse_args()
224244

225245

@@ -253,6 +273,8 @@ def main():
253273
print_serial(use_db)
254274
elif opts.modelstr:
255275
print_model(use_db)
276+
elif opts.vendorstr:
277+
print_vendor(use_db)
256278
else:
257279
if use_db:
258280
tlv_dict = read_eeprom_from_db()

0 commit comments

Comments
 (0)