aboutsummaryrefslogtreecommitdiff
path: root/usb-status
blob: cc4525ec0012878f1d4ae87ded58a760fa4b45fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
#
# USB hotplug switcher.
# See https://links.sarava.org/tags/badusb
#

# Parameters
BASENAME="`basename $0`"

# Dispatch
if [ "$BASENAME" == 'usb-enable' ]; then
  sudo su -c "echo '-1' > /sys/module/usbcore/parameters/authorized_default"
elif [ "$BASENAME" == 'usb-disable' ]; then
  sudo su -c "echo '0' > /sys/module/usbcore/parameters/authorized_default"
elif [ "$BASENAME" == 'usb-status' ]; then
  cat /sys/module/usbcore/parameters/authorized_default
fi