Skip to content

Instantly share code, notes, and snippets.

@mmtrt
Last active November 14, 2024 10:49
Show Gist options
  • Save mmtrt/5dfbd2559ea988dfbe56277347ac6c96 to your computer and use it in GitHub Desktop.
Save mmtrt/5dfbd2559ea988dfbe56277347ac6c96 to your computer and use it in GitHub Desktop.
[ROOT] [Magisk] [Service.d] [Script] [Fix] DriveDroid on Android 9+
#!/bin/sh
# run while loop for boot_completed status & sleep 10 needed for magisk service.d
while [ "$(getprop sys.boot_completed | tr -d '\r')" != "1" ]; do sleep 1; done
sleep 10
# save currently active function name
echo "$(ls -al /config/usb_gadget/g1/configs/b.1/)" | grep -Eo f1.* | awk '{print $3}' | cut -d/ -f8 > /data/adb/.fixdd
# loop
# run every 0.5 seconds
while true
do
# check the app is active
chkapp="$(pgrep -f drivedroid | wc -l)"
# check currently active function
chkfn=$(echo "$(ls -al /config/usb_gadget/g1/configs/b.1/)" | grep -Eo f1.* | awk '{print $3}' | cut -d/ -f8)
# load previous active function
chkfrstfn="$(cat /data/adb/.fixdd)"
if [ "$chkapp" -eq "1" ] && [ "$chkfn" != "mass_storage.0" ]; then
# add mass_storage.0 config & function and remove currently active function
rm /config/usb_gadget/g1/configs/b.1/f*
mkdir -p /config/usb_gadget/g1/functions/mass_storage.0/lun.0/
ln -s /config/usb_gadget/g1/functions/mass_storage.0 /config/usb_gadget/g1/configs/b.1/f1
elif [ "$chkapp" -eq "0" ] && [ "$chkfn" = "mass_storage.0" ]; then
# remove mass_storage.0 function & restore previous function
rm /config/usb_gadget/g1/configs/b.1/f*
ln -s /config/usb_gadget/g1/functions/"$chkfrstfn" /config/usb_gadget/g1/configs/b.1/f1
if [ "$chkfrstfn" = "ffs.adb" ]; then
setprop sys.usb.config adb
elif [ "$chkfrstfn" = "ffs.mtp" ]; then
setprop sys.usb.config mtp
fi
fi
sleep 0.5
done
@liwa-dev
Copy link

IT DOESN'T WORK ANYONE HELP ME PLEASE!!!?

@liwa-dev
Copy link

@mmtrt Windows 10 ISO file gives this error: No device drivers were found. Still this error after choosing CD-ROM option to host

IMG_20221027_171354

IMG_20221027_171628

IMG_20221027_180000

SAME ISSUEE I HAVE

@liwa-dev
Copy link

It doesn't really work when i write this on termux
~ $ su -c "curl -sL https://gist.github.com/mmtrt/5dfbd2559ea988dfbe56277347ac6c96/raw/478204e0d0107f14ec0af3e0d4b4774e6f598838/fixdd > /data/adb/service.d/fixdd && chmod +x /data/adb/service.d/fixdd"
/system/bin/sh: can't create /data/adb/service.d/fixdd: No such file or directory
~ $ su
xdd && chmod +x /data/adb/service.d/fixdd" <
/system/bin/sh: can't create /data/adb/service.d/fixdd: No such file or directory
1|:/data/data/com.termux/files/home #

@rauf4ik123
Copy link

rauf4ik123 commented Oct 3, 2023

Please help me... samsung s20+
Screenshot_20231004_000019_DriveDroid

Screenshot_20231004_001353_Settings

@AliyevYT
Copy link

AliyevYT commented Oct 28, 2023

Not working on Redmi 5 LOS 20 Please help me

@mym4y4
Copy link

mym4y4 commented Nov 15, 2023

overzero-git
Hello everyone! I solved my problems with Xiaomi Mi Note 10 lite and created simpe Magisk module for auto-config https://github.com/overzero-git/DriveDroid-fix-Magisk-module

Confirmed!
Galaxy S9 - Android 13

@Kissycat
Copy link

Oh, guys, stop talking this, just see what you have in your phone's dir /config/usb_gadget/g1/functions, if there is mass_storage.0, then use the script above, and if there is mass_storage.usb0 instead, just do this.

Or you have anything else, just edit the droid apk yourself.

@animegamer4422
Copy link

I got drivedroid working but it cannot really boot any ISO
I tried with Pop os
Below are the attached images

P_20231122_191425

After booting from drivedroid the grub menu appears as expected

P_20231122_191445

But pressing enter doesn't boots the iso instead throws an error saying kernel cannot be found

It could be a mounting issue

@rauf4ik123
Copy link

rauf4ik123 commented Nov 22, 2023 via email

@be4zad
Copy link

be4zad commented Apr 2, 2024

Worked on Samsung A03 Core (crDroid GSI ROM, Android 13)
I booted Archlinux with it :D

@zak-ink-5
Copy link

I have an INFINIX SMART 5
And I have got this
/system/bin/sh: curl: inaccessible or not found
I think bc I need to download something,but IDK how
Can someone please help me

@be4zad
Copy link

be4zad commented Sep 28, 2024

I have an INFINIX SMART 5 And I have got this /system/bin/sh: curl: inaccessible or not found I think bc I need to download something,but IDK how Can someone please help me

You should install busybox I guess

@zak-ink-5
Copy link

I have an INFINIX SMART 5 And I have got this /system/bin/sh: curl: inaccessible or not found I think bc I need to download something,but IDK how Can someone please help me

You should install busybox I guess

Thanks I Will try

@zak-ink-5
Copy link

I have an INFINIX SMART 5 And I have got this /system/bin/sh: curl: inaccessible or not found I think bc I need to download something,but IDK how Can someone please help me

You should install busybox I guess

Does not work :/

@zak-ink-5
Copy link

@mmtrt can you tell me how can I make it work

@mmtrt
Copy link
Author

mmtrt commented Oct 1, 2024

@zak-ink-5 try this also make sure termux packages are updated.

curl -sL https://gist.github.com/mmtrt/5dfbd2559ea988dfbe56277347ac6c96/raw/478204e0d0107f14ec0af3e0d4b4774e6f598838/fixdd > fixdd && chmod +x fixdd

just manually run the script whenever want to use dd run these commands

su

then

./fixdd

@Samsara69
Copy link

Use it

Hello, thanks but this app doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment