aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-08-09 13:29:10 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-08-09 13:29:10 -0300
commit1acdc47905584d0bc4d7af3f13877a49cdfdd344 (patch)
tree10171c1bbe986698357c75812a088e7a834b4f03
parent9cc4ae694bab02694511c588bd4e68743accf0ed (diff)
downloadbadusb-switcher-1acdc47905584d0bc4d7af3f13877a49cdfdd344.tar.gz
badusb-switcher-1acdc47905584d0bc4d7af3f13877a49cdfdd344.tar.bz2
Handle -1 status code
-rwxr-xr-xusb-disable10
1 files changed, 9 insertions, 1 deletions
diff --git a/usb-disable b/usb-disable
index 5268256..2b87fca 100755
--- a/usb-disable
+++ b/usb-disable
@@ -3,7 +3,7 @@
# USB hotplug switcher.
# See https://links.sarava.org/tags/badusb
# https://www.kernel.org/doc/Documentation/usb/authorization.txt
-#
+# http://marc.info/?l=git-commits-head&m=131166366113680&w=2
# Parameters
BASENAME="`basename $0`"
@@ -27,9 +27,17 @@ elif [ "$BASENAME" == 'usb-disable' ]; then
elif [ "$BASENAME" == 'usb-status' ]; then
status="`cat /sys/module/usbcore/parameters/authorized_default`"
+ # The "authorized_default" module parameter of usbcore controls the default
+ # for the authorized_default variable of each USB host controller.
+ #
+ # -1 is authorized for all devices except wireless (default, old behaviour)
+ # 0 is unauthorized for all devices
+ # 1 is authorized for all devices
if [ "$status" == "0" ]; then
echo "Hotplug disabled."
elif [ "$status" == "1" ]; then
echo "Hotplug enabled."
+ elif [ "$status" == "-1" ]; then
+ echo "Hotplug enabled except wireless"
fi
fi