2017-01-06 19:04:04 +00:00
|
|
|
#!/usr/bin/env python3
|
2022-05-10 10:06:48 +00:00
|
|
|
# Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
|
|
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2017-01-06 19:04:04 +00:00
|
|
|
|
|
|
|
import urllib.request
|
|
|
|
|
2018-08-01 20:40:22 +00:00
|
|
|
# The original source for this data used to be
|
|
|
|
# 'https://git.fedorahosted.org/cgit/hwdata.git/plain/pnp.ids'
|
|
|
|
# which is discontinued. For now there seems to be a fork at:
|
|
|
|
url = 'https://github.com/vcrhonek/hwdata/raw/master/pnp.ids'
|
2017-01-06 19:04:04 +00:00
|
|
|
|
2022-05-10 10:06:48 +00:00
|
|
|
copyright = """
|
|
|
|
// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
2017-01-06 19:04:04 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
notice = """/*
|
|
|
|
* This lookup table was generated from {}
|
|
|
|
*
|
2018-08-01 20:40:58 +00:00
|
|
|
* Do not change this file directly, instead edit the
|
2017-01-06 19:04:04 +00:00
|
|
|
* qtbase/util/edid/qedidvendortable.py script and regenerate this file.
|
|
|
|
*/""".format(url)
|
|
|
|
|
|
|
|
header = """
|
|
|
|
#ifndef QEDIDVENDORTABLE_P_H
|
|
|
|
#define QEDIDVENDORTABLE_P_H
|
|
|
|
|
2017-09-07 11:46:15 +00:00
|
|
|
//
|
|
|
|
// W A R N I N G
|
|
|
|
// -------------
|
|
|
|
//
|
2018-01-30 12:52:05 +00:00
|
|
|
// This file is not part of the Qt API. It exists purely as an
|
|
|
|
// implementation detail. This header file may change from version to
|
2017-09-07 11:46:15 +00:00
|
|
|
// version without notice, or even be removed.
|
|
|
|
//
|
2018-01-30 12:52:05 +00:00
|
|
|
// We mean it.
|
|
|
|
//
|
2017-09-07 11:46:15 +00:00
|
|
|
|
2022-02-21 16:03:34 +00:00
|
|
|
#include <QtCore/private/qglobal_p.h>
|
|
|
|
|
2017-01-06 19:04:04 +00:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
2021-04-20 08:44:48 +00:00
|
|
|
struct VendorTable {
|
2017-01-06 19:04:04 +00:00
|
|
|
const char id[4];
|
|
|
|
const char name[%d];
|
2021-04-20 08:44:48 +00:00
|
|
|
};
|
2017-01-06 19:04:04 +00:00
|
|
|
|
2021-04-20 08:44:48 +00:00
|
|
|
static const VendorTable q_edidVendorTable[] = {"""
|
2017-01-06 19:04:04 +00:00
|
|
|
|
|
|
|
footer = """};
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
#endif // QEDIDVENDORTABLE_P_H"""
|
|
|
|
|
|
|
|
vendors = {}
|
|
|
|
|
|
|
|
max_vendor_length = 0
|
|
|
|
|
|
|
|
response = urllib.request.urlopen(url)
|
|
|
|
data = response.read().decode('utf-8')
|
|
|
|
for line in data.split('\n'):
|
|
|
|
l = line.split()
|
|
|
|
if line.startswith('#'):
|
|
|
|
continue
|
|
|
|
elif len(l) == 0:
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
pnp_id = l[0].upper()
|
|
|
|
vendors[pnp_id] = ' '.join(l[1:])
|
|
|
|
if len(vendors[pnp_id]) > max_vendor_length:
|
|
|
|
max_vendor_length = len(vendors[pnp_id])
|
|
|
|
|
|
|
|
print(copyright)
|
|
|
|
print(notice)
|
|
|
|
print(header % (max_vendor_length + 1))
|
2018-08-01 20:34:50 +00:00
|
|
|
for pnp_id in sorted(vendors.keys()):
|
2017-01-06 19:04:04 +00:00
|
|
|
print(' { "%s", "%s" },' % (pnp_id, vendors[pnp_id]))
|
|
|
|
print(footer)
|