summaryrefslogtreecommitdiffstats
path: root/tools/make-pci-ids.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 17:44:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 17:44:25 +0000
commitf59ea5f7690c9a01ef6f7f6508084a66c40b1dae (patch)
tree482ee255d71f113be6c62e9ff3543fd6ebb9f12a /tools/make-pci-ids.py
parentReleasing progress-linux version 4.2.2-1.1~progress7.99u1. (diff)
downloadwireshark-f59ea5f7690c9a01ef6f7f6508084a66c40b1dae.tar.xz
wireshark-f59ea5f7690c9a01ef6f7f6508084a66c40b1dae.zip
Merging upstream version 4.2.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/make-pci-ids.py')
-rwxr-xr-xtools/make-pci-ids.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/make-pci-ids.py b/tools/make-pci-ids.py
index 0a77f766..093637d7 100755
--- a/tools/make-pci-ids.py
+++ b/tools/make-pci-ids.py
@@ -44,7 +44,7 @@ typedef struct
uint16_t did;
uint16_t svid;
uint16_t ssid;
- char *name;
+ const char *name;
} pci_id_t;
@@ -52,14 +52,14 @@ typedef struct
{
uint16_t vid;
uint16_t count;
- pci_id_t *ids_ptr;
+ pci_id_t const *ids_ptr;
} pci_vid_index_t;
"""
CODE_POSTFIX = """
-static pci_vid_index_t *get_vid_index(uint16_t vid)
+static pci_vid_index_t const *get_vid_index(uint16_t vid)
{
uint32_t start_index = 0;
uint32_t end_index = 0;
@@ -96,9 +96,9 @@ static pci_vid_index_t *get_vid_index(uint16_t vid)
const char *pci_id_str(uint16_t vid, uint16_t did, uint16_t svid, uint16_t ssid)
{
unsigned int i;
- static char *not_found = \"Not found\";
- pci_vid_index_t *index_ptr;
- pci_id_t *ids_ptr;
+ static const char *not_found = \"Not found\";
+ pci_vid_index_t const *index_ptr;
+ pci_id_t const *ids_ptr;
index_ptr = get_vid_index(vid);
@@ -184,7 +184,7 @@ def main():
did = -1
svid = -1
ssid = -1
- out_lines += "pci_id_t pci_vid_%04X[] = {\n" % (vid)
+ out_lines += "static pci_id_t const pci_vid_%04X[] = {\n" % (vid)
out_lines += "{0x%04X, 0xFFFF, 0xFFFF, 0xFFFF, \"%s(0x%04X)\"},\n" % (vid, words[1].strip(), vid)
id_list.append(vid)
continue
@@ -227,7 +227,7 @@ def main():
out_lines += "}; /* pci_vid_%04X[] */\n" % (vid)
count_list.append(entries)
- out_lines += "\npci_vid_index_t pci_vid_index[] = {\n"
+ out_lines += "\nstatic pci_vid_index_t const pci_vid_index[] = {\n"
vendor_count = len(id_list)
device_count = 0
@@ -240,10 +240,10 @@ def main():
out_lines += CODE_POSTFIX
if vendor_count < MIN_VENDOR_COUNT:
- exit_msg(f'Too view vendors. Wanted {MIN_VENDOR_COUNT}, got {vendor_count}.')
+ exit_msg(f'Too few vendors. Wanted {MIN_VENDOR_COUNT}, got {vendor_count}.')
if device_count < MIN_DEVICE_COUNT:
- exit_msg(f'Too view devices. Wanted {MIN_DEVICE_COUNT}, got {device_count}.')
+ exit_msg(f'Too few devices. Wanted {MIN_DEVICE_COUNT}, got {device_count}.')
with open(OUTPUT_FILE, "w", encoding="utf-8") as pci_ids_f:
pci_ids_f.write(out_lines)