MCPcopy Create free account
hub / github.com/F-Stack/f-stack / display_devices

Function display_devices

dpdk/usertools/dpdk-devbind.py:526–547  ·  view source on GitHub ↗

Displays to the user the details of a list of devices given in "dev_list". The "extra_params" parameter, if given, should contain a string with %()s fields in it for replacement by the named fields in each device's dictionary.

(title, dev_list, extra_params=None)

Source from the content-addressed store, hash-verified

524
525
526def display_devices(title, dev_list, extra_params=None):
527 '''Displays to the user the details of a list of devices given in
528 "dev_list". The "extra_params" parameter, if given, should contain a string
529 with %()s fields in it for replacement by the named fields in each
530 device's dictionary.'''
531 strings = [] # this holds the strings to print. We sort before printing
532 print("\n%s" % title)
533 print("=" * len(title))
534 if not dev_list:
535 strings.append("<none>")
536 else:
537 for dev in dev_list:
538 if extra_params is not None:
539 strings.append("%s '%s %s' %s" % (dev["Slot"],
540 dev["Device_str"],
541 dev["Device"],
542 extra_params % dev))
543 else:
544 strings.append("%s '%s'" % (dev["Slot"], dev["Device_str"]))
545 # sort before printing, so that the entries appear in PCI order
546 strings.sort()
547 print("\n".join(strings)) # print one per line
548
549
550def show_device_status(devices_type, device_name, if_field=False):

Callers 1

show_device_statusFunction · 0.85

Calls 1

printFunction · 0.50

Tested by

no test coverage detected