function get_device_ids
{
typeset link=$1 driver_name dev_id try_dev_id tmp_file
tmp_file=/tmp/prtconf.tmp
prtconf -v > $tmp_file
driver_name=$(get_drivername $link)
cat /etc/driver_aliases | grep -w $driver_name | \
awk '{print $2}' | sed 's/"//g' | while read try_dev_id; do
grep -w $try_dev_id $tmp_file > /dev/null 2>&1 && \
echo $try_dev_id
done
rm -f $tmp_file
}
function get_drivername
{
typeset link=$1
[[ -z $link ]] && return
ifconfig $link > /dev/null 2>&1 || return
dladm 2>&1 | grep rename-link > /dev/null
if (( $? == 0 )); then
dladm show-phys $link -o DEVICE | sed '1d' | sed 's/[0-9]*$//'
else
echo $link | sed 's/[0-9]*$//'
fi
}
# get_device_ids e1000g0
pci8086,100e
阅读(1369) | 评论(0) | 转发(0) |