linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* HID battery strength does not emit power_suppy udev events
@ 2012-09-15  2:30 Daniel Nicoletti
       [not found] ` <CAD2FfiEbqUvfuUYpgQFaXoUBAn_7TnV4FnGXNDeD-jHCCfpGVQ@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Nicoletti @ 2012-09-15  2:30 UTC (permalink / raw)
  To: linux-input, Richard Hughes

Hi,
it's been a while that my patch to probe the battery
strength of HID devices got upstream, though the probe
is working quite well, upower wasn't, it only worked well
if the device was there before upower starts.
So when adding/removing the device upower didn't update,
and of course I thought the fault was on upower, since on
cold plug it worked...

Well today I decided to add udev support to one of my applications
and decided to see what actually happens on the add/remove
case of my mouse. You can find the whole output
(removing, empty space, then adding) here http://fpaste.org/Uvbh/

So in short there is no udev event being emitted for the power_supply
path, which means upower will never be notified, but when starting
and scanning the udev devices it will find.

But I'm don't know exactly what to do differently since the power_supply
code seems quite right, does anyone has any hints on where to start?

BTW: why HID has to be built-in for this feature to be available (no I didn't
write that part :P )

Best,

-- 
Daniel Nicoletti

KDE Developer - http://dantti.wordpress.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HID battery strength does not emit power_suppy udev events
       [not found]   ` <CACo8zOeSf_0ump=ChJKvgLQL1_OVoOE5Ts0ybw=5S3ZFMzZcGw@mail.gmail.com>
@ 2012-12-28  0:16     ` Daniel Nicoletti
  2013-01-01 19:46       ` Przemo Firszt
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Nicoletti @ 2012-12-28  0:16 UTC (permalink / raw)
  To: Jeremy Fitzhardinge, Jiri Kosina, Przemo Firszt, linux-input

Hi, I've sent this message a while ago but forgot to add
linux-input, I'm really willing to give it a final fix to the issue
but I need directions, I really can't see what's wrong with
the udev thing, so again (with linux-input):

The problem is that when a HID device that has a battery
is added to the system it doesn't emit the udev events
for the battery added or removed, which breaks upower..

I reviewed all my previous patch, looked at input-wacom
to see if they did it differently for the battery issue, but
I couldn't find any problem, since I don't have a wacom
tablet maybe it also has the udev bug.

Well I looked through a lots of kernel code paths,
but the best I could find was:

"int kobject_uevent(struct kobject *kobj, enum kobject_action action);

Use the KOBJ_ADD action for when the kobject is first added to the kernel.
This should be done only after any attributes or children of the kobject
have been initialized properly, as userspace will instantly start to look
for them when this call happens."

Which might mean that a call like
kobject_uevent(&dev->kobj, KOBJ_ADD);
that I could only find in base/core.c is called
before the hid power_supply is registered,
I'm not a kernel dev so I might be totally wrong,
I also don't know the exact code path when the
device is added, could someone please give me
a hand on this?

Thanks,

--
Daniel Nicoletti

KDE Developer - http://dantti.wordpress.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HID battery strength does not emit power_suppy udev events
  2012-12-28  0:16     ` Daniel Nicoletti
@ 2013-01-01 19:46       ` Przemo Firszt
       [not found]         ` <CACo8zOf9LdPA_OZSLZp3iQj80+DvVvQh_Wc6Or902SSJ2hMWVg@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Przemo Firszt @ 2013-01-01 19:46 UTC (permalink / raw)
  To: Daniel Nicoletti; +Cc: Jeremy Fitzhardinge, Jiri Kosina, linux-input

Dnia 2012-12-27, czw o godzinie 22:16 -0200, Daniel Nicoletti pisze:
> Hi, I've sent this message a while ago but forgot to add
> linux-input, I'm really willing to give it a final fix to the issue
> but I need directions, I really can't see what's wrong with
> the udev thing, so again (with linux-input):
> 
> The problem is that when a HID device that has a battery
> is added to the system it doesn't emit the udev events
> for the battery added or removed, which breaks upower..s
Hi Daniel,
I have a wacom device with battery. A "udevadm monitor" report when
connecting Intuos4 Wireless over bluetooth: http://pastebin.com/zyaXeqcS

Battery state is only updated when the tablet is in use. 

What kind of problems you have? Intuos4 Wireless battery reporting seems
to be working fine (except wrong name, but that's a gnome issue) 
-- 
Kind regards,
Przemo Firszt



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HID battery strength does not emit power_suppy udev events
       [not found]         ` <CACo8zOf9LdPA_OZSLZp3iQj80+DvVvQh_Wc6Or902SSJ2hMWVg@mail.gmail.com>
@ 2013-01-01 20:56           ` Przemo Firszt
       [not found]             ` <CACo8zOe6muNzxE+u-V3dFD27e-2h9w7267Pk3SAUZFsF-Ok9Vw@mail.gmail.com>
  2013-01-02 15:04           ` Przemo Firszt
  1 sibling, 1 reply; 7+ messages in thread
From: Przemo Firszt @ 2013-01-01 20:56 UTC (permalink / raw)
  To: Daniel Nicoletti; +Cc: linux-input, Jiri Kosina, Jeremy Fitzhardinge

Dnia 2013-01-01, wto o godzinie 18:39 -0200, Daniel Nicoletti pisze:
> Well from your logs you can see the udev emitted an 'add ' for
> wacom_battery, the odd part is that it sends several add for the
> battery.
> Wacom tablets have a different code from handling the battery, i wrote
> the code that'sgeneric for hid devices, and the battery part looks
> like a lot when looking to tje wacom one but it doesn't emits 'add '
> or 'del ' events...
> I'm not kernel dev and after reading docs and digging some code I 'm
> still clueless about it... 

Can you post the code?

Do you have this switched on in your kernel config (default = no)?

config HID_BATTERY_STRENGTH
        bool "Battery level reporting for HID devices"
        depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY
        default n
        ---help---
        This option adds support of reporting battery strength (for HID
devices
        that support this feature) through power_supply class so that
userspace
        tools, such as upower, can display it.

-- 
Kind regards,
Przemo Firszt



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HID battery strength does not emit power_suppy udev events
       [not found]             ` <CACo8zOe6muNzxE+u-V3dFD27e-2h9w7267Pk3SAUZFsF-Ok9Vw@mail.gmail.com>
