aboutsummaryrefslogtreecommitdiff
path: root/scripts/hostclass/laptop/20-laptop
diff options
context:
space:
mode:
authorCullum Smith <cullum@sacredheartsc.com>2024-10-18 16:44:57 -0400
committerCullum Smith <cullum@sacredheartsc.com>2024-10-18 16:47:56 -0400
commit5ef2aed3f3961b72699d9881ed09560f4d01371a (patch)
tree0a03131e31f9f2fe5762afab6d99319f742eb9b3 /scripts/hostclass/laptop/20-laptop
parentaa28ec7ef20517e994f01753e8c4e6fdd4d0643c (diff)
downloadinfrastructure-5ef2aed3f3961b72699d9881ed09560f4d01371a.tar.gz
Tons of desktop fixes
Diffstat (limited to 'scripts/hostclass/laptop/20-laptop')
-rw-r--r--scripts/hostclass/laptop/20-laptop65
1 files changed, 65 insertions, 0 deletions
diff --git a/scripts/hostclass/laptop/20-laptop b/scripts/hostclass/laptop/20-laptop
new file mode 100644
index 0000000..dba2c5f
--- /dev/null
+++ b/scripts/hostclass/laptop/20-laptop
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# Enable thinkpad hardware features.
+load_kernel_module acpi_ibm
+set_loader_conf acpi_ibm_load=YES
+
+# Set USB power savings
+usbconfig | awk -F: '{ print $1 }' | xargs -rtn1 -I% usbconfig -d % power_save ||:
+install_file /etc/rc.local
+
+# Create devd rule for lid close.
+install_file -m 0555 /usr/local/libexec/lid-close
+install_file -m 0644 /etc/devd/lid-close.conf
+service devd restart
+
+# Enable kernel module for Android USB tethering.
+load_kernel_module if_urndis
+set_loader_conf if_urndis_load=YES
+sysrc -v ifconfig_ue0='DHCP'
+
+# Install laptop packages.
+pkg install -y networkmgr
+
+# Misc power saving stuff.
+set_loader_conf \
+ vfs.zfs.txg.timeout=10 \
+
+if [ "$graphics_type" = intel ]; then
+ set_loader_conf \
+ compat.linuxkpi.i915_disable_power_well=1 \
+ compat.linuxkpi.i915_enable_dc=2
+fi
+
+case ${wireless_type:-} in
+ iwm*)
+ set_loader_conf \
+ if_iwm_load=YES \
+ "${wireless_type}fw_load=YES"
+
+ load_kernel_module \
+ if_iwm \
+ "${wireless_type}fw"
+
+ sysrc -v wlans_iwm0='wlan0'
+ ;;
+esac
+
+# Enable power saving for sound card.
+set_sysctl hw.snd.latency=7
+
+# Configure wireless card.
+sysrc -v \
+ create_args_wlan0='country US regdomain FCC' \
+ ifconfig_wlan0="WPA DHCP powersave"
+
+# Hardware-specific fixes.
+case ${laptop_type:-} in
+ thinkpad)
+ # Set brightness using function keys.
+ set_sysctl dev.acpi_ibm.0.handlerevents='0x10 0x11'
+ install_file -m 0555 /usr/local/libexec/thinkpad-brightness
+ install_file -m 0644 /etc/devd/thinkpad-brightness.conf
+ service devd restart
+ ;;
+esac