Last active
April 25, 2020 19:40
-
-
Save pedropombeiro/42dad23d355a0f53ff0b010112f8a4e2 to your computer and use it in GitHub Desktop.
/lib/systemd/system-sleep/resume-x1-fix.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Makes sure bluetooth service is not running while suspended. | |
if [ "${1}" == "pre" ]; then | |
service bluetooth stop | |
elif [ "${1}" == "post" ]; then | |
service bluetooth start | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euox pipefail | |
IFS=$'\n\t' | |
#VENDOR="17ef" | |
VENDOR="1d6b" | |
#PRODUCT="6047" | |
PRODUCT="0003" | |
for DIR in $(find /sys/bus/usb/devices/ -maxdepth 1 -type l); do | |
if [[ -f $DIR/idVendor && -f $DIR/idProduct && | |
$(cat $DIR/idVendor) == $VENDOR && $(cat $DIR/idProduct) == $PRODUCT ]]; then | |
echo 0 > $DIR/authorized | |
sleep 0.5 | |
echo 1 > $DIR/authorized | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$2" = "suspend" ] || [ "$2" = "resume" ]; then | |
case "$1" in | |
post) | |
# Reset Bluetooth and network service | |
#sudo systemctl restart NetworkManager & \ | |
#/etc/init.d/bluetooth restart | |
/usr/bin/autorandr -cf | |
pulseaudio -k && sudo alsa force-reload | |
gsettings set com.ubuntu.user-interface scale-factor "{'DP-1': 16, 'eDP-1': 8}" | |
/usr/local/bin/reset-lenovo-keyboard.sh | |
# Reconnecting dead trackpad | |
echo -n "none" | sudo tee /sys/bus/serio/devices/serio1/drvctl | |
echo -n "reconnect" | sudo tee /sys/bus/serio/devices/serio1/drvctl | |
#sleep 1 | |
# Disable trackpad middle button | |
#xinput set-button-map 'Synaptics TM3288-011' 1 1 3 4 5 6 7 >/dev/null | |
#xinput set-button-map 'TPPS/2 Elan TrackPoint' 1 1 3 4 5 6 7 >/dev/null | |
# Disabling the memory card reader | |
echo "2-3" | sudo tee /sys/bus/usb/drivers/usb/unbind | |
# Reset Yukico | |
echo '1-2'|sudo tee /sys/bus/usb/drivers/usb/unbind | |
sleep 1 | |
echo '1-2'|sudo tee /sys/bus/usb/drivers/usb/bind | |
;; | |
suspend|hibernate) | |
;; | |
esac | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/usr/local/bin/reset-lenovo-keyboard.sh
/lib/systemd/system-sleep/bluetooth-suspend