From efa74b0d025d1584c30890421ef0af64980dcb17 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 9 May 2022 16:59:17 +0200 Subject: [PATCH 1/7] debian: add dir for packaging Related: SYS#5538 --- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 14 ++++++++++++++ debian/copyright | 23 +++++++++++++++++++++++ debian/rtl8168-eeprom.install | 1 + debian/rules | 4 ++++ debian/source/format | 1 + 7 files changed, 49 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/rtl8168-eeprom.install create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..f27b8cc --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +rtl8168-eeprom (1.0.0) unstable; urgency=medium + + * Initial debian packaging. + + -- Oliver Smith Mon, 09 May 2022 16:28:19 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..ffcadca --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: rtl8168-eeprom +Section: devel +Priority: optional +Maintainer: Oliver Smith +Standards-Version: 4.5.0 +Build-Depends: debhelper (>= 10), + gcc, + libpci-dev, + pkg-config +Homepage: https://gitea.sysmocom.de/sysmocom/rtl8168-eeprom + +Package: rtl8168-eeprom +Architecture: any +Description: Tool to set MAC address in EEPROM of RTL8168/8111E devices diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..a2b0e3d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,23 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: rtl8168-eeprom + +Files: * +Copyright: Copyright 2015 Harald Welte +License: GPL-2+ + +License: GPL-2+ + This program is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later + version. + . + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more + details. + . + On Debian systems, the full text of the GNU General Public + License version 2 can be found in the file + `/usr/share/common-licenses/GPL-2'. diff --git a/debian/rtl8168-eeprom.install b/debian/rtl8168-eeprom.install new file mode 100644 index 0000000..5018571 --- /dev/null +++ b/debian/rtl8168-eeprom.install @@ -0,0 +1 @@ +/rtl8168-eeprom /usr/bin/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..2d33f6a --- /dev/null +++ b/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) From 189a39639d50cba600db10b93cbe71519c78f9b4 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 10 May 2022 14:56:47 +0200 Subject: [PATCH 2/7] gitignore: new file --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a152530 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/rtl8168-eeprom +/rtl8168-eeprom.o From 1bf48da7a8dfa32ebaf637e62db847106673df9d Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 16 May 2022 10:36:50 +0200 Subject: [PATCH 3/7] Fix missing pci_fill_info() Before reading vendor_id or device_id from struct pci_dev, one must call pci_fill_info() first. It looks like this had worked with previous libpci versions, but with libpci 3.7.0 on debian 11 this patch is needed or else the tool stops at 'starting bus iteration' without finding the device. Fixes: SYS#5956 --- rtl8168-eeprom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/rtl8168-eeprom.c b/rtl8168-eeprom.c index 19cae0d..ae10a0a 100644 --- a/rtl8168-eeprom.c +++ b/rtl8168-eeprom.c @@ -466,6 +466,7 @@ static void iterate_devices(struct pci_access *pa, char *filter_id, char *filter continue; /* our own clumsy implementation of filtering */ + pci_fill_info(p, PCI_FILL_IDENT); if (p->vendor_id != 0x10ec || p->device_id != 0x8168) continue; From 313de8d95e9d6afd96715c024174602cc893b07c Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 16 May 2022 10:45:22 +0200 Subject: [PATCH 4/7] Exit with error if no device was found --- rtl8168-eeprom.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rtl8168-eeprom.c b/rtl8168-eeprom.c index ae10a0a..771350f 100644 --- a/rtl8168-eeprom.c +++ b/rtl8168-eeprom.c @@ -498,6 +498,8 @@ static void iterate_devices(struct pci_access *pa, char *filter_id, char *filter if (new_mac) exit(0); } + + die("no matching device found!\n"); } int main(int argc, char **argv) From 347924cc088f993a3123aed3cf22ec691700f305 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 16 May 2022 10:50:40 +0200 Subject: [PATCH 5/7] d/changelog: add 1.0.1 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index f27b8cc..c146c16 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +rtl8168-eeprom (1.0.1) unstable; urgency=medium + + * Fix missing pci_fill_info() + * Exit with error if no device was found + + -- Oliver Smith Mon, 16 May 2022 10:49:48 +0200 + rtl8168-eeprom (1.0.0) unstable; urgency=medium * Initial debian packaging. From 4efcedfeca53f4dded24a9f43f20898eb00f53aa Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 16 May 2022 14:03:10 +0200 Subject: [PATCH 6/7] Query PCI_FILL_{BASES,SIZES} in pci_fill_info too The previous fix for missing pci_fill_info() was incomplete, it caused the device to be found but changing the mac did not succeed. Fix it up as separate commit, as the other commit is already packaged. --- rtl8168-eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtl8168-eeprom.c b/rtl8168-eeprom.c index 771350f..6c85fbb 100644 --- a/rtl8168-eeprom.c +++ b/rtl8168-eeprom.c @@ -466,7 +466,7 @@ static void iterate_devices(struct pci_access *pa, char *filter_id, char *filter continue; /* our own clumsy implementation of filtering */ - pci_fill_info(p, PCI_FILL_IDENT); + pci_fill_info(p, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_SIZES); if (p->vendor_id != 0x10ec || p->device_id != 0x8168) continue; From 630734375f32b7929abb796b852f7b31442d9615 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Mon, 16 May 2022 14:05:28 +0200 Subject: [PATCH 7/7] d/changelog: add 1.0.2 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index c146c16..de9b0c0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +rtl8168-eeprom (1.0.2) unstable; urgency=medium + + * Query PCI_FILL_{BASES,SIZES} in pci_fill_info too + + -- Oliver Smith Mon, 16 May 2022 14:05:15 +0200 + rtl8168-eeprom (1.0.1) unstable; urgency=medium * Fix missing pci_fill_info()