From 13b69921adfb056ca202dadcd72a4c359b63e92032b1c26551738a192bfe2be4 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Wed, 8 Jan 2025 08:38:56 +0000 Subject: [PATCH] - Update to version 0.391 * Update pci and vendor ids OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory/hwdata?expand=0&rev=169 --- .gitattributes | 23 ++ .gitignore | 1 + hwdata-0.383.tar.gz | 3 + hwdata-0.384.tar.gz | 3 + hwdata-0.389.tar.gz | 3 + hwdata-0.390.tar.gz | 3 + hwdata-0.391.tar.gz | 3 + hwdata.changes | 536 ++++++++++++++++++++++++++++++++++++++++++++ hwdata.spec | 84 +++++++ merge-pciids.pl | 111 +++++++++ 10 files changed, 770 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 hwdata-0.383.tar.gz create mode 100644 hwdata-0.384.tar.gz create mode 100644 hwdata-0.389.tar.gz create mode 100644 hwdata-0.390.tar.gz create mode 100644 hwdata-0.391.tar.gz create mode 100644 hwdata.changes create mode 100644 hwdata.spec create mode 100644 merge-pciids.pl diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/hwdata-0.383.tar.gz b/hwdata-0.383.tar.gz new file mode 100644 index 0000000..76c71c1 --- /dev/null +++ b/hwdata-0.383.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97f328f85e51ea78ad14620705dba269cbbb47911e56bdd8b35360e6cdccc00c +size 2430035 diff --git a/hwdata-0.384.tar.gz b/hwdata-0.384.tar.gz new file mode 100644 index 0000000..a107508 --- /dev/null +++ b/hwdata-0.384.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:caa496a6203084ee3404c688a75ea05b4b10eec93340c503199647216127f347 +size 2435560 diff --git a/hwdata-0.389.tar.gz b/hwdata-0.389.tar.gz new file mode 100644 index 0000000..be24444 --- /dev/null +++ b/hwdata-0.389.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34813e6821a5dab0f663a363026e4d17e880e5f5f2ed49244c42263b226ff98a +size 2464900 diff --git a/hwdata-0.390.tar.gz b/hwdata-0.390.tar.gz new file mode 100644 index 0000000..51fc7e5 --- /dev/null +++ b/hwdata-0.390.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f10684093d2a7780de8a96d3dd8a2dd544ed6136dd359197750c42bb08ce526f +size 2473831 diff --git a/hwdata-0.391.tar.gz b/hwdata-0.391.tar.gz new file mode 100644 index 0000000..552c655 --- /dev/null +++ b/hwdata-0.391.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:620fe1c22922a3d1bd1062424e9cc6b954acea2f83b72ff0cb45144981cb1975 +size 2479872 diff --git a/hwdata.changes b/hwdata.changes new file mode 100644 index 0000000..c5e1994 --- /dev/null +++ b/hwdata.changes @@ -0,0 +1,536 @@ +------------------------------------------------------------------- +Wed Jan 8 08:37:44 UTC 2025 - Martin Pluskal + +- Update to version 0.391 + * Update pci and vendor ids + +------------------------------------------------------------------- +Wed Dec 4 08:30:46 UTC 2024 - Martin Pluskal + +- update to 0.390: + * Update pci and vendor ids + +------------------------------------------------------------------- +Thu Nov 7 10:44:20 UTC 2024 - Martin Pluskal + +- update to 0.389: + * Update pci and vendor ids + +------------------------------------------------------------------- +Mon Aug 26 11:42:12 UTC 2024 - Martin Pluskal + +- update to 0.385: + * Update pci and vendor ids + +------------------------------------------------------------------- +Mon Jun 17 10:40:11 UTC 2024 - Dirk Müller + +- update to 0.383: + * Update pci and vendor ids + +------------------------------------------------------------------- +Wed May 15 12:14:32 UTC 2024 - Martin Pluskal + +- update to 0.382: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Tue Mar 5 11:48:34 UTC 2024 - Martin Pluskal + +- update to 0.380: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Fri Feb 16 07:24:13 UTC 2024 - Martin Pluskal + +- update to 0.379: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Wed Jan 10 09:34:50 UTC 2024 - Martin Pluskal + +- update to 0.378: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Mon Dec 4 14:35:03 UTC 2023 - Dirk Müller + +- update to 0.377: + * Fixed trailing spaces in pnp.ids + +------------------------------------------------------------------- +Wed Nov 15 09:34:20 UTC 2023 - Dirk Müller + +- update to 0.376: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Tue Aug 22 13:24:19 UTC 2023 - Andrea Manzini + +- update to 0.373: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Tue Jul 11 08:18:13 UTC 2023 - Martin Pluskal + +- update to 0.372: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Fri Jun 9 08:48:16 UTC 2023 - Martin Pluskal + +- update to 0.371: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Tue May 16 15:41:24 UTC 2023 - Martin Pluskal + +- update to 0.370: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Mon Apr 3 11:48:27 UTC 2023 - Dirk Müller + +- update to 0.369: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Tue Mar 7 08:00:37 UTC 2023 - Martin Pluskal + +- update to 0.368: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Thu Feb 2 11:30:30 UTC 2023 - Dirk Müller + +- update to 0.367: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Wed Jan 4 09:20:21 UTC 2023 - Dirk Müller + +- update to 0.366: + * Update pci, usb and vendor ids + +------------------------------------------------------------------- +Tue Dec 6 11:12:21 UTC 2022 - Martin Pluskal + +- update to 0.365: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Nov 15 09:32:14 UTC 2022 - Martin Pluskal + +- update to 0.364: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Oct 13 08:20:35 UTC 2022 - Martin Pluskal + +- update to 0.363: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Sep 14 07:54:41 UTC 2022 - Martin Pluskal + +- update to 0.362: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Mon Jul 11 07:49:34 UTC 2022 - Dirk Müller + +- update to 0.361: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Jun 1 11:06:01 UTC 2022 - Martin Pluskal + +- Update to version 0.360 (bsc#1200110): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed May 11 07:09:44 UTC 2022 - Martin Pluskal + +- Update to version 0.359: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Apr 19 07:47:16 UTC 2022 - Martin Pluskal + +- Update to version 0.358 (bsc#1196332): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Mar 8 07:35:22 UTC 2022 - Martin Pluskal + +- Update to version 0.357 (bsc#1196332): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Feb 8 14:24:02 UTC 2022 - Martin Pluskal + +- Update to version 0.356: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Jan 5 11:05:12 UTC 2022 - Martin Pluskal + +- Update to version 0.355 (bsc#1194338): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Dec 7 09:32:12 UTC 2021 - Martin Pluskal + +- Update to version 0.354: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Nov 11 13:31:29 UTC 2021 - Martin Pluskal + +- Update to version 0.353 (bsc#1192587): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Oct 6 08:41:39 UTC 2021 - Martin Pluskal + +- Update to version 0.352 (bsc#1191375): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Sep 2 06:17:11 UTC 2021 - Martin Pluskal + +- Update to version 0.351 (bsc#1190091): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Aug 3 07:37:52 UTC 2021 - Martin Pluskal + +- Update to version 0.350 (bsc#1189005): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Jul 8 07:35:35 UTC 2021 - Martin Pluskal + +- Update to version 0.349 (bsc#1187948): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Jun 2 12:22:24 UTC 2021 - Martin Pluskal + +- Update to version 0.348 (bsc#1186749): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu May 6 07:23:04 UTC 2021 - Martin Pluskal + +- Update to version 0.347 (bsc#1185697): + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Apr 6 06:08:13 UTC 2021 - Martin Pluskal + +- Update to version 0.346: + + Updated pci, usb and vendor ids. + + Resolves boo#1182482 jsc#SLE-13791 bnc#1170160 + +------------------------------------------------------------------- +Mon Mar 1 11:03:32 UTC 2021 - Martin Pluskal + +- Update to version 0.345: + + Updated pci, usb and vendor ids. + + Resolves boo#1182482 jsc#SLE-13791 bnc#1170160 + +------------------------------------------------------------------- +Tue Feb 2 09:46:14 UTC 2021 - Martin Pluskal + +- Update to version 0.344: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Jan 7 14:28:17 UTC 2021 - Martin Pluskal + +- Add merge-pciids.pl to fully duplicate behavior of pciutils-ids + * Resolves SLE issue bsc#1180422 bsc#1180482 + +------------------------------------------------------------------- +Wed Jan 6 08:13:18 UTC 2021 - Martin Pluskal + +- Update to version 0.343: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Mon Dec 7 08:49:16 UTC 2020 - Martin Pluskal + +- Update to version 0.342: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Nov 5 08:13:13 UTC 2020 - Martin Pluskal + +- Update to version 0.341: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Oct 8 12:36:57 UTC 2020 - Martin Pluskal + +- Update to version 0.340: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Mon Sep 14 11:30:55 UTC 2020 - Martin Pluskal + +- Update to version 0.339: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Aug 11 13:05:07 UTC 2020 - Martin Pluskal + +- Update to version 0.338: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Jul 16 09:16:26 UTC 2020 - Martin Pluskal + +- Update to version 0.337: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Jun 2 07:50:36 UTC 2020 - Dominique Leuenberger + +- Update to version 0.336: + + Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed May 6 10:47:16 UTC 2020 - Martin Pluskal + +- Update to version 0.335: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Apr 22 13:31:12 UTC 2020 - Martin Pluskal + +- Fix previous changelog entries + +------------------------------------------------------------------- +Tue Apr 7 05:25:54 UTC 2020 - Martin Pluskal + +- Update to version 0.334 (bsc#1168806): + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Mar 3 11:33:42 UTC 2020 - Martin Pluskal + +- Update to version 0.333: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Mon Feb 3 11:42:34 UTC 2020 - Martin Pluskal + +- Update to version 0.332: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Jan 7 09:16:56 UTC 2020 - Martin Pluskal + +- Update to version 0.331: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Mon Dec 2 12:07:25 UTC 2019 - Martin Pluskal + +- Update to version 0.330: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Nov 5 08:19:11 UTC 2019 - Martin Pluskal + +- Update to version 0.329: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Oct 16 15:58:15 UTC 2019 - Martin Pluskal + +- Update to version 0.328: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Aug 13 08:00:46 UTC 2019 - Martin Pluskal + +- Update to version 0.326: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Jul 10 07:16:32 UTC 2019 - Martin Pluskal + +- Update to version 0.325: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Jun 12 07:30:16 UTC 2019 - Martin Pluskal + +- Update to version 0.324: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Fri May 3 11:54:18 UTC 2019 - Martin Pluskal + +- Update to version 0.323: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Apr 16 16:25:35 UTC 2019 - Martin Pluskal + +- Update to version 0.322: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Fri Mar 29 08:51:05 UTC 2019 - Martin Pluskal + +- Update to version 0.321: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Feb 14 16:07:45 UTC 2019 - Martin Pluskal + +- Replace pciutils-ids package + * Provide compat symlink + +------------------------------------------------------------------- +Tue Feb 12 09:48:42 UTC 2019 - Martin Pluskal + +- Update to version 0.320 (bsc#1121410): + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Jan 10 09:19:53 UTC 2019 - Martin Pluskal + +- Update to version 0.319: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Fri Dec 14 14:47:45 UTC 2018 - Martin Pluskal + +- Update to version 0.318: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Sep 26 14:03:20 UTC 2018 - Martin Pluskal + +- Update to version 0.315: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Aug 30 06:42:36 UTC 2018 - Martin Pluskal + +- Update to version 0.314: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Mon Jul 9 12:47:10 UTC 2018 - mpluskal@suse.com + +- Update to version 0.313: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed May 9 11:01:29 UTC 2018 - mpluskal@suse.com + +- Update to version 0.312: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Tue Apr 3 13:20:01 UTC 2018 - mpluskal@suse.com + +- Update to version 0.311: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Thu Mar 8 09:04:52 UTC 2018 - mpluskal@suse.com + +- Update to version 0.310: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Fri Jan 5 12:51:07 UTC 2018 - mpluskal@suse.com + +- Update to version 0.308: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Wed Dec 6 16:24:25 UTC 2017 - mpluskal@suse.com + +- Update to version 0.307: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Fri Nov 3 15:29:39 UTC 2017 - mpluskal@suse.com + +- Update to version 0.306: + * Updated pci, usb and vendor ids. + +------------------------------------------------------------------- +Mon Oct 2 10:39:25 UTC 2017 - mpluskal@suse.com + +- Update to version 0.305 + +------------------------------------------------------------------- +Fri Sep 8 12:58:20 UTC 2017 - mpluskal@suse.com + +- Update to version 0.304 + +------------------------------------------------------------------- +Wed Aug 2 08:26:35 UTC 2017 - mpluskal@suse.com + +- Update to version 0.303 + +------------------------------------------------------------------- +Tue Jul 11 13:07:28 UTC 2017 - mpluskal@suse.com + +- Update to version 0.302 + +------------------------------------------------------------------- +Mon Jun 12 12:48:13 UTC 2017 - mpluskal@suse.com + +- Update to version 0.301 + +------------------------------------------------------------------- +Wed May 10 11:52:25 UTC 2017 - mpluskal@suse.com + +- Update to version 0.300 (boo#1038809) + +------------------------------------------------------------------- +Sat Apr 15 18:32:08 UTC 2017 - mpluskal@suse.com + +- Update to version 0.299 +- Update project and download urls +- Cleanup spec file with spec-cleaner + +------------------------------------------------------------------- +Mon Sep 28 12:26:29 CEST 2015 - mc@suse.de + +- version 0.282 +- updated pci, usb and vendor ids + +------------------------------------------------------------------- +Sat Sep 13 15:26:28 CEST 2014 - mc@suse.de + +- version 0.269 +- updated pci, usb and vendor ids + +------------------------------------------------------------------- +Sat Jul 12 09:51:18 UTC 2014 - mc@suse.com + +- update to version 0.267 +- updated pci, usb and vendor ids + +------------------------------------------------------------------- +Sat Jan 18 17:33:07 UTC 2014 - mc@suse.com + +- update to version 0.258 +- updated pci and oui ids +- remove blacklist.conf + +------------------------------------------------------------------- +Sat Jan 18 11:47:47 CET 2014 - mc@suse.de + +- initial release + diff --git a/hwdata.spec b/hwdata.spec new file mode 100644 index 0000000..711e9d5 --- /dev/null +++ b/hwdata.spec @@ -0,0 +1,84 @@ +# +# spec file for package hwdata +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: hwdata +Version: 0.391 +Release: 0 +Summary: Hardware identification and configuration data +License: GPL-2.0-or-later +URL: https://github.com/vcrhonek/hwdata +Source0: https://github.com/vcrhonek/hwdata/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Source1: merge-pciids.pl +Requires(post): coreutils +Requires(post): perl +Conflicts: pciutils-ids +Provides: pciutils-ids = 20200529 +Obsoletes: pciutils-ids < 20200529 +BuildArch: noarch + +%description +hwdata contains various hardware identification and configuration data, +such as the pci.ids and usb.ids databases. + +%prep +%autosetup + +%build +%configure +# nothing to build + +%install +%make_install + +# create symlink for smooth transition from pciutils-ids package +mkdir %{buildroot}%{_datadir}/pci.ids.d +ln -s %{_datadir}/hwdata/pci.ids \ + %{buildroot}%{_datadir}/pci.ids.d/pci.ids.dist + +install -Dpm 0755 %{SOURCE1} \ + %{buildroot}%{_bindir}/merge-pciids +install -Dpm 0644 /dev/null \ + %{buildroot}%{_datadir}/pci.ids + +# not needed at all +rm -rf %{buildroot}/%{_libdir}/modprobe.d + +%post +if [ -x %{_bindir}/merge-pciids -a -x %{_bindir}/perl ]; then + %{_bindir}/merge-pciids +else + # This should only happen in autobuild + echo "WARNING: merge-pciids or perl not found" + cp -p %{_datadir}/pci.ids.d/pci.ids.dist %{_datadir}/pci.ids +fi + +%files +%license LICENSE COPYING +%{_bindir}/merge-pciids +%{_datadir}/pkgconfig/hwdata.pc +%dir %{_datadir}/%{name} +%{_datadir}/hwdata/iab.txt +%{_datadir}/hwdata/oui.txt +%{_datadir}/hwdata/pci.ids +%{_datadir}/hwdata/pnp.ids +%{_datadir}/hwdata/usb.ids +%dir %{_datadir}/pci.ids.d +%{_datadir}/pci.ids.d/pci.ids.dist +%ghost %{_datadir}/pci.ids + +%changelog diff --git a/merge-pciids.pl b/merge-pciids.pl new file mode 100644 index 0000000..85ba615 --- /dev/null +++ b/merge-pciids.pl @@ -0,0 +1,111 @@ +#!/usr/bin/perl -w +# Merge several PCI ID lists to a single one. This script tries to be as agnostic +# of the details of the ID list as possible, so it should not break with future +# changes of the ID list format as long as they follow the same block structure. +# +# Options: +# -v: Verbose mode. Warn if multiple files provide different definitions for +# the same device. +# +# (c) 2007 Martin Mares , GPLv2 +# (c) 2013, 2015 Jean Delvare + +use strict; +use Getopt::Std; +use File::Copy; +use vars qw($IDSD_PATH $MASTER_IDS $PCI_IDS @idsd_files $output); + +$IDSD_PATH = "/usr/share/pci.ids.d"; +$MASTER_IDS = "/usr/share/pci.ids.d/pci.ids.dist"; +$PCI_IDS = "/usr/share/pci.ids"; + +our $opt_v; +getopts('v'); + +if (! -f $MASTER_IDS) { + print STDERR "ERROR: $MASTER_IDS not found, giving up\n"; + exit 1; +} + +sub collect_files($) +{ + my ($dir) = @_; + my ($file, @files); + + opendir(my $dh, $dir) || die "Could not open directory $dir: $!"; + # Ignore non-files and hidden files + while (defined ($file = readdir($dh))) { + push @files, "$dir/$file" if $file !~ m/^\./ && -f "$dir/$file"; + } + closedir($dh); + + return @files; +} + +my %ids = (); +my %comments = (); +@idsd_files = collect_files($IDSD_PATH); +foreach our $file (@idsd_files) { + my $fn = ($file =~ /\.gz$/) ? "zcat $file |" : ($file =~ /\.bz2$/) ? "bzcat $file |" : $file; + open F, $fn or die "Unable to open $file: $!"; + my @id = (); + my $comm = ""; + my $class = 0; + sub err($) { + print STDERR "Error in $file, line $.: @_\n"; + # If merging fails for whatever reason, fallback to master file copy + print STDERR "WARNING: Merge not successful, using master pci.ids file\n"; + copy($MASTER_IDS, $PCI_IDS) || die "Could not copy $MASTER_IDS to $PCI_IDS: $!"; + chmod(0644, "$PCI_IDS"); + exit 1; + } + while () { + if (/^(#.*|\s*$)/) { + $comm .= $_; + next; + } + chomp; + if (/^(\t|C\s+|)([0-9a-fA-F]+)\s+(.*)$/ || + (!$class && /^(\t\t)([0-9a-fA-F]+\s+[0-9a-fA-F]+)\s+(.*)$/) || + ($class && /^(\t\t)([0-9a-fA-F]+)\s+(.*)$/)) { + my $indent = $1; + my $id = lc($2); + my $name = $3; + if ($indent =~ /^C\s+$/) { + $indent = ""; + $id = "C $id"; + } + my $depth = length $indent; + $depth <= @id or err "Mismatched indentation"; + @id = (@id[0..$depth-1], $id); + $class = ($id =~ /^C\s/) if !$depth; # Remember if we are in a vendor or a class section + my $i = join(":", @id); + my $j = $class ? "~$i" : $i; # We want to sort special entries last + if ($opt_v && exists $ids{$j} && $ids{$j} ne $name) { + print STDERR "Warning: ID $i has two different definitions, using the one from $file\n"; + } + $ids{$j} = $name; + $comments{$j} = $comm if $comm; + } else { + err "Parse error"; + } + $comm = ""; + } + close F; +} + +# Write to a temporary file to avoid a race condition with lspci +open($output, ">", "$PCI_IDS.part") || die "Could not write to $PCI_IDS.part: $!"; +print $output "# This file has been merged automatically from the following files:\n#\t", join("\n#\t", @idsd_files), "\n\n"; +foreach my $id (sort keys %ids) { + my ($i, $j) = ($id, $id); + $i =~ s/[^:]//g; + $i =~ tr/:/\t/; + $j =~ s/.*://g; + $j =~ s/^~//; + print $output $comments{$id} if $comments{$id}; + print $output "$i$j $ids{$id}\n"; +} +close($output); +rename("$PCI_IDS.part", "$PCI_IDS") || die "Could not rename $PCI_IDS.part to $PCI_IDS: $!"; +chmod(0644, "$PCI_IDS");