#!/bin/bash

_check_nvidia_card="$(chwd --is_nvidia_card | grep -q 'NVIDIA card found!'; echo $?)"

if [[ "${_check_nvidia_card}" -eq 0 ]]; then
  echo "NVIDIA CARD FOUND!"
  chwd -a pci nonfree 0300
else
  chwd -a pci free 0300
fi

# Check for hybrid graphics
if [[ $(lspci -d "*:*:0302") ]]; then
  chwd -a pci nonfree 0302
fi

# Check for MacBook T2
if [[ $(lspci -d "*:*:0000") ]]; then
  chwd -a pci free 0000
fi

# Check for network PCI
if [[ $(lspci -d "*:*:0200") ]]; then
  chwd -a pci nonfree 0200
fi

# vim:set ft=bash sw=2 sts=2 et:
