diff --git a/interface-definitions/interfaces_thunderbolt.xml.in b/interface-definitions/interfaces_thunderbolt.xml.in index 6ffbcceb8c..d6f7dd5ffc 100644 --- a/interface-definitions/interfaces_thunderbolt.xml.in +++ b/interface-definitions/interfaces_thunderbolt.xml.in @@ -39,14 +39,14 @@ PCI device address of the Thunderbolt controller port - 00:0d.2 00:0d.3 + <hh:hh.h> PCI device address of the Thunderbolt controller port - [0-9a-fA-F]{2}:[0-9a-fA-F]{2}.[0-9]+ + diff --git a/src/completion/list_thunderbolt_pci_addresses.sh b/src/completion/list_thunderbolt_pci_addresses.sh new file mode 100644 index 0000000000..a56de0badc --- /dev/null +++ b/src/completion/list_thunderbolt_pci_addresses.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Copyright (C) 2024 VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later as +# published by the Free Software Foundation. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# This script is a completion helper to list all Thunderbolt ports PCI Addresses + +lspci | grep Thunderbolt | grep NHI | cut -d" " -f1 diff --git a/src/validators/thunderbolt-pci-address b/src/validators/thunderbolt-pci-address new file mode 100644 index 0000000000..4334380602 --- /dev/null +++ b/src/validators/thunderbolt-pci-address @@ -0,0 +1,23 @@ +#!/bin/bash +# +# Copyright (C) 2021 VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later as +# published by the Free Software Foundation. +# +# 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. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +for address in $(lspci | grep Thunderbolt | grep NHI | cut -d" " -f1); do + if [ "$address" == "$1" ]; then + exit 0 + fi +done + +exit 1