@ 2013-01-02  3:24               ` Daniel Nicoletti
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Nicoletti @ 2013-01-02  3:24 UTC (permalink / raw)
  To: Przemo Firszt; +Cc: linux-input, Jeremy Fitzhardinge, Jiri Kosina

As you can see on the paste, there are no add events for the power_supply
infrastructure which causes upower not noticing it was added, the same
happens when removed:
http://paste.kde.org/635294/

Best,

--
Daniel Nicoletti

KDE Developer - http://dantti.wordpress.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HID battery strength does not emit power_suppy udev events
       [not found]         ` <CACo8zOf9LdPA_OZSLZp3iQj80+DvVvQh_Wc6Or902SSJ2hMWVg@mail.gmail.com>
  2013-01-01 20:56           ` Przemo Firszt
@ 2013-01-02 15:04           ` Przemo Firszt
  2013-01-02 23:57             ` Daniel Nicoletti
  1 sibling, 1 reply; 7+ messages in thread
From: Przemo Firszt @ 2013-01-02 15:04 UTC (permalink / raw)
  To: Daniel Nicoletti
  Cc: Przemo Firszt, linux-input, Jiri Kosina, Jeremy Fitzhardinge


Dnia 1 Stycznia 2013, 8:39 pm, Wt, Daniel Nicoletti napisał(a):
> Well from your logs you can see the udev emitted an 'add ' for
> wacom_battery, the odd part is that it sends several add for the battery.

It's KERNEL and UDEV, so i think it's OK - no duplicates.

> Wacom tablets have a different code from handling the battery, i wrote the
> code that'sgeneric for hid devices, and the battery part looks like a lot
> when looking to tje wacom one but it doesn't emits 'add ' or 'del '
> events...
> I'm not kernel dev and after reading docs and digging some code I 'm still
> clueless about it...
>
You might add a few "printk" in hidinput_setup_battery (in kernel
drivers/hid/hid-input.c) to see if everything goes OK.

What's your device?
-- 
Regards,
Przemo Firszt

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: HID battery strength does not emit power_suppy udev events
  2013-01-02 15:04           ` Przemo Firszt
@ 2013-01-02 23:57             ` Daniel Nicoletti
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Nicoletti @ 2013-01-02 23:57 UTC (permalink / raw)
  To: Przemo Firszt; +Cc: linux-input, Jiri Kosina, Jeremy Fitzhardinge

2013/1/2 Przemo Firszt <przemo@firszt.eu>:
>
> Dnia 1 Stycznia 2013, 8:39 pm, Wt, Daniel Nicoletti napisał(a):
>> Well from your logs you can see the udev emitted an 'add ' for
>> wacom_battery, the odd part is that it sends several add for the battery.
>
> It's KERNEL and UDEV, so i think it's OK - no duplicates.
>
>> Wacom tablets have a different code from handling the battery, i wrote the
>> code that'sgeneric for hid devices, and the battery part looks like a lot
>> when looking to tje wacom one but it doesn't emits 'add ' or 'del '
>> events...
>> I'm not kernel dev and after reading docs and digging some code I 'm still
>> clueless about it...
>>
> You might add a few "printk" in hidinput_setup_battery (in kernel
> drivers/hid/hid-input.c) to see if everything goes OK.
>
> What's your device?
> --
> Regards,
> Przemo Firszt
>
I have all Apple bluettoth devices (keyboard, mouse, trackpad), this behavior
will happen with any bt device that uses generic HID battery strenth descriptor,
from some docs I read that when registering with udev you must say if the
parent has been registered already, but I can't find the code which describes
that.
There's nothing wrong with my patch regarding the probe for the battery status,
but it clearly doesn't follow some rule to add the power_supply infrastructure,
I wish I could know what is missing...

Best,

--
Daniel Nicoletti

KDE Developer - http://dantti.wordpress.com
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-02 23:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-15  2:30 HID battery strength does not emit power_suppy udev events Daniel Nicoletti
     [not found] ` <CAD2FfiEbqUvfuUYpgQFaXoUBAn_7TnV4FnGXNDeD-jHCCfpGVQ@mail.gmail.com>
     [not found]   ` <CACo8zOeSf_0ump=ChJKvgLQL1_OVoOE5Ts0ybw=5S3ZFMzZcGw@mail.gmail.com>
2012-12-28  0:16     ` Daniel Nicoletti
2013-01-01 19:46       ` Przemo Firszt
     [not found]         ` <CACo8zOf9LdPA_OZSLZp3iQj80+DvVvQh_Wc6Or902SSJ2hMWVg@mail.gmail.com>
2013-01-01 20:56           ` Przemo Firszt
     [not found]             ` <CACo8zOe6muNzxE+u-V3dFD27e-2h9w7267Pk3SAUZFsF-Ok9Vw@mail.gmail.com>
2013-01-02  3:24               ` Daniel Nicoletti
2013-01-02 15:04           ` Przemo Firszt
2013-01-02 23:57             ` Daniel Nicoletti

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).