[systemd-devel] udev event on usb unpluged
Tom Yan
tom.ty89 at gmail.com
Tue Aug 25 20:37:40 PDT 2015
Also it seems to be g_mass_storage is just the module for setting up
dummy or emulating an mass storage device. Why would you want it to
depend on a usb "cable"/device?
On 26 August 2015 at 11:21, Tom Yan <tom.ty89 at gmail.com> wrote:
> I am not sure about what you mean here. Do you mean that you can't see
> any remove event with `udevadm monitor` when you unplug the "cable"?
> Also do you really mean a "usb cable" without any device connected to
> it on the other end?
>
> By the way the rule you set up is so broad that the script will
> basically be run on every boot or udevadm trigger.
>
> Unless you have a very specific to match with, I wonder if it's a good
> idea to unload the module by a remove event, because, for example,
> what if there are two "cables"/devices using the module?
>
> On 26 August 2015 at 04:17, <christophe.jalady at free.fr> wrote:
>> Hi,
>>
>> I would like to receive an event (actually run a script) when I plug/unplugged an usb cable.
>> I tried to use udev with this simple rule:
>> SUBSYSTEM=="usb",RUN+="/var/local/usb-changed.sh"
>>
>> I do receive the "add" event when I plug the usb cable: just perfect !
>>
>> But I never receive the "remove" event.
>> Any idea why ?
>>
>> More information:
>> I use linux kernel v3.16.
>> When the cable is plugged, I load the kernel module "g_mass_storage", this work great. My need is to unload the module when the usb cable is unplugged (note it would be even better if I receive an event when the mass-storage is unmounted by the other host, but I do not have any idea where to look for.)
>>
>> Thanks by advance for any hint.
>>
>> Christophe
>> _______________________________________________
>> systemd-devel mailing list
>> systemd-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
More information about the systemd-devel
mailing list