From 650cf848d8148ff286ffdc5f37c4f92cb6902771 Mon Sep 17 00:00:00 2001 From: Junyan He Date: Mon, 26 May 2014 23:57:32 +0800 Subject: [PATCH] Refine pci id detecting. Some platforms do not have key word "Gen" or "Graphic" when run the lspci command. So we failed to get the pci id in such cases. We now just use the 8086 key word and get the sub pci id, and compare it to all the gen known gen pci ids. This can be safe in all platforms. Signed-off-by: Junyan He Signed-off-by: Zhigang Gong --- backend/src/gbe_bin_generater.cpp | 1 - src/GetGenID.sh | 26 +++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/backend/src/gbe_bin_generater.cpp b/backend/src/gbe_bin_generater.cpp index 898e2f2..dce0792 100644 --- a/backend/src/gbe_bin_generater.cpp +++ b/backend/src/gbe_bin_generater.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include "backend/program.h" diff --git a/src/GetGenID.sh b/src/GetGenID.sh index f8cb0a7..ee7fe5c 100755 --- a/src/GetGenID.sh +++ b/src/GetGenID.sh @@ -1,2 +1,26 @@ #!/bin/bash -lspci -nn | grep "VGA.*Gen.*\[8086:" -i | grep "\[8086:.*\]" -o | awk -F : '{print $2}' | awk -F ] '{print $1}' +genpciid=(0152 0162 0156 0166 015a 0f31 0402 0412 0422 040a 041a 042a 0406 0416 0426 0c02 0c12 0c22 0c0a 0c1a 0c2a 0c06 0c16 0c26 0a02 0a12 0a22 0a0a 0a1a 0a2a 0a06 0a16 0a26 0d02 0d12 0d22 0d0a 0d1a 0d2a 0d06 0d16 0d26) +pciid=($(lspci -nn | grep "\[8086:.*\]" -o | awk -F : '{print $2}' | awk -F ] '{print $1}')) +n=${#pciid[*]} +i=0 +m=${#genpciid[*]} +j=0 +while [ $i -lt $n ] +do + id1=${pciid[$i]} + let j=0 + + while [ $j -lt $m ] + do + id2=${genpciid[$j]} + + if [ ${id1} == ${id2} ] + then + echo ${id1} + exit 0 + fi + let j=j+1 + done + + let i=i+1 +done -- 2.7.4