Skip to content

Commit

Permalink
Update enable-gadget.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
InnerCalmer committed Jun 14, 2023
1 parent 429ee20 commit d875dac
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions package/kvmd-hid/enable-gadget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,21 @@ mkdir -p "$USB_MASS_STORAGE_FUNCTIONS_DIR"

if [ -d "$USB_MSD_DIR" ]
then
if [ -f "$USB_MSD_DIR/ventoy.img" ]
then
#echo "/var/sdcard/disk.img" > functions/mass_storage.0/lun.0/file
echo "$USB_MSD_DIR/ventoy.img" > "${USB_MASS_STORAGE_FUNCTIONS_DIR}/lun.0/file"

echo 1 > "${USB_MASS_STORAGE_FUNCTIONS_DIR}/lun.0/removable"
echo 0 > "${USB_MASS_STORAGE_FUNCTIONS_DIR}/lun.0/nofua"
#echo 0 > functions/mass_storage.0/lun.0/ro
#echo 1 > functions/mass_storage.0/lun.0/cdrom
#echo 0 > functions/mass_storage.0/stall
fi
for file in $USB_MSD_DIR/*.img
do
if [[ $file == *.img ]]
then
MSD_FILE=$file
echo "$USB_MSD_DIR/$file" > "${USB_MASS_STORAGE_FUNCTIONS_DIR}/lun.0/file"
echo 1 > "${USB_MASS_STORAGE_FUNCTIONS_DIR}/lun.0/removable"
echo 0 > "${USB_MASS_STORAGE_FUNCTIONS_DIR}/lun.0/nofua"
#echo 0 > functions/mass_storage.0/lun.0/ro
#echo 1 > functions/mass_storage.0/lun.0/cdrom
#echo 0 > functions/mass_storage.0/stall
break
fi
done

fi


Expand All @@ -177,7 +181,7 @@ ln -s "${USB_KEYBOARD_FUNCTIONS_DIR}" "${USB_CONFIG_DIR}/"
ln -s "${USB_MOUSE_FUNCTIONS_DIR}" "${USB_CONFIG_DIR}/"

#config config.1 link
if [ -f "$USB_MSD_DIR/ventoy.img" ]
if [ -f "$USB_MSD_DIR/$MSD_FILE" ]
then
ln -s "${USB_MASS_STORAGE_FUNCTIONS_DIR}" "${USB_CONFIG_DIR}/"
fi
Expand Down

0 comments on commit d875dac

Please sign in to comment.