linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Anthony L. Awtrey" <tony@awtrey.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: udev no longer passes USB device remove events
Date: Sat, 29 Dec 2007 15:54:38 +0000	[thread overview]
Message-ID: <47766DBE.90909@awtrey.com> (raw)
In-Reply-To: <4772D1C3.3070309@awtrey.com>

Hello again,

I fixed my problem, but not the right way. One thing that tripped me
when I was investigating this issue was that when you issue a
"udevcontrol log_priorityÞbug" you don't actually get dbg() messages
in the syslog. Therefore my log dump looked like silent failure to me.
Once I found the function I suspected to cause the trouble, I changed
the dgb() functions to info() and could see this:

udev_node_remove: device node '/dev/bus/usb/004/007' not found

It looks like udev is failing to remove a non-existant device node and
returning -1. Raw USB devices don't necessarily have device nodes to
remove, so the perfectly reasonable "remove usb" events are failing for
no good reason that I can tell.

I fixed my problem by allowing the function udev_node_remove() to return
0 on device node remove failures:

...
int udev_node_remove(struct udevice *udev)
{
        char filename[PATH_SIZE];
        char partitionname[PATH_SIZE];
        struct stat stats;
        int retval = 0;
        int num;

        strlcpy(filename, udev_root, sizeof(filename));
        strlcat(filename, "/", sizeof(filename));
        strlcat(filename, udev->name, sizeof(filename));
        if (stat(filename, &stats) != 0) {
                dbg("device node '%s' not found", filename);
                return 0; /* <--- LOOK */
        }
...

I don't know the other implications, but it appears to work and does not
cause any other obvious problems in my limited testing. Can anyone
suggest a more appropriate fix?

Tony



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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

  reply	other threads:[~2007-12-29 15:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-26 22:12 udev no longer passes USB device remove events Anthony L. Awtrey
2007-12-29 15:54 ` Anthony L. Awtrey [this message]
2007-12-29 16:40 ` Kay Sievers
2007-12-29 18:40 ` Anthony L. Awtrey
2007-12-29 18:55 ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47766DBE.90909@awtrey.com \
    --to=tony@awtrey.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).