aboutsummaryrefslogtreecommitdiff
path: root/usb-status
diff options
context:
space:
mode:
Diffstat (limited to 'usb-status')
-rwxr-xr-xusb-status17
1 files changed, 17 insertions, 0 deletions
diff --git a/usb-status b/usb-status
new file mode 100755
index 0000000..cc4525e
--- /dev/null
+++ b/usb-status
@@ -0,0 +1,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