Skip to content

Commit 4e02f10

Browse files
committed
Fix function detection
1 parent 17a12ba commit 4e02f10

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/radxa-otgutils

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@ function_init()
3838
;;
3939
esac
4040

41-
if [ ! -e "/sys/kernel/config/usb_gadget/radxa-otgutils/configs/r.1/$GADGET" ];
41+
if [ ! -e "/sys/kernel/config/usb_gadget/radxa-otgutils/functions/$GADGET" ];
4242
then
4343
mkdir -p "/sys/kernel/config/usb_gadget/radxa-otgutils/functions/$GADGET"
44+
fi
45+
46+
if [ ! -e "/sys/kernel/config/usb_gadget/radxa-otgutils/configs/r.1/$GADGET" ];
47+
then
4448
ln -s "/sys/kernel/config/usb_gadget/radxa-otgutils/functions/$GADGET" "/sys/kernel/config/usb_gadget/radxa-otgutils/configs/r.1/$GADGET"
4549
fi
4650
}
@@ -94,7 +98,7 @@ stop()
9498
{
9599
function_stop
96100
if [[ ! -e "/sys/kernel/config/usb_gadget/radxa-otgutils/configs/r.1/" ]] || \
97-
(( $(find /sys/kernel/config/usb_gadget/radxa-otgutils/configs/r.1/* -maxdepth 0 -type d | wc -l) == 0 ))
101+
(( $(find /sys/kernel/config/usb_gadget/radxa-otgutils/configs/r.1/* -maxdepth 0 -type l | wc -l) == 0 ))
98102
then
99103
echo "none" > "/sys/kernel/config/usb_gadget/radxa-otgutils/UDC"
100104
fi

0 commit comments

Comments
 (0)