aboutsummaryrefslogtreecommitdiff
path: root/x200-my.initd
blob: 8edefd634a1016bb22e8127e56cc6ec043e98360 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/sbin/openrc-run
# Copyright 2018 Robert Alessi
# Distributed under the terms of the GNU General Public License v2

description="Removes whining noise from Thinkpads X200 and powers off the wifi on shutdown."

command="/usr/bin/intel_reg"
pwmfreq="${PWMFREQ_RATE}"

command_args="write 0x00061254 $pwmfreq"

start() {
    if [ "${RC_CMD}" = "restart" ];
    then
      /usr/bin/nmcli radio all off
    fi
    
    exec $command $command_args 2>/dev/null
}

stop() {
    /usr/bin/nmcli radio all off
}