On Wed, Sep 14, 2011 at 01:53:18PM -0400, Greg Freemyer wrote:
On Wed, Sep 14, 2011 at 1:33 PM, Greg KH <gregkh@suse.de> wrote:
On Wed, Sep 14, 2011 at 05:40:01PM +0200, Anders Johansson wrote:
On Wednesday 14 September 2011 10:53:42 Greg KH wrote:
If you want to determine if this really is a USB device or not, then you need to look elsewhere in the system, not in /dev.
Out of interest, what is the correct way to determine if a particular device is removable, with hal gone? Is it the DeviceIsRemovable property in DeviceKit/udisk?
Yes, I think it is.
Are you avoiding /sys for some reason?
It's easier to make a library call than to dig through sysfs yourself most of the time.
If not, I vote for it being "cat /sys/block/sda/removable".
Doesn't work well from within a .c program :)
And since /sys is part of the Linux ABI it should be a stable interface.
It should, as long as you properly handle symlinks and recover properly if the file is not present. That is why using a library for this is always easier than having to re-write that logic all the time.
The bigger question is if the data found there is reliable. I don't know. I do know some of the sysfs fields associated with the disks are not reliable (but the existence of the files are stable!).
I don't know if all disks properly tell their state as "removable" in this manner. Again, what would you call a USB->ATA disk controller device? The disk itself is not "removable" in that it thinks it is getting ata commands. Yet the fact that it is behind a USB connection makes the user think it is. And again, what about PCI hotplug disks? There are whole storage devices out there where you can yank out a disk at any point in time, so they are "removable" yet the disk itself has no idea it really is that. greg k-h -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-factory+help@opensuse.org