Re: Automatic USBDEVFS_CONNECT on close?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 18, 2009 at 02:17:22PM +0100, Phil Endecott wrote:
> Dear Experts,
> 
> I have some code using usbdevice_fs that calls the USBDEVFS_DISCONNECT 
> and USBDEVFS_CONNECT ioctls to remove and re-connect any kernel drivers 
> when it starts and finishes.  This works OK.
> 
> The only problem is if the program terminates abnormally (crash, 
> ctrl-C, OOM etc); USBDEVFS_CONNECT is not called.  Is there any way to 
> get USBDEVFS_CONNECT behaviour automatically when the fd is closed?  I 
> think that I could do this from a signal handler for some cases, but 
> I'd really like it to happen even for un-catchable signals.

We could do this within the kernel, but how would we know if this is the
proper behavior?  Some programs might just call the DISCONNECT ioctl and
then exit, and wait for another program to bind to the device.  If we
chnaged the behavior to reconnect after the fd was closed, then such a
situation would not work.

I'd recommend fixing your program to catch as many signals as it can,
and then fixing the bugs so the non-catchable ones don't happen :)

good luck,

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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux