On Mon, Sep 14, 2015 at 11:55:17AM -0700, David Grayson wrote: > Hello, Greg. Thanks for the quick reply, and for all your > contributions to Linux. > > On Fri, Sep 11, 2015 at 6:01 PM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: > > Can't you wait for libudev to notify your application when the usb > > device is attached? That should happen after the normal rules are run. > > Have you tried that? > > I have not tried using a udev_monitor but I do believe it would work. > I used it indirectly via libusb and that seemed to work. However, > using a udev_monitor would impose an unwelcome constraint, which is > the requirement to start monitoring for new devices before the device > is plugged into the computer. That's the only safe way to ensure you catch all USB devices, sorry. > This complicates the scenario I > described in my first email where one program might tell a device to > go into bootloader/firmware upgrade mode (which entails disconnecting > from USB and re-enumerating), and then another program starts and > waits for the bootloader to be available. I wrote about this in point > #4 of my first email (quoted below). Start your program "B" before telling the device to reset itself. > For future versions of Linux, I would suggest adding a sysfs attribute > that changes from "0" to "1" when the rules are fully applied. No, this is up to userspace to handle, don't use a kernel sysfs file as a "poor-man's IPC" please. > In the > meantime, I will think of a workaround. I'll probably open the > devnode file and close it quickly as a test to see if it can be > opened, and exclude devices from consideration if that test does not > pass. I'll be careful to only do this for devices that I am actually > interested in opening, since opening that file can have side effects. > > If you have better suggestions or know about some way to tell if the > udev rules are fully applied, I would be happy to hear it. Thanks > again! Start your program to listen and handle all devices that way through udev iterators, that way will always work (for existing and new devices). thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html