-
Notifications
You must be signed in to change notification settings - Fork 18
/
usb-customizations.sh
54 lines (37 loc) · 1.79 KB
/
usb-customizations.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# pi-ap: These scripts configure a Raspberry Pi into a wireless Access Point
# Source: https://github.com/f1linux/pi-ap
# Version: 01.10.02
# License: GPL 3.0
# Script Author: Terrence Houlahan Linux & Network Engineer
# Contact: [email protected]
# Linkedin: www.linkedin.com/in/terrencehoulahan
# Do not edit below sources
source "${BASH_SOURCE%/*}/variables.sh"
source "${BASH_SOURCE%/*}/functions.sh"
# USB Autosuspend is a power management feature to preserve battery life.
# This host has no battery and further Autosuspend only works where the devices driver supports the feature.
# So only a downside to retaining default preference of "enable":
#
# Raspbian does not use Grub so this is a placeholder to be dealt with later
cat <<EOF> $PATHSCRIPTS/usb-autosuspend-disable.sh
#set -x
# Version: 01.08.00
# Script Author: Terrence Houlahan
# Contact: [email protected]
# USB autosuspend:
# This feature is targeted towards extending battery-life by powering-down interfaces not in active use.
# However unless the devices driver supports this functionality it can cause problems.
# Default value for autosuspend is "2" (enabled).
#
# Since this device is NOT battery powered there is only a down-side to keeping autosuspend enabled we disable it:
# WARNING #1: Do NOT delete trailing space after the "1" before the closing encasing forward slash in sed expression
# WARNING #2: Only a single DOUBLE-QUOTE mark is used in below SED expression- THIS IS NOT AN ERROR OR OMMISSION
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="/&usbcore.autosuspend=-1 /' /etc/default/grub
update-grub
EOF
mv $PATHSCRIPTS/usb-autosuspend-disable.sh /root/$PATHSCRIPTSROOT/
chmod 700 /root/$PATHSCRIPTSROOT/usb-autosuspend-disable.sh
echo
echo "USB Autosuspend Disabled:"
echo