[Verizon Samsung Galaxy S III] n01ce:
It seems there's something wrong the fix script...

It seems that $SEGMENT3 (which contains in each loop 00 00 55 aa ; 1f 2c 55 aa ; and a derived 00 00 55 aa) is applied... instead of $TEST which actually contains the good value and is not used! (14 22 55 aa) :eek:

Si I've modified /system/xbin/fixmyexfat.sh as follows :

Original fixmyexfat.sh 6.4 line 123+:

for SEGMENT3 in '\x00\x00\x55\xaa' '\x1f\x2c\x55\xaa' "$SEGMENT3FILL"; do
#printf "%s\n" $SEGMENT3; done
printf "Segment 3 (508:4) [Tail] -- [%s] -> (%s)" "$(makeReadable $SEGMENT3)" "$(makeReadable $TEST)"
echo -n "$SEGMENT3" | dd of="$fixTARGET" bs=1 count=4 seek=508 2> /dev/null

Modified fixmyexfat:

for SEGMENT3 in '\x00\x00\x55\xaa' '\x1f\x2c\x55\xaa' "$SEGMENT3FILL" "$TEST"; do
#printf "%s\n" $SEGMENT3; done
printf "Segment 3 (508:4) [Tail] -- [%s: replacement] -> (%s: unused)\n" "$(makeReadable $SEGMENT3)" "$(makeReadable $TEST)"
echo -n "$SEGMENT3" | dd of="$fixTARGET" bs=1 count=4 seek=508 2> /dev/null

echo "Fixed header is as follows:"
dd if="$fixTARGET" bs=512 count=1 skip=0|hexdump -C

Then the output asked me to run:

modprobe fuse

What I did. Shall this avoid the adding of $TEST case? I don't know, but whatever.

Relanching the script after that gave me that debug output:

