Skip to content

Commit 8bbdbd1

Browse files
committed
Proper way to disable function
1 parent 4e02f10 commit 8bbdbd1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/radxa-otgutils

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ function_stop()
6464
then
6565
rm "/sys/kernel/config/usb_gadget/radxa-otgutils/configs/r.1/$GADGET"
6666
fi
67+
68+
if [ -e "/sys/kernel/config/usb_gadget/radxa-otgutils/functions/$GADGET" ];
69+
then
70+
rmdir "/sys/kernel/config/usb_gadget/radxa-otgutils/functions/$GADGET"
71+
fi
6772
}
6873

6974
start()
@@ -97,11 +102,7 @@ start()
97102
stop()
98103
{
99104
function_stop
100-
if [[ ! -e "/sys/kernel/config/usb_gadget/radxa-otgutils/configs/r.1/" ]] || \
101-
(( $(find /sys/kernel/config/usb_gadget/radxa-otgutils/configs/r.1/* -maxdepth 0 -type l | wc -l) == 0 ))
102-
then
103-
echo "none" > "/sys/kernel/config/usb_gadget/radxa-otgutils/UDC"
104-
fi
105+
105106
case "$MODE" in
106107
adbd)
107108
start-stop-daemon --stop --oknodo --pidfile /var/run/adbd.pid --retry 5

0 commit comments

Comments
 (0)