As gnome-multiwriter's probe helper does, udisks should check for fake devices when formatting SD cards. The tests are quick enough to be run even when doing quick formatting.
The main complication being that you have to reset the device after doing the first set of probing. Some sneaky devices keep a runtime list of changed sectors which isn't saved to flash. For USB device it's easy as you can just reset the port and let the device re-enumerate, but for sata disks and SD cards I don't know if the same thing is possible. The code I'm using is here: https://git.gnome.org/browse/gnome-multi-writer/tree/src/gmw-probe.c -- I'm happy to relicence to basically whatever if required.
Can you please elaborate what "fake" devices are? Something like the scsi_debug kernel module with a few extra udev properties to make it look like an SD card? Formatting that should work just fine, though. So I'm afraid I don't know what this is all about? Also, udisks doesn't do anything special on SD cards for formatting, mounting etc, other than advertising an SD card icon for these drives/volumes. Do you have some more details on what you are trying to do and what fails? Thanks!
Lots of details here: http://blogs.gnome.org/hughsie/ tl;dr: Fake flash is where the drive is much smaller than the size it reports, so for instance a 16GB drive is actually a 2GB drive, and writing to anything past 2BG either goes to /dev/null or wraps around to the first sector. :/
Gahh, URL was meant to be: http://blogs.gnome.org/hughsie/2015/01/28/detecting-fake-flash/
(In reply to Martin Pitt from comment #2) > Can you please elaborate what "fake" devices are? Something like the > scsi_debug kernel module with a few extra udev properties to make it look > like an SD card? Formatting that should work just fine, though. So I'm > afraid I don't know what this is all about? http://www.hadess.net/2015/02/another-fake-flash-story.html http://blogs.gnome.org/hughsie/2015/01/28/detecting-fake-flash/ http://fake-electronics.blogspot.fr/2013/12/fake-samsung-64gb-microsd-card.html etc.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.