File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ set -e -u
33
44SCRIPTNAME=termux-usb
55show_usage () {
6- echo " Usage: $SCRIPTNAME [-l | [-r] [-E] [-e command] [device]"
6+ echo " Usage: $SCRIPTNAME [-l | [-r] [-E] [-e command] [device | vendorId productId] ]"
77 echo " List or access USB devices. Devices cannot be accessed directly,"
88 echo " only using $SCRIPTNAME ."
99 echo " -l list available devices"
@@ -35,9 +35,20 @@ if [ "$ACTION" == "list" ]
3535then
3636 if [ $# -gt 0 ]; then echo " $SCRIPTNAME : too many arguments" ; exit 1; fi
3737else
38- if [ $# -gt 1 ]; then echo " $SCRIPTNAME : too many arguments" ; exit 1; fi
39- if [ $# -lt 1 ]; then echo " $SCRIPTNAME : missing -l or device path" ; exit 1; fi
40- PARAMS=" $PARAMS --es device $1 "
38+ if [ $# -lt 1 ]; then
39+ echo " $SCRIPTNAME : missing -l or device path"
40+ exit 1
41+ elif [ $# -eq 1 ]; then
42+ # The device's usbfs path has been provided
43+ PARAMS=" $PARAMS --es device $1 "
44+ elif [ $# -eq 2 ]; then
45+ # A vendorId and ProductId of the device has been provided
46+ PARAMS=" $PARAMS --es vendorId $1 "
47+ PARAMS=" $PARAMS --es productId $2 "
48+ else
49+ echo " $SCRIPTNAME : too many arguments"
50+ exit 1
51+ fi
4152fi
4253
4354CMD=" @TERMUX_PREFIX@/libexec/termux-api Usb -a $ACTION $PARAMS "
You can’t perform that action at this time.
0 commit comments