I had assumed that all USB flash drives had a removable sysfs attribute of 1 (they are, after all, "removable"), but this is not always true. (Apparently, removable was meant for floppy drives and such, where the media is removable.)
Curiosity got the best of me, and I tried to figure out where that value was coming from. Google suggests that this is a USB property, but lsusb shows nothing to that effect. Searching the kernel code didn't help much; the end result comes from the GENHD_FL_REMOVABLE gendisk flag, set by sd.c from the struct scsi_device removable flag, set by, erm, someone.
To make things more confusing, there is another removable sysfs attribute for USB devices, supposedly "inferred from a combination of hub descriptor bits and platform-specific data such as ACPI", whose description sounds like what I wanted in the first place, but which always returns unknown for me.
That was an hour well wasted.
No comments:
Post a Comment