This is tested & works in my config, although the sdcard.c was a retrofit from a full copy I made in my tester directory so there's a chance I left a typo in when I copy/pasted the code back into your repo.
Also a 10% suspicion still there's a timing bug somewhere, I had a compilation complete and things didn't work and then I reverted some declarations that shouldn't have mattered, compiled again and stuff worked.
This is tested & works in my config, although the sdcard.c was a retrofit from a full copy I made in my tester directory so there's a chance I left a typo in when I copy/pasted the code back into your repo.
Also a 10% suspicion still there's a timing bug somewhere, I had a compilation complete and things didn't work and then I reverted some declarations that shouldn't have mattered, compiled again and stuff worked.