[fuse-mountsd v6.4] exFat+NTFS autorepair and mount script (HMkX2 CORE//XDA)
Automated mounting and repair of alternate SD fs on GS3 CM10.1 [+AOSP Roms!]

(1) Checking for MTDblock: (YES)
(2) Checking for mmcblk0: (YES)
(3) Checking for mmcblk1: (YES)
(4) Checking for SECONDARY_STORAGE: (YES)
(5) Checking for EXTERNAL_STORAGE: (YES)
(6) Checking for rw-able /storage: (YES)
(7) Checking for rw-able /: (no)

<<mmcblk1 exists..>>

You are running CM10.1 / 4.2+ ?
Enabling ADB code...

You have teh 4.2.2+ ADB RSA bug -- poor you.
Setting flag to apply the workaround...
31 0 7680 mtdblock0
31 1 7680 mtdblock1
31 2 432128 mtdblock2
31 3 17920 mtdblock3
31 4 12800 mtdblock4
31 5 16384 mtdblock5
31 6 11264 mtdblock6

=====================================
WARNING EXPERIMENTAL METHOD

You are using an OLD phone.
=====================================

major minor #blocks name

31 0 7680 mtdblock0
31 1 7680 mtdblock1
31 2 432128 mtdblock2
31 3 17920 mtdblock3
31 4 12800 mtdblock4
31 5 16384 mtdblock5
31 6 11264 mtdblock6
179 0 7880704 mmcblk0
179 1 5914592 mmcblk0p1
179 2 1966080 mmcblk0p2
179 16 1024 mmcblk0boot1
179 8 1024 mmcblk0boot0
254 0 409600 dm-0
254 1 1552384 dm-1
179 24 31166976 mmcblk1
179 25 31165952 mmcblk1p1
~~
rootfs / rootfs rw,relatime 0 0
tmpfs /dev tmpfs rw,nosuid,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
/sys/kernel/debug /sys/kernel/debug debugfs rw,relatime 0 0
tmpfs /storage tmpfs rw,relatime,mode=050,gid=1028 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/secure tmpfs rw,relatime,mode=700 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/fuse tmpfs rw,relatime,mode=775,gid=1000 0 0
/dev/block/mtdblock3 /cache yaffs2 rw,nosuid,nodev,relatime 0 0
/dev/block/mtdblock5 /radio yaffs2 rw,relatime 0 0
/dev/block/mtdblock2 /datadata yaffs2 rw,relatime 0 0
/dev/lvpool/system /system ext4 ro,relatime,barrier=1,data=ordered 0 0
/dev/lvpool/userdata /data ext4 rw,nosuid,nodev,noatime,errors=panic,barrier=1,nomblk_io_submit,data=ordered 0 0
/dev/block/mtdblock4 /efs yaffs2 rw,relatime 0 0
/dev/block/vold/179:1 /storage/sdcard0 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /storage/sdcard0/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
~~
/dev/mapper/lvpool-userdata: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
/dev/mapper/lvpool-system: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
/dev/block/mmcblk1p1: UUID="724D-4255" TYPE="exfat"
/dev/block/vold/179:25: UUID="724D-4255" TYPE="exfat"
/dev/block/vold/179:1: UUID="8719-1DEB" TYPE="vfat"
/dev/block/dm-1: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
/dev/block/dm-0: UUID="57f8f4bc-abf4-655f-bf67-946fc0f9f25b" TYPE="ext4"
/dev/block/mmcblk0p1: UUID="8719-1DEB" TYPE="vfat"
~~

/dev/mapper/lvpool-system /system

NOGO Zone set as: ( -e mtdblock -e mmcblk0)
Analyzing /proc/partitions structure:
Index 0 is: 179 24 31166976 mmcblk1
Sub-partition detected at mmcblk1 / mmcblk1p1
Index 1 is: 179 25 31165952 mmcblk1p1

~~~~~~~~~ Beginning FS Logic ~~~~~~~~~
Index (0) - [/dev/block/mmcblk1p1	exfat	mount.exfat-fuse	-o rw,dirsync,noatime,umask=0	fixmyexfat.sh]

~~~~~~~~~ Beginning Test Mount/Repair ~~~~~~~~~
Scrub received for searchSTR ( /storage/sdcard1 )
===== [Cycling /dev/block/mmcblk1p1] =====
Scrub received for searchSTR (/dev/block/mmcblk1p1 )

Attempting test mount of /dev/block/mmcblk1p1 at /mnt/secure/staging:
(/dev/block/mmcblk1p1)(exfat) (mount.exfat-fuse) (-o rw,dirsync,noatime,umask=0) (fixmyexfat.sh)
Success, moving to retrieve MultiMount (if needed)...
WORKS WORKS WORKS - Debug is enabled. Header is as follows: <MUTED>

Defaulting to /storage/sdcard1
Test mount/repair success. Target is /storage/sdcard1

~~~~~~~~~ Beginning target creation/scrub ~~~~~~~~~
Scrub received for searchSTR ( /storage/sdcard1 )

~~~~~~~~~ Beginning Final Mount Sequence ~~~~~~~~~
Check complete, mounting and initializing...

############## Index (0) - /dev/block/mmcblk1p1 ##############
mount.exfat-fuse -o rw,dirsync,noatime,umask=0 /dev/block/mmcblk1p1 /storage/sdcard1
Attempting ADB bypass...
ADB RSA Key workaround enabled
Shifting some encryption keys around...
Scanning /data/misc/adb/adb_keys for localhost key
Looks like Localhost key is already set! Good to go!
* daemon not running. starting it now on port 5038 *
* daemon started successfully *
unable to connect to localhost:5556:5556
Verifying ADB connection:
List of devices attached

Smashing ADB command: mount.exfat-fuse -o rw,dirsync,noatime,umask=0 /dev/block/mmcblk1p1 /storage/sdcard1 ; sleep 1 2>&1
error: device not found

###########################################
ERROR: Root access was DENIED!!!
Please grant ADB Shell root access!
###########################################

Resetting ADB loopback connection/root security to PRIOR...
No such device localhost:5556

And... that's where I was stuck again.

ADB shell root access was already enabled so that was not the issue (improper error).

The issue was more in the fact that it tries to connect to ADB on port 5556 instead of 5038.

So I modified the hard-coded value:

Original fuse-mountsd.sh 6.4 line 99:

adbUSEPORT=5556

Modified fuse-mountsd.sh 6.4 line 99:

adbUSEPORT=5038

EDIT: NOT RECOMMENDED WORKAROUND. Use v6.5 beta patch in my last post instead.

Yeah, that's not a very nice solution... let's call it a workaround.

AND THAT'S HOW IT FINALLY WORKED!

EDIT:

I'm starting to understand why I needed this change and why it worked. For that, we have to understand how ADB works (developer.android.com/tools/help/adb.html). My interpretation is the following:

- The script that wants to run ADB launches a "client" (no listening port) and also a "server" (listening on TCP port 5037+). It says "daemon not started. starting daemon on port 5037 (or 5038)" BUT IT IS NOT A DAEMON, IT'S A SERVER! Shame you ADB output. The servers can be viewed as a "proxy" that transmit the requests of the clients to the connected devices (via TCP or USB). Clients may be on the same machine or not.

- The device that receive the ADB commands runs an ADB "daemon". Daemons have two listening modes: USB listening or TCP listening (listening on TCP port 5554-5585). It uses two ports to listen for "console (?!) and adb servers" but whatever.

So as a pre-requisite for fuse-mountsd.sh we need the ADB daemon to be launched and listening:

- If the daemon is listening on USB (that was my case), the USB cable is needed for the daemon to launch.The server (on the PC ONLY!) will find the daemon easily as it is USB connected. BUT you can't ask your adb client to connect directly to port 555x as we are in USB mode so ADBD doesn't run on any port: you will need to go through the server on the PC, that's why it worked when I asked the client to connect to 5037 or 5038 port, which is the server TCP port on the PC. Anyway, this solution is BAD for the long term as you can't mount your exfat partition if the USB cable is unplugged and without launching the command from the PC...

- If the daemon is listening on TCP, well, it should work. but the script doesn't restart the ADB daemon in this mode! (bug). The script starts a server and connect to it, it doesn't launch the daemon on a TCP port. EDIT: Investigated and solved on the next post.

So when it works it gives:

_ __ ______ ___
/\ /\/\/\ | | __ \/ /___ \ / __\___ _ __ ___
/ /_/ / \| |/ /\ / __) | / / / _ \| '__/ _ \
/ __ / /\/\ \ < / \ / __/ _/ /___ (_) | | | __/
\/ /_/\/ \/_|\_\_/\_\_____(_)____/\___/|_| \___|

===========================================================
Process complete! Buy me a beer if this worked!
===========================================================
Resetting ADB loopback connection/root security to PRIOR...

Solution summary:

EDIT: See attached patch v6.5 beta in the next posts.

I recommend to the developers to include this in a 6.5 version.