lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <4TM2EQ.P9PDF9VIY9MA1@crapouillou.net>
Date:   Sun, 26 Jul 2020 12:07:52 +0200
From:   Paul Cercueil <paul@...pouillou.net>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     Chunfeng Yun <chunfeng.yun@...iatek.com>, od@...c.me,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RESEND PATCH] usb: common: usb-conn-gpio: Register optional
 charger



Le dim. 26 juil. 2020 à 10:39, Greg Kroah-Hartman 
<gregkh@...uxfoundation.org> a écrit :
> On Sat, Jul 25, 2020 at 07:51:14PM +0200, Paul Cercueil wrote:
>>  Hi Greg,
>> 
>>  Le mar. 21 juil. 2020 à 13:41, Greg Kroah-Hartman
>>  <gregkh@...uxfoundation.org> a écrit :
>>  > On Mon, Jun 22, 2020 at 12:48:07AM +0200, Paul Cercueil wrote:
>>  > >  Register a power supply charger, if the Kconfig option
>>  > >  USB_CONN_GPIO_CHARGER is set, whose online state depends on 
>> whether
>>  > >  the USB role is set to device or not.
>>  > >
>>  > >  This is useful when the USB role is the only way to know if the
>>  > > device
>>  > >  is charging from USB. The API is the standard power supply 
>> charger
>>  > > API,
>>  > >  you get a /sys/class/power_supply/xxx/online node which tells 
>> you
>>  > > the
>>  > >  state of the charger.
>>  > >
>>  > >  The sole purpose of this is to give userspace applications a 
>> way to
>>  > >  know whether or not the charger is plugged.
>>  > >
>>  > >  Signed-off-by: Paul Cercueil <paul@...pouillou.net>
>>  > >  ---
>>  > >   drivers/usb/common/Kconfig         | 11 +++++++
>>  > >   drivers/usb/common/usb-conn-gpio.c | 47
>>  > > ++++++++++++++++++++++++++++++
>>  > >   2 files changed, 58 insertions(+)
>>  > >
>>  > >  diff --git a/drivers/usb/common/Kconfig 
>> b/drivers/usb/common/Kconfig
>>  > >  index d611477aae41..5405ae96c68f 100644
>>  > >  --- a/drivers/usb/common/Kconfig
>>  > >  +++ b/drivers/usb/common/Kconfig
>>  > >  @@ -49,3 +49,14 @@ config USB_CONN_GPIO
>>  > >
>>  > >   	  To compile the driver as a module, choose M here: the 
>> module
>>  > > will
>>  > >   	  be called usb-conn-gpio.ko
>>  > >  +
>>  > >  +if USB_CONN_GPIO
>>  > >  +
>>  > >  +config USB_CONN_GPIO_CHARGER
>>  > >  +	bool "USB charger support"
>>  > >  +	select POWER_SUPPLY
>>  > >  +	help
>>  > >  +	  Register a charger with the power supply subsystem. This 
>> will
>>  > > allow
>>  > >  +	  userspace to know whether or not the device is charging 
>> from
>>  > > USB.
>>  >
>>  > Why make this an option at all?  Why wouldn't we always want this 
>> here?
>>  >
>>  > As this is a charger, exporting that information to userspace 
>> should
>>  > probably always happen, right?
>> 
>>  I wanted to avoid the hardcoded dependency on CONFIG_POWER_SUPPLY.
>> 
>>  I can very well make that non-optional.
> 
> As the whole reason for this driver is to be a power supply, make it
> depend on the power supply core please.

It's the whole reason of my patch, not of the driver itself, whose 
purpose is to report the USB role (device, host, unconnected).

-Paul


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