Skip to content

Instantly share code, notes, and snippets.

@sora
Created July 25, 2017 12:17
Show Gist options
  • Save sora/4b6b5dd1d90c81b211cb47bcd29334a5 to your computer and use it in GitHub Desktop.
Save sora/4b6b5dd1d90c81b211cb47bcd29334a5 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
set -eu
Path=/sys/bus/pci/devices
DevList=`ls /sys/bus/pci/devices/`
Vender_id="0x8086"
Device_id="0x1563" # Intel x550
for devno in ${DevList}; do
venid=`cat ${Path}/${devno}/vendor`
devid=`cat ${Path}/${devno}/device`
if [ ${venid} = ${Vender_id} ] && [ ${devid} = ${Device_id} ]; then
echo 1 > ${Path}/${devno}/remove
sleep 1
echo 1 > /sys/bus/pci/rescan
echo "Rescan: Success."
exit 1
fi
done
echo "Rescan: Failed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment