All of lore.kernel.org
 help / color / mirror / Atom feed
* Method to power off HID device from driver?
@ 2016-12-02  2:05 Roderick Colenbrander
  2016-12-07  0:25 ` Roderick Colenbrander
  0 siblings, 1 reply; 12+ messages in thread
From: Roderick Colenbrander @ 2016-12-02  2:05 UTC (permalink / raw)
  To: linux-input

Hi,

Some of the devices I'm dealing with have methods to disconnect the
device through HID reports. This is mostly useful for wireless devices
to save battery and power them off e.g. when no activity in a wihle or
user wants to turn device off (some devices don't have a power off
button).

I was trying to figure out if it there is some generic way without
inventing a driver specific method. So far I haven't found anything on
the HID side. The use case is not that common often a user would
unplug a cable, but for some devices there is no real other way.

The closest thing I found was 'poweroff' as supported by device power
management spec:
https://www.kernel.org/doc/Documentation/power/devices.txt. The HID
drivers only support a subset of this so far.

Does anyone have a good suggestion for handling this?

Thanks,
Roderick

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

* Re: Method to power off HID device from driver?
  2016-12-02  2:05 Method to power off HID device from driver? Roderick Colenbrander
@ 2016-12-07  0:25 ` Roderick Colenbrander
  2016-12-07  3:20   ` Cameron Gutman
  0 siblings, 1 reply; 12+ messages in thread
From: Roderick Colenbrander @ 2016-12-07  0:25 UTC (permalink / raw)
  To: linux-input

Hi,

I looked a bit deeper and found EV_PWR, though it isn't clearly
defined, but it is used in some places for purposes like this. Would
this be an acceptable method?

Thanks,
Roderick

On Thu, Dec 1, 2016 at 6:05 PM, Roderick Colenbrander
<roderick@gaikai.com> wrote:
> Hi,
>
> Some of the devices I'm dealing with have methods to disconnect the
> device through HID reports. This is mostly useful for wireless devices
> to save battery and power them off e.g. when no activity in a wihle or
> user wants to turn device off (some devices don't have a power off
> button).
>
> I was trying to figure out if it there is some generic way without
> inventing a driver specific method. So far I haven't found anything on
> the HID side. The use case is not that common often a user would
> unplug a cable, but for some devices there is no real other way.
>
> The closest thing I found was 'poweroff' as supported by device power
> management spec:
> https://www.kernel.org/doc/Documentation/power/devices.txt. The HID
> drivers only support a subset of this so far.
>
> Does anyone have a good suggestion for handling this?
>
> Thanks,
> Roderick



-- 
Roderick Colenbrander
Senior Manager of Software Engineering
Gaikai, a Sony Interactive Entertainment Company
roderick@gaikai.com

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

* Re: Method to power off HID device from driver?
  2016-12-07  0:25 ` Roderick Colenbrander
@ 2016-12-07  3:20   ` Cameron Gutman
  2016-12-07 21:21     ` Roderick Colenbrander
  2016-12-08  3:39     ` Bastien Nocera
  0 siblings, 2 replies; 12+ messages in thread
From: Cameron Gutman @ 2016-12-07  3:20 UTC (permalink / raw)
  To: Roderick Colenbrander; +Cc: linux-input

Hi,

> On Dec 6, 2016, at 4:25 PM, Roderick Colenbrander <roderick@gaikai.com> wrote:
> 
> Hi,
> 
> I looked a bit deeper and found EV_PWR, though it isn't clearly
> defined, but it is used in some places for purposes like this. Would
> this be an acceptable method?
> 

I am interested in this too. I recently implemented the ability to
turn off wireless Xbox 360 controllers in [0], but there is no way
to activate this functionality without suspending the whole system.
Some folks [1] have asked for this ability in other scenarios.

[0]: Commit f712a5a05228058f6b74 ("Input: xpad - power off wireless
                                   360 controllers on suspend")
[1]: https://github.com/paroj/xpad/issues/52

> Thanks,
> Roderick
> 
> On Thu, Dec 1, 2016 at 6:05 PM, Roderick Colenbrander
> <roderick@gaikai.com> wrote:
>> Hi,
>> 
>> Some of the devices I'm dealing with have methods to disconnect the
>> device through HID reports. This is mostly useful for wireless devices
>> to save battery and power them off e.g. when no activity in a wihle or
>> user wants to turn device off (some devices don't have a power off
>> button).
>> 
>> I was trying to figure out if it there is some generic way without
>> inventing a driver specific method. So far I haven't found anything on
>> the HID side. The use case is not that common often a user would
>> unplug a cable, but for some devices there is no real other way.
>> 
>> The closest thing I found was 'poweroff' as supported by device power
>> management spec:
>> https://www.kernel.org/doc/Documentation/power/devices.txt. The HID
>> drivers only support a subset of this so far.
>> 
>> Does anyone have a good suggestion for handling this?
>> 
>> Thanks,
>> Roderick
> 
> 
> 
> -- 
> Roderick Colenbrander
> Senior Manager of Software Engineering
> Gaikai, a Sony Interactive Entertainment Company
> roderick@gaikai.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] 12+ messages in thread

* Re: Method to power off HID device from driver?
  2016-12-07  3:20   ` Cameron Gutman
@ 2016-12-07 21:21     ` Roderick Colenbrander
  2016-12-08  3:39     ` Bastien Nocera
  1 sibling, 0 replies; 12+ messages in thread
From: Roderick Colenbrander @ 2016-12-07 21:21 UTC (permalink / raw)
  To: Cameron Gutman; +Cc: linux-input

On Tue, Dec 6, 2016 at 7:20 PM, Cameron Gutman <aicommander@gmail.com> wrote:
> Hi,
>
>> On Dec 6, 2016, at 4:25 PM, Roderick Colenbrander <roderick@gaikai.com> wrote:
>>
>> Hi,
>>
>> I looked a bit deeper and found EV_PWR, though it isn't clearly
>> defined, but it is used in some places for purposes like this. Would
>> this be an acceptable method?
>>
>
> I am interested in this too. I recently implemented the ability to
> turn off wireless Xbox 360 controllers in [0], but there is no way
> to activate this functionality without suspending the whole system.
> Some folks [1] have asked for this ability in other scenarios.
>
> [0]: Commit f712a5a05228058f6b74 ("Input: xpad - power off wireless
>                                    360 controllers on suspend")
> [1]: https://github.com/paroj/xpad/issues/52
>
>> Thanks,
>> Roderick
>>
>> On Thu, Dec 1, 2016 at 6:05 PM, Roderick Colenbrander
>> <roderick@gaikai.com> wrote:
>>> Hi,
>>>
>>> Some of the devices I'm dealing with have methods to disconnect the
>>> device through HID reports. This is mostly useful for wireless devices
>>> to save battery and power them off e.g. when no activity in a wihle or
>>> user wants to turn device off (some devices don't have a power off
>>> button).
>>>
>>> I was trying to figure out if it there is some generic way without
>>> inventing a driver specific method. So far I haven't found anything on
>>> the HID side. The use case is not that common often a user would
>>> unplug a cable, but for some devices there is no real other way.
>>>
>>> The closest thing I found was 'poweroff' as supported by device power
>>> management spec:
>>> https://www.kernel.org/doc/Documentation/power/devices.txt. The HID
>>> drivers only support a subset of this so far.
>>>
>>> Does anyone have a good suggestion for handling this?
>>>
>>> Thanks,
>>> Roderick
>>
>>
>>
>> --
>> Roderick Colenbrander
>> Senior Manager of Software Engineering
>> Gaikai, a Sony Interactive Entertainment Company
>> roderick@gaikai.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
>

Great, I was actually about to look at the xpad driver, because I saw
the auto_poweroff. The poweroff functionality you desire for xpad is
the same as I need as well.

I'm doing some more digging in the best way of handling this, but not
much luck. The best lead I have is the 'input_dev_poweroff' call in
drivers/input/input.c. I wonder if this call should get a callback,
which drivers can optionally provide to do a poweroff. So far I'm not
exactly sure how this poweroff is triggered and whether it is the
appropriate thing to hook into.

Any suggestions welcome :)

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

* Re: Method to power off HID device from driver?
  2016-12-07  3:20   ` Cameron Gutman
  2016-12-07 21:21     ` Roderick Colenbrander
@ 2016-12-08  3:39     ` Bastien Nocera
  2017-01-10  2:28       ` Roderick Colenbrander
  1 sibling, 1 reply; 12+ messages in thread
From: Bastien Nocera @ 2016-12-08  3:39 UTC (permalink / raw)
  To: Cameron Gutman, Roderick Colenbrander; +Cc: linux-input

On Tue, 2016-12-06 at 19:20 -0800, Cameron Gutman wrote:
> Hi,
> 
> > On Dec 6, 2016, at 4:25 PM, Roderick Colenbrander <roderick@gaikai.
> > com> wrote:
> > 
> > Hi,
> > 
> > I looked a bit deeper and found EV_PWR, though it isn't clearly
> > defined, but it is used in some places for purposes like this.
> > Would
> > this be an acceptable method?
> > 
> 
> I am interested in this too. I recently implemented the ability to
> turn off wireless Xbox 360 controllers in [0], but there is no way
> to activate this functionality without suspending the whole system.
> Some folks [1] have asked for this ability in other scenarios.
> 
> [0]: Commit f712a5a05228058f6b74 ("Input: xpad - power off wireless
>                                    360 controllers on suspend")
> [1]: https://github.com/paroj/xpad/issues/52

Ditto the PS3 BD remote driver, when moving to the kernel, lost its
ability to suspend after X minutes, which drains the AA batteries
inside it.

In the original system, the remote would get disconnected after less
than a couple of minutes, and reconnect as soon as you pressed a
button, and make sure that button got sent to the device.

Would be great if we could control this from user-space.

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

* Re: Method to power off HID device from driver?
  2016-12-08  3:39     ` Bastien Nocera
@ 2017-01-10  2:28       ` Roderick Colenbrander
  2017-01-19 13:37         ` Jiri Kosina
  0 siblings, 1 reply; 12+ messages in thread
From: Roderick Colenbrander @ 2017-01-10  2:28 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Cameron Gutman, linux-input, Benjamin Tissoires, Jiri Kosina

On Wed, Dec 7, 2016 at 7:39 PM, Bastien Nocera <hadess@hadess.net> wrote:
> On Tue, 2016-12-06 at 19:20 -0800, Cameron Gutman wrote:
>> Hi,
>>
>> > On Dec 6, 2016, at 4:25 PM, Roderick Colenbrander <roderick@gaikai.
>> > com> wrote:
>> >
>> > Hi,
>> >
>> > I looked a bit deeper and found EV_PWR, though it isn't clearly
>> > defined, but it is used in some places for purposes like this.
>> > Would
>> > this be an acceptable method?
>> >
>>
>> I am interested in this too. I recently implemented the ability to
>> turn off wireless Xbox 360 controllers in [0], but there is no way
>> to activate this functionality without suspending the whole system.
>> Some folks [1] have asked for this ability in other scenarios.
>>
>> [0]: Commit f712a5a05228058f6b74 ("Input: xpad - power off wireless
>>                                    360 controllers on suspend")
>> [1]: https://github.com/paroj/xpad/issues/52
>
> Ditto the PS3 BD remote driver, when moving to the kernel, lost its
> ability to suspend after X minutes, which drains the AA batteries
> inside it.
>
> In the original system, the remote would get disconnected after less
> than a couple of minutes, and reconnect as soon as you pressed a
> button, and make sure that button got sent to the device.
>
> Would be great if we could control this from user-space.

>From the sounds of it various others are interested in the ability to
trigger a device disconnect as well. Since I don't think any of us
have a good enough understanding of the HID / input frameworks, I'm
adding Benjamin and Jiri. Maybe they have some good ideas on how to
tackle this.

Thanks,
Roderick

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

* Re: Method to power off HID device from driver?
  2017-01-10  2:28       ` Roderick Colenbrander
@ 2017-01-19 13:37         ` Jiri Kosina
  2017-01-19 13:42           ` Bastien Nocera
  0 siblings, 1 reply; 12+ messages in thread
From: Jiri Kosina @ 2017-01-19 13:37 UTC (permalink / raw)
  To: Roderick Colenbrander
  Cc: Bastien Nocera, Cameron Gutman, linux-input, Benjamin Tissoires

On Mon, 9 Jan 2017, Roderick Colenbrander wrote:

> From the sounds of it various others are interested in the ability to
> trigger a device disconnect as well. Since I don't think any of us
> have a good enough understanding of the HID / input frameworks, I'm
> adding Benjamin and Jiri. Maybe they have some good ideas on how to
> tackle this.

Well, this really depends on the low-level (transport, as we call it in 
HID) driver.

USB, for example, has it's own runtime power management, and the devices 
auto-suspend and auto-resume themselves almost automatically without too 
many specific generic code requirements.

What is the hardware transport we're talking about here?

-- 
Jiri Kosina
SUSE Labs


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

* Re: Method to power off HID device from driver?
  2017-01-19 13:37         ` Jiri Kosina
@ 2017-01-19 13:42           ` Bastien Nocera
       [not found]             ` <CANndSKkp+wYjp4DpWX5VK7MLWEn60tgcc5QX=r87gPQJKvkoPg@mail.gmail.com>
  0 siblings, 1 reply; 12+ messages in thread
From: Bastien Nocera @ 2017-01-19 13:42 UTC (permalink / raw)
  To: Jiri Kosina, Roderick Colenbrander
  Cc: Cameron Gutman, linux-input, Benjamin Tissoires

On Thu, 2017-01-19 at 14:37 +0100, Jiri Kosina wrote:
> On Mon, 9 Jan 2017, Roderick Colenbrander wrote:
> 
> > From the sounds of it various others are interested in the ability
> > to
> > trigger a device disconnect as well. Since I don't think any of us
> > have a good enough understanding of the HID / input frameworks, I'm
> > adding Benjamin and Jiri. Maybe they have some good ideas on how to
> > tackle this.
> 
> Well, this really depends on the low-level (transport, as we call it
> in 
> HID) driver.
> 
> USB, for example, has it's own runtime power management, and the
> devices 
> auto-suspend and auto-resume themselves almost automatically without
> too 
> many specific generic code requirements.
> 
> What is the hardware transport we're talking about here?

>From my side, it's Bluetooth.

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

* Re: Method to power off HID device from driver?
       [not found]             ` <CANndSKkp+wYjp4DpWX5VK7MLWEn60tgcc5QX=r87gPQJKvkoPg@mail.gmail.com>
@ 2017-01-19 16:26               ` Bastien Nocera
  2017-01-19 18:07                 ` Roderick Colenbrander
  0 siblings, 1 reply; 12+ messages in thread
From: Bastien Nocera @ 2017-01-19 16:26 UTC (permalink / raw)
  To: Roderick Colenbrander
  Cc: Benjamin Tissoires, linux-input, Jiri Kosina, Cameron Gutman

On Thu, 2017-01-19 at 08:18 -0800, Roderick Colenbrander wrote:
> In my case it are Hid packets to trigger a disconnect. 

"HID packets" isn't a hardware transport.

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

* Re: Method to power off HID device from driver?
  2017-01-19 16:26               ` Bastien Nocera
@ 2017-01-19 18:07                 ` Roderick Colenbrander
  2017-01-24  9:47                   ` Bastien Nocera
  0 siblings, 1 reply; 12+ messages in thread
From: Roderick Colenbrander @ 2017-01-19 18:07 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Benjamin Tissoires, linux-input, Jiri Kosina, Cameron Gutman

On Thu, Jan 19, 2017 at 8:26 AM, Bastien Nocera <hadess@hadess.net> wrote:
> On Thu, 2017-01-19 at 08:18 -0800, Roderick Colenbrander wrote:
>> In my case it are Hid packets to trigger a disconnect.
>
> "HID packets" isn't a hardware transport.

My reply was a little too quick. The devices we like this capability
for are Bluetooth and USB based, so for Bluetooth we care about uhid /
bt-hidp and for USB usb-hid.

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

* Re: Method to power off HID device from driver?
  2017-01-19 18:07                 ` Roderick Colenbrander
@ 2017-01-24  9:47                   ` Bastien Nocera
  2017-01-24 15:29                     ` Roderick Colenbrander
  0 siblings, 1 reply; 12+ messages in thread
From: Bastien Nocera @ 2017-01-24  9:47 UTC (permalink / raw)
  To: Roderick Colenbrander
  Cc: Benjamin Tissoires, linux-input, Jiri Kosina, Cameron Gutman

On Thu, 2017-01-19 at 10:07 -0800, Roderick Colenbrander wrote:
> On Thu, Jan 19, 2017 at 8:26 AM, Bastien Nocera <hadess@hadess.net>
> wrote:
> > On Thu, 2017-01-19 at 08:18 -0800, Roderick Colenbrander wrote:
> > > In my case it are Hid packets to trigger a disconnect.
> > 
> > "HID packets" isn't a hardware transport.
> 
> My reply was a little too quick. The devices we like this capability
> for are Bluetooth and USB based, so for Bluetooth we care about uhid
> /
> bt-hidp and for USB usb-hid.

What's the use case for USB based devices? Is this to "switch off" pads
like on XBox and Playstation consoles? I'm pretty sure the devices are
still on. Do you expect an unplug/replug to be necessary for USB
devices?

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

* Re: Method to power off HID device from driver?
  2017-01-24  9:47                   ` Bastien Nocera
@ 2017-01-24 15:29                     ` Roderick Colenbrander
  0 siblings, 0 replies; 12+ messages in thread
From: Roderick Colenbrander @ 2017-01-24 15:29 UTC (permalink / raw)
  To: Bastien Nocera
  Cc: Benjamin Tissoires, linux-input, Jiri Kosina, Cameron Gutman

On Tue, Jan 24, 2017 at 1:47 AM, Bastien Nocera <hadess@hadess.net> wrote:
> On Thu, 2017-01-19 at 10:07 -0800, Roderick Colenbrander wrote:
>> On Thu, Jan 19, 2017 at 8:26 AM, Bastien Nocera <hadess@hadess.net>
>> wrote:
>> > On Thu, 2017-01-19 at 08:18 -0800, Roderick Colenbrander wrote:
>> > > In my case it are Hid packets to trigger a disconnect.
>> >
>> > "HID packets" isn't a hardware transport.
>>
>> My reply was a little too quick. The devices we like this capability
>> for are Bluetooth and USB based, so for Bluetooth we care about uhid
>> /
>> bt-hidp and for USB usb-hid.
>
> What's the use case for USB based devices? Is this to "switch off" pads
> like on XBox and Playstation consoles? I'm pretty sure the devices are
> still on. Do you expect an unplug/replug to be necessary for USB
> devices?

The main use case for USB devices is the PlayStation dongle which is a
device which can be used to use a DS4 on a PC. Behind the scenes a USB
to Bluetooth bridge, but it hides the Bluetooth from the OS. The
dongle would always be on, but a way is needed to disconnect the DS4
from it else the battery would drain. I don't intend to turn off the
dongle itself or a USB connected DS4, I suspect that's already doable
somehow through USB sysfs nodes nor do I know of a HID method to
disconnect the device in those cases.

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

end of thread, other threads:[~2017-01-24 15:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02  2:05 Method to power off HID device from driver? Roderick Colenbrander
2016-12-07  0:25 ` Roderick Colenbrander
2016-12-07  3:20   ` Cameron Gutman
2016-12-07 21:21     ` Roderick Colenbrander
2016-12-08  3:39     ` Bastien Nocera
2017-01-10  2:28       ` Roderick Colenbrander
2017-01-19 13:37         ` Jiri Kosina
2017-01-19 13:42           ` Bastien Nocera
     [not found]             ` <CANndSKkp+wYjp4DpWX5VK7MLWEn60tgcc5QX=r87gPQJKvkoPg@mail.gmail.com>
2017-01-19 16:26               ` Bastien Nocera
2017-01-19 18:07                 ` Roderick Colenbrander
2017-01-24  9:47                   ` Bastien Nocera
2017-01-24 15:29                     ` Roderick Colenbrander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.