From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Wed, 29 Aug 2007 04:26:34 +0000 Subject: Re: udev remove problems Message-Id: <1188361595.3672.3.camel@lov.localdomain> List-Id: References: <1531272489@web.de> In-Reply-To: <1531272489@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: linux-hotplug@vger.kernel.org On Tue, 2007-08-28 at 21:48 +0200, Juergen Bausa wrote: > > -----Ursprüngliche Nachricht----- > > Von: "Kay Sievers" > > Gesendet: 27.08.07 00:10:33 > > > > > On 8/26/07, Juergen Bausa wrote: > > > > > > > -----Ursprüngliche Nachricht----- > > > > Von: "Kay Sievers" > > > > Gesendet: 26.08.07 00:42:51 > > > > An: "Juergen Bausa" > > > > > > > > On 8/26/07, Juergen Bausa wrote: > > > > > udev remove problems > > > > > > > > > > I am using udev 0.105-4 on debian etch. I am trying to setup rules for pvr (hard disk recorder) > > > > > that is connected to my system via usb. Add and remove events should start scripts. The add > > > > > event works fine: > > > > > > > > > > > > > > > So, the variable is saved and found on the remove event, but the script isnt called. What is wrong here? > > > > > > > > The string you compare against may not run through the format char > > > > replacement, not sure. Just do ENV{toppy}="?*", or use the > > > > ENV{REMOVE_CMD}="/usr/local ..." which Debian supports. So you don't > > > > need a separate remove rule at all. > > > > > Thanks. I used REMOVE_CMD and the script is called. But now I have the problem, that the > > > remove event appears, when the device is accessed. > > > > > > When I plug in, add is called many times (ca. 5). That is no problem, because my script works > > > only on the first call. The script creates a desktop icon and starts a daemon, that allows me to > > > access my device through a local ftp server. This works without any problem. > > > > > > But when I try to login to the ftp server, which triggers actual transfer to the usb device, the > > > remove event is run and my remove script is called. > > > > > > I have no idea why. Any Hints? > > > > Run "udevmonitor" while doing that. What sequence of events does it show? > > > > It's a pure userspace solution, or does it need a kernel module? > > Pure userspace > > Here is my udev rule: > > ACTION="add", SYSFS{idVendor}="11db", SYSFS{idProduct}="1000", MODE="0660", \ > GROUP="toppy", RUN+="/usr/local/bin/tf5000pvr_udev" , ENV{REMOVE_CMD}="/usr/local/bin/tf5000pvr_udev" > > And this is what udevmonitor --env says when I plug in the device (I use a very long cable with an usb extender/hub). > As you can see REMOVE_CMD is set in 4 events, although the rule matches only one time (and in this event > REMOVE_CMD is not set). And my Script is also started 4 times. > > When I start a connection to the device, I get new add-events. But this is not in the log (the plug-in log is strange enough). > > Whats wrong here? Your rule matches all the kernel devices who are created for this usb device, so this is the correct behavior. You may want to limit the match by adding SUBSYSTEM="usb". Kay ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel