summaryrefslogtreecommitdiff
path: root/x11-misc/bumblebee/files/bbswitch-setup
blob: ab00ae03c0e4591e726390cd81450ba2d64956b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/sbin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

start() {
	# workaround the fact that udev may have loaded nvidia or nouveau
	# and bbswitch refuses to turn off the card.
	ebegin "Setting up bbswitch"
	# make sure that the nvidia and nouveau modules are
	# removed, then reload bbswitch.
	for mod in nvidia nvidia_drm nvidia_modeset nouveau; do
		modprobe -r ${mod} 2> /dev/null  # best effort
	done
	# reload bbswitch now
	modprobe -r bbswitch
	modprobe bbswitch  # this inherits the options
	eend 0
}