Skip to contentSkip to conversation

Make an un-device?

DISCUSSION Tom Horsley 5 participants 8 messages Mar 24, 2010 – Mar 25, 2010

lore
Share & tools
lore
#0 lore raw

Usually people want to know how to make udev recognize devices. I have a device that is recognized just fine, but I'd really like to declare it an un-device. I don't want any /dev/ files created for it, I don't want the driver loaded unless something else needs it. I want it to disappear from creation completely.

Can custom udev rules do this?

Specifically, the device is the incredibly annoying fake CD drive that appears along side my usb hard disk when I plug it in.

#1 lore raw
Quoted 8 lines · Tom Horsley

Usually people want to know how to make udev recognize devices. I have a device that is recognized just fine, but I'd really like to declare it an un-device. I don't want any /dev/ files created for it, I don't want the driver loaded unless something else needs it. I want it to disappear from creation completely.

Can custom udev rules do this?

Not specifically - ignore_device used to do something like this but we removed that directive from udev... and even if we still had the ignore_device directive, suppressing events at the udev level is wrong.. and that's why we removed ignore_device.

Quoted 3 lines

Specifically, the device is the incredibly annoying fake CD drive that appears along side my usb hard disk when I plug it in.

One way to make such annoying drives disappear in GNOME and some other desktop environments is to set the UDISKS_PRESENTATION_HIDE (or if you are on an older distro than F13 vintage, it's called DKD_PRESENTATION_HIDE) udev property like e.g. this

http://cgit.freedesktop.org/udisks/tree/data/80-udisks.rules#n188

Another way to solve this is adding an entry to something like one of the unusual_* files under drivers/usb/storage in the kernel... but that includes recompiling the kernel.

HTH,
David

#2 lore raw
In reply to Tom Horsley
Quoted 7 lines · Tom Horsley

Usually people want to know how to make udev recognize devices. I have a device that is recognized just fine, but I'd really like to declare it an un-device. I don't want any /dev/ files created for it, I don't want the driver loaded unless something else needs it. I want it to disappear from creation completely.

Quoted 5 lines

Can custom udev rules do this?

Specifically, the device is the incredibly annoying fake CD drive that appears along side my usb hard disk when I plug it in.

Udev can't really do anything here.

In many cases there are tools available from the disk vendor to disable the fake cd drive.

Kay

#3 lore raw
In reply to Tom Horsley
Quoted 4 lines · On Wed, 24 Mar 2010 13:07:52 -0400 David Zeuthen wrote:

One way to make such annoying drives disappear in GNOME and some other desktop environments is to set the UDISKS_PRESENTATION_HIDE (or if you are on an older distro than F13 vintage, it's called DKD_PRESENTATION_HIDE) udev property like e.g. this

Yea, I found that, but it has already changed three times now (first you used hal, then you used DKD, now you use UDISK). I figured a lower level eradication might stick through more changes :-).

Having some user configurable way to utterly hide devices does seem useful. I recall having a "helpful" operating system "upgrade" all the partitions on a disk once, thus rendering it utterly useless in the multi-boot environment that could boot older kernels.

#4 lore raw
In reply to Tom Horsley
Quoted 8 lines · tom
Quoted 4 lines · On Wed, 24 Mar 2010 13:07:52 -0400 David Zeuthen wrote:

One way to make such annoying drives disappear in GNOME and some other desktop environments is to set the UDISKS_PRESENTATION_HIDE (or if you are on an older distro than F13 vintage, it's called DKD_PRESENTATION_HIDE) udev property like e.g. this

Quoted 4 lines

Yea, I found that, but it has already changed three times now (first you used hal, then you used DKD, now you use UDISK). I figured a lower level eradication might stick through more changes :-).

in addition, the wouldn't the solution then apply to "all" desktops, instead of "GNOME and some other" desktops?

given how often this comes up, i think it would be very useful for there to be a page fully describing the reasons that the udev project thinks the feature is a bad idea. when i asked in november for the reasons behind not being able to hide devices, i got somewhat vague reasons. (and i'm clearly still not convinced. :-) simply stating "suppressing events at the udev level is wrong" isn't terribly compelling.

paul

Quoted 10 lines

Having some user configurable way to utterly hide devices
does seem useful. I recall having a "helpful" operating
system "upgrade" all the partitions on a disk once, thus rendering it utterly useless in the multi-boot environment
that could boot older kernels.
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

=---------------------
paul fox, [email protected]

#5 lore raw
In reply to Tom Horsley
Quoted 7 lines · Paul Fox

given how often this comes up, i think it would be very useful for there to be a page fully describing the reasons that the udev project thinks the feature is a bad idea. when i asked in november for the reasons behind not being able to hide devices, i got somewhat vague reasons. (and i'm clearly still not convinced. :-) simply stating "suppressing events at the udev level is wrong" isn't terribly compelling.

I'm sorry that you don't find this compelling but it came directly from both myself and the udev maintainer (Kay Sievers) - you are free to check the archives for better explanations. Or if you examine, in detail, how uevents and libudev work, you will eventually understand why ignore_device was a terrible idea to begin with [1].

Quoted 2 lines

in addition, the wouldn't the solution then apply to "all" desktops, instead of "GNOME and some other" desktops?

FYI, the desktops that are covered by e.g. UDISKS_PRESENTATION_HIDE includes desktops for which the following statements are true

- they are using GVolumeMonitor to draw icons

- they are shipping gvfs with the udisks (or DeviceKit-disks) volume monitor backend

which includes GNOME and, I think, XFCE, on most modern distros.

IMNSHO, it is rather naive to demand that "all" desktops need to implement some feature (such as configuring what drives to ignore). It's not like desktops share a lot of code or specs.

Good luck,
David

[1] : Hint: ignore_device only suppressed invocation of rules - the uevent was still emitted and the device would still be part of any enumeration either via libudev or sysfs.

<ramble>
What most people don't understand is that udev is just one tiny piece in the *middle* of the stack... a stack where elements in the stack are free to bypass layers - e.g. it is perfectly fine for a desktop app to look in sysfs, thereby bypassing, say, udev and udisks.

So even if we still had ignore_device and things on top (like udisks -> gvfs -> nautilus) actually respected it, it wouldn't work for the app looking directly in sysfs (or /proc/scsi/scsi or whatever). </ramble>.

#6 lore raw
In reply to Tom Horsley
Quoted 4 lines · David Zeuthen

IMNSHO, it is rather naive to demand that "all" desktops need to implement some feature (such as configuring what drives to ignore). It's not like desktops share a lot of code or specs.

I think that's why he was suggesting that this be handled at the udev level so that it _applied_ to all desktops.

--
Dan

#7 lore raw
In reply to Tom Horsley
Quoted 9 lines · David Zeuthen
Quoted 7 lines · Paul Fox

given how often this comes up, i think it would be very useful for there to be a page fully describing the reasons that the udev project thinks the feature is a bad idea.  when i asked in november for the reasons behind not being able to hide devices, i got somewhat vague reasons.  (and i'm clearly still not convinced. :-)  simply stating "suppressing events at the udev level is wrong" isn't terribly compelling.

Quoted 5 lines

I'm sorry that you don't find this compelling but it came directly from both myself and the udev maintainer (Kay Sievers) - you are free to check the archives for better explanations. Or if you examine, in detail, how uevents and libudev work, you will eventually understand why ignore_device was a terrible idea to begin with [1].

Right, there is nothing we could "ignore" properly that way. "Hiding" devices should probably be done by just unbinding the driver.

Kay