How about retry if get empty pci id.

For example:
lspci -nn | grep " VGA.*Gen .* Graphics" -i  | grep "\[8086:.*\]" -o | awk -F : 
'{print $2}' | awk -F ] '{print $1}'
if [ -z "$1" ]; then 
  lspci -nn | grep " VGA.*Intel .* Graphics" -i  | grep "\[8086:.*\]" -o | awk 
-F : '{print $2}' | awk -F ] '{print $1}'
fi
if [ -z "$1" ]; then 
  lspci -nn | grep " VGA.* Graphics.*8086" -i  | grep "\[8086:.*\]" -o | awk -F 
: '{print $2}' | awk -F ] '{print $1}'
fi
-----Original Message-----
From: Beignet [mailto:[email protected]] On Behalf Of He 
Junyan
Sent: Friday, May 23, 2014 11:14 PM
To: Gong, Zhigang
Cc: Zhigang Gong; [email protected]
Subject: Re: [Beignet] [PATCH V2] gbe_bin_generater: fix two bugs.

Some PCI ID do not have Gen keyword, such as ruiling's  IVBridge XXXXXX So need 
to refine the command line

On Fri, 2014-05-23 at 19:04 +0800, Zhigang Gong wrote:
> From: Zhigang Gong <[email protected]>
> 
> The pci id detecting method is broken on some system.
> And the gen pci id parsing in gbe_bin_generater is incorrect when the 
> pci id has a-f hex digit.
> 
> v2:
> Add VGA to filter out some nonVGA devices.
> Signed-off-by: Zhigang Gong <[email protected]>
> ---
>  backend/src/gbe_bin_generater.cpp | 7 +++++--
>  src/GetGenID.sh                   | 2 +-
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/backend/src/gbe_bin_generater.cpp 
> b/backend/src/gbe_bin_generater.cpp
> index 50020b5..898e2f2 100644
> --- a/backend/src/gbe_bin_generater.cpp
> +++ b/backend/src/gbe_bin_generater.cpp
> @@ -34,6 +34,7 @@
>  #include <vector>
>  #include <algorithm>
>  #include <stdlib.h>
> +#include <iostream>
>  #include <stdio.h>
>  
>  #include "backend/program.h"
> @@ -46,7 +47,7 @@ using namespace std;  #define FILE_BUILD_FAILED 3  
> #define FILE_SERIALIZATION_FAILED 4
>  
> -static int gen_pci_id = 0;
> +static uint32_t gen_pci_id = 0;
>  
>  class program_build_instance {
>  
> @@ -296,7 +297,9 @@ int main (int argc, const char **argv)
>                  return 1;
>              }
>  
> -            gen_pci_id = (s[0] - '0') << 12 | (s[1] - '0') << 8 | (s[2] - 
> '0') << 4 | (s[3] - '0');
> +            std::stringstream str(s);
> +            str >> std::hex >> gen_pci_id;
> +
>              used_index[optind-1] = 1;
>              // We must set the image base index here, as we invoke the 
> backend in a non-standard way.
>              gbe_set_image_base_index(3); diff --git a/src/GetGenID.sh 
> b/src/GetGenID.sh index 3114bd8..f8cb0a7 100755
> --- a/src/GetGenID.sh
> +++ b/src/GetGenID.sh
> @@ -1,2 +1,2 @@
>  #!/bin/bash
> -lspci -nn | grep "Gen .* Graphics" -i  | grep "\[8086:.*\]" -o | awk -F : 
> '{print $2}' | awk -F ] '{print $1}'
> +lspci -nn | grep "VGA.*Gen.*\[8086:" -i  | grep "\[8086:.*\]" -o | awk -F : 
> '{print $2}' | awk -F ] '{print $1}'



_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to