* udev not called on USB disconnect
@ 2006-06-05 8:34 Ondrej Zary
2006-06-05 16:18 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Ondrej Zary @ 2006-06-05 8:34 UTC (permalink / raw)
To: Linux Kernel Mailing List
Hello,
I'm trying to do automount/umount for my Canon camera using udev. The
camera does not support mass storage so I'm using gphotofs+fuse to
access it.
I created canon.rules file in /etc/udev/rules.d which contains:
BUS=="usb", SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="306e",
ACTION=="add", RUN+="/usr/bin/gphotofs /mnt/camera -o allow_other"
BUS=="usb", SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="306e",
ACTION=="remove", RUN+="/sbin/umount -f /mnt/camera"
(the file contains only two lines).
When I plug in the camera, the first rule is executed and camera mounted
properly. However, disconnecting it does not do anything, the second
rule is never executed. I also tried rule as simple as:
BUS=="usb", RUN+="/bin/touch /123"
If I understand udev correctly, that should create /123 file on each USB
event. It works when connecting the camera but does not do anything on
disconnect.
USB connect/disconnect is properly detected by kernel (2.6.16):
usb 1-2: new full speed USB device using uhci_hcd and address 22
usb 1-2: configuration #1 chosen from 1 choice
usb 1-2: USB disconnect, address 22
Is this a bug or a feature?
--
Ondrej Zary
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: udev not called on USB disconnect
2006-06-05 8:34 udev not called on USB disconnect Ondrej Zary
@ 2006-06-05 16:18 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2006-06-05 16:18 UTC (permalink / raw)
To: Ondrej Zary; +Cc: Linux Kernel Mailing List
On Mon, Jun 05, 2006 at 10:34:20AM +0200, Ondrej Zary wrote:
> Hello,
> I'm trying to do automount/umount for my Canon camera using udev. The
> camera does not support mass storage so I'm using gphotofs+fuse to
> access it.
> I created canon.rules file in /etc/udev/rules.d which contains:
>
> BUS=="usb", SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="306e",
> ACTION=="add", RUN+="/usr/bin/gphotofs /mnt/camera -o allow_other"
> BUS=="usb", SYSFS{idVendor}=="04a9", SYSFS{idProduct}=="306e",
> ACTION=="remove", RUN+="/sbin/umount -f /mnt/camera"
You can't read sysfs values when a device is removed, because those
sysfs files are not present anymore. Try testing the environment
variables instead.
> (the file contains only two lines).
> When I plug in the camera, the first rule is executed and camera mounted
> properly. However, disconnecting it does not do anything, the second
> rule is never executed. I also tried rule as simple as:
>
> BUS=="usb", RUN+="/bin/touch /123"
>
> If I understand udev correctly, that should create /123 file on each USB
> event. It works when connecting the camera but does not do anything on
> disconnect.
Are you sure that no other rule ahead of this one stopped this rule from
ever being read?
Also, udev questions belong on the linux-hotplug-devel mailing list...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-05 16:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-05 8:34 udev not called on USB disconnect Ondrej Zary
2006-06-05 16:18 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox