linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Bastien Nocera <hadess@hadess.net>
Cc: Alan Stern <stern@rowland.harvard.edu>,
	linux-usb@vger.kernel.org, benjamin.tissoires@redhat.com
Subject: Re: Driver for something that's neither a device nor an interface driver?
Date: Fri, 27 Sep 2019 21:25:54 +0200	[thread overview]
Message-ID: <20190927192554.GB1805907@kroah.com> (raw)
In-Reply-To: <7f25b01ceb1a3aa6bd213599474ceffc34a0054b.camel@hadess.net>

On Fri, Sep 27, 2019 at 08:49:12PM +0200, Bastien Nocera wrote:
> On Fri, 2019-09-27 at 13:56 -0400, Alan Stern wrote:
> > 
> <snip>
> > Is there any reason this needs to be done in a kernel driver?
> 
> To offer a unified interface all the devices with similar needs.

What "other devices with similar needs?"

> >   Can it 
> > be handled from userspace instead?
> 
> It could, at a great infrastructure cost, trying to get buy-in from
> various distributions, at the very least.

For USB devices that _can_ be handled in userspace, we ask that they be
done in userspace and not with a kernel driver.  Something that only
does usb control messages with no other in-kernel api interfaces is ripe
for a tiny userspace program using libusb.  Not for an in-kernel driver.

> > You said this was for a "power supply" class driver.  It's not clear 
> > what that means -- the devices you want to communicate with are 
> > iphones, ipads, etc., not power supplies.
> 
> There's tons of "device" scope "power_supply" devices in the kernel,
> which don't power the Linux machine they're running on. Grep for
> "POWER_SUPPLY_SCOPE_DEVICE" in the kernel, most wireless mice and
> keyboards implement this already.

Yes, but those are real devices that the "Host" uses for power or
something else.  wireless mice and keyboards already have kernel drivers
so that's fine as well (but probably could be done from userspace too.)

> > Under what circumstances would these messages need to get sent?  
> 
> User-space would control it by changing the device's
> POWER_SUPPLY_PROP_CHARGE_TYPE to "Fast", if available.
> 
> eg.
> # echo "Fast" > /sys/devices/pci0000:00/0000:00:14.0/usb3/3-
> 1/power_supply/apple_mfi_fastcharge/charge_type

power_supply class is for the power supply that is charging the cpu you
type that on.  Not for the cpu of an attached device, right?

thanks,

greg k-h

  reply	other threads:[~2019-09-27 19:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-27 17:29 Driver for something that's neither a device nor an interface driver? Bastien Nocera
2019-09-27 17:38 ` Greg KH
2019-09-27 17:44   ` Bastien Nocera
2019-09-27 18:57     ` Greg KH
2019-09-27 19:08       ` Bastien Nocera
2019-09-27 17:56 ` Alan Stern
2019-09-27 18:49   ` Bastien Nocera
2019-09-27 19:25     ` Greg KH [this message]
2019-09-27 20:12       ` Bastien Nocera
2019-09-28  7:39         ` Greg KH
2019-09-28 10:42           ` Bastien Nocera
2019-09-28 12:18             ` Greg KH
2019-09-28 12:37               ` Bastien Nocera
2019-09-28 12:57                 ` Greg KH
2019-09-27 20:21     ` Alan Stern

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=20190927192554.GB1805907@kroah.com \
    --to=greg@kroah.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=hadess@hadess.net \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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).