Closed hughsaunders closed 4 months ago
This turned out to be a problem with my sd card, re-formatted and it now works fine with the msc command.
I was having this exact same issue with a 128gb sd card that was indeed formatted with MBR FAT32. If you plug the SD card into a computer you can read the logs that way, but it will not work with MSC (usb cable) with a 128gb partition. However, if you re-partition the sd card to have only a 4gb partition, MSC works perfectly to read the logs. I did not find this documented anywhere, I just had a hunch that it might not work due large sd cards due to an old forum thread saying iNav didn't support writing past 4gb on large sd cards (I don't even know if that is true, but MSC definitely doesn't like very large partitions).
I made a video explaining the problem and showing how to fix it on MacOs, but I had the same issue with MSC on Windows and Linux. youtube vid inav msc corrupted blackbox data
If this is a known limitation, please make it easier to find (perhaps on the inav configurator UI CLI page or msc command documentation). Without knowing more about MSC and inav, I would consider it a bug, but it may not be.
Current Behavior
I downloaded blackbox logs via msc and couldn't open them. I then took the sdcard out of the flight controller and inserted it directly into the laptop and copied the same logs. The SHA signatures are different between the two sets of files, also blackbox_decode can read the files from the sd copy but not from the msc copy.
I tried the msc copy multiple times and got the same SHA each time, it wasn't a one off error.
SHAS:
Attempt to decode msc copy files:
Attempt to decode SD copy files:
Steps to Reproduce
Expected behavior
Copying blackbox logs via MSC works the same as removing the sdcard and copying the files manually.
Suggested solution(s)
Debug msc mode? Or if MSC isn't supported on MacOs, put up a warning?
Additional context
CLI dump: https://pastebin.com/UercZGc2 Host OS: MacOS 12.7.4
I notice from this document, that msc copy and sd copy should be equivalent: https://github.com/iNavFlight/inav/blob/master/docs/USB_Mass_Storage_(MSC)_mode.md