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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c6ec738617a839a692bc3eb1317c1eb9cae29fe0.camel@hadess.net>
Date:   Sun, 30 Oct 2022 12:34:09 +0100
From:   Bastien Nocera <hadess@...ess.net>
To:     José Expósito <jose.exposito89@...il.com>,
        Mia Kanashi <chad@...pilled.dev>
Cc:     jikos@...nel.org, benjamin.tissoires@...hat.com, spbnick@...il.com,
        pobrn@...tonmail.com, linux-input@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Andreas Grosse <andig.mail@...nline.de>
Subject: Re: [PATCH v2] HID: uclogic: Add support for XP-PEN Deco LW

On Sat, 2022-10-29 at 16:55 +0200, José Expósito wrote:
> Hi!
> 
> On Sat, Oct 29, 2022 at 04:55:21PM +0300, Mia Kanashi wrote:
> > > > [1] Actually it should be set to discharging until this gets
> > > > merged:
> > > >   
> > > > https://lore.kernel.org/linux-input/20221028181849.23157-1-jose.exposito89@gmail.com/T/
> > > 
> > > But i also currently applied this ^ patch, i will try testing
> > > without it and then report.
> > 
> > Tested without it, same issue.
> > So yeah it seems that hid-input driver can set supply status to
> > discharging before setting a battery capacity? 
> 
> Very good catch. I managed to reproduce it using the USB dongle. I
> didn't notice it before because I was running upower after connecting
> the device, which isn't fast enough. However, using watch as you
> suggested makes the issue pretty noticeable.
> 
> The problem is that the battery is fetched when the USB dongle is
> connected. However, the tablet might not be paired at that point.
> 
> To explain it with the actual code:
> 
> 
>   if (dev->battery_status != HID_BATTERY_REPORTED &&
>       !dev->battery_avoid_query) {
>         value = hidinput_query_battery_capacity(dev);
>                 ^ Here the battery is fetched, but because the tabled
>                   is not paired and this function returns garbage
>         if (value < 0)
>                 return value;
> 
>         dev->battery_capacity = value;
>         dev->battery_status = HID_BATTERY_QUERIED;
>                             ^ Now the battery is set as queried
>   }
> 
>   if (dev->battery_status == HID_BATTERY_UNKNOWN)
>         val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
>   else
>         val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
>                     ^ And therefore the battery is reported
> 
> 
> Thankfully, there is already a flag (battery_avoid_query) used to
> solve
> the same issue on stylus. The battery percentage is unknown until the
> stylus is in proximity.
> 
> So I guess I could use the same flag to avoid this problem.
> 
> I'll add a fix in a second revision of this patch.

UPower will also respect the POWER_SUPPLY_PROP_PRESENT property, if
that's useful.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