#!/bin/bash
# -*- coding: utf-8; indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
# vim:fileencodings=utf-8:expandtab:tabstop=4:shiftwidth=4:softtabstop=4

FINDVGA=0
ROOTID=`lspci -x | awk 'BEGIN{ORS=""} NR==4 {print $17 $16};'`
if [ `lspci -x | awk 'BEGIN{ORS=""} NR==7 {print $2}'` == "VGA" ]; then
    let FINDVGA=10
elif [ `lspci -x | awk 'BEGIN{ORS=""} NR==13 {print $2}'` == "VGA" ]; then
    let FINDVGA=16
fi
GPUID=`lspci -x | awk 'BEGIN{ORS=""} NR==N {print $17 $16};' N="${FINDVGA}"`
if [ $FINDVGA == 0 ]; then
    ID=${ROOTID}
else
    ID=${GPUID}
fi
