Skip to content

Commit

Permalink
prime-select.sh: Fix broken PCI BusID parsing on machines with severa…
Browse files Browse the repository at this point in the history
…l domains (issue#88)
  • Loading branch information
sndirsch committed Oct 23, 2022
1 parent d41f334 commit 6f7cf35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions prime-select.sh
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,13 @@ function common_set {
lspci_line=$1
constructor=$2
lowercase_constructor=$(echo $constructor | tr '[A-Z]' '[a-z]')
line=$(lspci | grep "$lspci_line" | head -1)
line=$(lspci -D | grep "$lspci_line" | head -1)
if [ $? -ne 0 ]; then
logging "Failed to find $constructor card with lspci"
exit 1
fi

card_busid=$(echo $line | cut -f 1 -d ' ' | sed -e 's/\./:/g;s/:/ /g' | awk -Wposix '{printf("PCI:%d:%d:%d\n","0x" $1, "0x" $2, "0x" $3 )}')
card_busid=$(echo $line | cut -f 1 -d ' ' | sed -e 's/\./:/g;s/:/ /g' | awk -Wposix '{printf("PCI:%d:%d:%d\n","0x" $2, "0x" $3, "0x" $4 )}')
if [ $? -ne 0 ]; then
logging "Failed to build $constructor card bus id"
exit 1
Expand Down

0 comments on commit 6f7cf35

Please sign in to comment.