diff mbox series

[V1] nics/net_device: modify the output of getting pci

Message ID 20220509095710.846-1-junx.dong@intel.com (mailing list archive)
State Accepted
Headers show
Series [V1] nics/net_device: modify the output of getting pci | expand

Checks

Context Check Description
ci/Intel-dts-pylama-test success Testing OK
ci/Intel-dts-format-test success Testing OK
ci/Intel-dts-suite-test success Testing OK

Commit Message

Jun Dong May 9, 2022, 9:57 a.m. UTC
About querying device pci information, the results are different on 
different versions of pexpect, some versions has space char in output 
front end, so strip the space char to improve stability.

Signed-off-by: Jun Dong <junx.dong@intel.com>
---
 nics/net_device.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tu, Lijuan May 18, 2022, 9:23 a.m. UTC | #1
On Mon,  9 May 2022 17:57:10 +0800, Jun Dong <junx.dong@intel.com> wrote:
> About querying device pci information, the results are different on 
> different versions of pexpect, some versions has space char in output 
> front end, so strip the space char to improve stability.
> 
> Signed-off-by: Jun Dong <junx.dong@intel.com>


Applied, thanks
diff mbox series

Patch

diff --git a/nics/net_device.py b/nics/net_device.py
index 4ef755e0..f616c6d2 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -941,14 +941,14 @@  def get_pci_id(crb, domain_id, bus_id, devfun_id):
         bus_id,
         devfun_id,
     )
-    out = crb.send_expect(command, "# ")
+    out = crb.send_expect(command, "# ").strip()
     vendor = out[2:]
     command = "cat /sys/bus/pci/devices/%s\:%s\:%s/device" % (
         domain_id,
         bus_id,
         devfun_id,
     )
-    out = crb.send_expect(command, "# ")
+    out = crb.send_expect(command, "# ").strip()
     device = out[2:]
     return "%s:%s" % (vendor, device)