Posted October 23, 2020
dtgreene: (I note that /sys is also problematic because I believe there are some sysfs files that have side effects when *read*, not to mention that some of these files can return strange errors when naively accessed the wrong way.)
I wouldn't be surprised if there were some sysfs files that block until a certain event happens on some device. Which could be never. So yeah, an attempt to back that up wouldn't go anywhere :) You can run into similar issues if you use recursive grep on /. AstralWanderer: According to its man page hdparm works at kernel/driver level, so it's as low-level as software goes on a Linux system. If you know of another utility (that runs on BusyBox) then I'd be happy to give that a shot and post results.
...
If it were that straightforward, then hdparm would have been able to change the flag to read/write (which it reportedly did on my system) and allow subsequent writes to work (which they did not, failing with a write-protect error). Hence my conclusion that there must be a hardware element at work and that the Veho USB adaptor was responsible - especially since the same SD card (with the switch still set at Lock) was writable with a different USB adaptor.
Well it looks like GOG's forum just ate my post so let me try again.. ...
If it were that straightforward, then hdparm would have been able to change the flag to read/write (which it reportedly did on my system) and allow subsequent writes to work (which they did not, failing with a write-protect error). Hence my conclusion that there must be a hardware element at work and that the Veho USB adaptor was responsible - especially since the same SD card (with the switch still set at Lock) was writable with a different USB adaptor.
I tried hdparm on my thinkpad's card reader, and as expected, it achieved nothing since the ioctl is not implemented by the mmcblk layer.
So I implemented it, and tada, write protect can be bypassed just like that, in software, by telling software to ignore the "protection" and write anyway. No hardware involved. See screenshot for proof.
Post edited October 23, 2020 by clarry