K750 fixes in hidpp-rework branch

Peter Wu lekensteyn at gmail.com
Wed Aug 28 14:56:30 PDT 2013


On Wednesday 28 August 2013 23:37:12 Julien Danjou wrote:
> On Wed, Aug 28 2013, Peter Wu wrote:
> > Makes sense, please test the updated code in
> > https://git.lekensteyn.nl/upower/?h=hidpp-rework . There is still a FIXME,
> > currently I assume that the device is charging whenever there is light,
> > but
> > this is very likely wrong.
> 
> Obviously it's wrong :), but guess what, I experimented back then and
> determined the values for which the device is considered charging and
> discharging. There's a little smiley on the keyboard indicating this
> when you press a button.
>
> git log shows it:
> 
>   if (lux > 200) {
>           g_object_set (device,
>                         "state", UP_DEVICE_STATE_CHARGING,
>                         "power-supply", TRUE,
>                         NULL);
>   } else if (lux > 0) {
>           g_object_set (device,
>                         "state", UP_DEVICE_STATE_DISCHARGING,
>                         "power-supply", TRUE,
>                         NULL);
>   } else {
>           g_object_set (device,
>                         "state", UP_DEVICE_STATE_DISCHARGING,
>                         "power-supply", FALSE,
>                         NULL);
>   }

OK, I am now using lux > 200 as condition for charging. Since the system does 
not run on the power of this device, I won't set power-supply = TRUE.

> Anyway, this works much better now I get:
> 
> Device: /org/freedesktop/UPower/devices/keyboard_0003o046DoC52Bx0005
>   native-path:         
> /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.1/2-1.1:1.2/0003:046D:C52
> B.0003/0003:046D:C52B.0005 vendor:               Logitech, Inc.
>   model:                K750
>   serial:               5692B2EC
>   power supply:         no
>   updated:              Wed Aug 28 23:35:00 2013 (10 seconds ago)
>   has history:          yes
>   has statistics:       no
>   keyboard
>     present:             yes
>     rechargeable:        yes
>     state:               discharging
>     percentage:          53%
> 
> It still is considered as discharging while having enough light so the
> smiley is happy and says it's charging. There's a bug here I guess.
> 
> Did you see the light meter property too? It's not reported yet at
> least.

I do not own the K750, so I haven't tested it yet. Thanks for testing btw! It 
turns out to be a signedness issue *sigh*. The new code (amended) has been 
pushed, please git pull -f!

> (I'm sorry I didn't have time to dig through the code yet)

For some reason I am at 20 commits now at the hidpp-rework branch. That's a 
lot of changes. Can somebody review and merge once this issue has been sorted 
out?

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/devkit-devel/attachments/20130828/2ec87676/attachment.pgp>


More information about the devkit-devel mailing list