aboutsummaryrefslogtreecommitdiff
path: root/usb-enable
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-07-02 12:02:10 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-07-02 12:02:10 -0300
commit245914ce083785cc72b1c0b63309e743cf1ddd52 (patch)
tree1d7d2daf8bfafb14f30173de11a9d4b5b2d1c940 /usb-enable
downloadbadusb-switcher-245914ce083785cc72b1c0b63309e743cf1ddd52.tar.gz
badusb-switcher-245914ce083785cc72b1c0b63309e743cf1ddd52.tar.bz2
Initial import
Diffstat (limited to 'usb-enable')
-rwxr-xr-xusb-enable17
1 files changed, 17 insertions, 0 deletions
diff --git a/usb-enable b/usb-enable
new file mode 100755
index 0000000..cc4525e
--- /dev/null
+++ b/usb-enable
@@ -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