setup.sh: use ~ to compare device/vendor IDs and class codes

Device IDs starting with 0e get treated as 0 due to numerical
interpretation (0 * 10^x = 0).  So use ~ to do a string regexp
comparison instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4b5558c0127b0c4f021daf8151bf4d3f514e44da

Reviewed-on: https://review.gerrithub.io/374507
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Jim Harris 2017-08-16 09:11:25 -07:00 committed by Daniel Verkamp
parent 23b89186bc
commit c98e507e9f

View File

@ -6,13 +6,13 @@ rootdir=$(readlink -f $(dirname $0))/..
function linux_iter_pci_class_code {
# Argument is the class code
lspci -mm -n -D | tr -d '"' | awk -v cc="$1" -F " " '{if (cc == $2) print $1}'
lspci -mm -n -D | tr -d '"' | awk -v cc="$1" -F " " '{if (cc ~ $2) print $1}'
}
function linux_iter_pci_dev_id {
# Argument 1 is the vendor id
# Argument 2 is the device id
lspci -mm -n -D | tr -d '"' | awk -v ven="$1" -v dev="$2" -F " " '{if (ven == $3 && dev == $4) print $1}'
lspci -mm -n -D | tr -d '"' | awk -v ven="$1" -v dev="$2" -F " " '{if (ven ~ $3 && dev ~ $4) print $1}'
}
function linux_bind_driver() {