Skip to content

Commit 7832375

Browse files
committed
Fixing regex to include extra potential symbols in a vendor name/device name.
Signed-off-by: Rob Dobson <rob.dobson@citrix.com>
1 parent 218d51d commit 7832375

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

hwinfo/pci/lspci.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class ParserException(Exception):
66
pass
77

8-
LABEL_REGEX = r'[\w+\ \.\-\/\[\]\(\)]+'
8+
LABEL_REGEX = r'[\w+\ \.\,\+\&\-\/\[\]\(\)]+'
99
CODE_REGEX = r'[0-9a-fA-F]{4}'
1010
BUSID_REGEX = r'[0-9a-fA-F]{2}:[0-9a-fA-F]{2}\.[0-9a-fA-F]'
1111

hwinfo/pci/tests/test_lspci.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,24 @@ class IntelNetDeviceParser(TestSingleDeviceNNMMParse):
280280
'pci_subdevice_id': '05d2',
281281
}
282282

283+
class BrocadeNetDeviceParser(TestSingleDeviceNNMMParse):
284+
285+
SAMPLE_DATA = '0d:00.3 "Ethernet controller [0200]" "Brocade Communications Systems, Inc. [1657]" "1010/1020/1007/1741 10Gbps CNA [0014]" -r01 "Brocade Communications Systems, Inc. [1657]" "1010/1020/1007/1741 10Gbps CNA - LL [0015]"'
286+
287+
DEVICE_REC = {
288+
'pci_device_bus_id': '0d:00.3',
289+
'pci_device_class': '0200',
290+
'pci_device_class_name': 'Ethernet controller',
291+
'pci_vendor_name': 'Brocade Communications Systems, Inc.',
292+
'pci_vendor_id': '1657',
293+
'pci_device_id': '0014',
294+
'pci_device_name': '1010/1020/1007/1741 10Gbps CNA',
295+
'pci_subvendor_name': 'Brocade Communications Systems, Inc.',
296+
'pci_subvendor_id': '1657',
297+
'pci_subdevice_name': '1010/1020/1007/1741 10Gbps CNA - LL',
298+
'pci_subdevice_id': '0015',
299+
}
300+
283301
class TestMultiDeviceNNMMParse(unittest.TestCase):
284302

285303
SAMPLE_FILE = '%s/lspci-nnmm' % DATA_DIR

0 commit comments

Comments
 (0)