From: Greg KH <gregkh@linuxfoundation.org>
To: Thierry Seegers <thierry.seegers@gmail.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Can I reboot a USB device within a driver's probe function?
Date: Mon, 14 Sep 2020 10:17:50 +0200 [thread overview]
Message-ID: <20200914081750.GA1832024@kroah.com> (raw)
In-Reply-To: <CAJcZPhRbbs2_7e=uZaZOWuh2ZnY=S1b02yM4nqXXR_31_8qsDQ@mail.gmail.com>
On Mon, Sep 14, 2020 at 10:03:49AM +0200, Thierry Seegers wrote:
> Hi, thanks for the reply.
>
> > > One can even have this script executed automatically through a
> > > ".rules" file. So far so good. My question is: can I write a driver
> > > that will perform the same thing?
> >
> > Yes, but why? We pushed most of this logic out to userspace as it is
> > easier to handle there. Why do you want a kernel driver for this?
>
> Here's my (perhaps incorrect thought) as to why doing this in a driver would
> be desirable. In the case of the Python script executed through a .rules file,
> the script can't know which device this is in response to.
Then you need to fix your script, as it can be determined from the
environment variables that are passed to it by udev. Otherwise udev and
scripts that trigger off of device discovery would not work very well :)
> Contrast with a driver where if two devices are connected at the same time, two
> separate instances of the driver code would be executed for each
> specific device.
Same for userspace scripts.
good luck!
greg k-h
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next prev parent reply other threads:[~2020-09-14 8:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-13 16:17 Can I reboot a USB device within a driver's probe function? Thierry Seegers
2020-09-14 5:26 ` Greg KH
2020-09-14 8:03 ` Thierry Seegers
2020-09-14 8:17 ` Greg KH [this message]
2020-09-14 9:10 ` Thierry Seegers
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=20200914081750.GA1832024@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=kernelnewbies@kernelnewbies.org \
--cc=thierry.seegers@gmail.com \
/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).