fpgainfo: add check for sysfs nodes
* fpgainfo: add check for port sysfs node
Add a check if the port sysfs path exists prior to processing it.
The port may not exist in some virtualization environments.
* fpgainfo: Add check for sysfs fme path
@@ -437,8 +437,14 @@ class sysfsinfo(object):
**bdf).device_id
sysfs_fme = FME_DEVICE.format(instance_id=instance_id)
sysfs_port = PORT_DEVICE.format(instance_id=instance_id)
+
+ # if the fme exists, get info for the fme
+ if os.path.exists(sysfs_fme):
self._fmelist.append(fme_info(sysfs_fme, instance_id,
self.device_id, **bdf))
+
+ # if the port exists, get info for the port
+ if os.path.exists(sysfs_port):
self._portlist.append(port_info(sysfs_port, instance_id,
self.device_id, **bdf))
