Skip to content

Commit 85a98c2

Browse files
committed
Change reporting to return uknown device names with the form '[Device XXXX]'.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
1 parent e3a3ffd commit 85a98c2

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

hwinfo/pci/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def get_device_name(self):
1616
if name == 'Device':
1717
# If the input has come from lspci, this is the value for
1818
# not being able to find a key in the pciids db.
19-
return 'unknown [%s]' % self.get_device_id()
19+
return '[Device %s]' % self.get_device_id()
2020
else:
2121
return name
2222

@@ -35,7 +35,7 @@ def get_subdevice_name(self):
3535
if name == 'Device':
3636
# If the input has come from lspci, this is the value for
3737
# not being able to find a key in the pciids db.
38-
return 'unknown [%s]' % self.get_subdevice_id()
38+
return '[Device %s]' % self.get_subdevice_id()
3939
else:
4040
return name
4141

@@ -57,7 +57,7 @@ def get_pci_id(self):
5757
)
5858

5959
def is_subdevice(self):
60-
return 'pci_subvendor_id' in self.rec and 'pci_subdevice_id' in self.rec
60+
return self.lookup_value('pci_subvendor_id') and self.lookup_value('pci_subdevice_id')
6161

6262
def get_info(self):
6363

hwinfo/pci/tests/test_pci.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_get_vendor_id(self):
3636

3737
def test_get_subdevice_name(self):
3838
name = self.device.get_subdevice_name()
39-
self.assertEqual(name, 'unknown [02a3]')
39+
self.assertEqual(name, '[Device 02a3]')
4040

4141
def test_get_subvendor_name(self):
4242
name = self.device.get_subvendor_name()
@@ -63,4 +63,4 @@ def test_is_subdevice(self):
6363

6464
def test_get_device_info(self):
6565
info = self.device.get_info()
66-
self.assertEqual(info, 'Dell unknown [02a3] (Broadcom Corporation NetXtreme II BCM5716 Gigabit Ethernet)')
66+
self.assertEqual(info, 'Dell [Device 02a3] (Broadcom Corporation NetXtreme II BCM5716 Gigabit Ethernet)')

0 commit comments

Comments
 (0)