|Summary:||Detect fake devices when formatting|
|Product:||udisks||Reporter:||Bastien Nocera <bugzilla>|
|Component:||general||Assignee:||Martin Pitt <martin.pitt>|
|Status:||NEW ---||QA Contact:|
|i915 platform:||i915 features:|
Description Bastien Nocera 2015-02-26 10:31:57 UTC
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.
Comment 1 Richard Hughes 2015-02-26 10:45:14 UTC
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.
Comment 2 Martin Pitt 2015-02-26 12:41:09 UTC
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!
Comment 3 Richard Hughes 2015-02-26 14:03:11 UTC
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. :/
Comment 4 Richard Hughes 2015-02-26 14:03:38 UTC
Gahh, URL was meant to be: http://blogs.gnome.org/hughsie/2015/01/28/detecting-fake-flash/
Comment 5 Bastien Nocera 2015-02-26 14:06:40 UTC
(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.