Re: usb: gadget: automatic remote wakeup on hid write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 28, 2024 at 04:09:30PM +0100, Bart Van Severen wrote:
> On Fri, Oct 25, 2024 at 9:37 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Thu, Oct 24, 2024 at 11:37:50AM +0200, Bart Van Severen wrote:
> > > Hi,
> > >
> > > We have a use case to remote control a pc through a composite gadget
> > > consisting of keyboard, mouse and tablet functions.
> > > The problem we face is that when the pc is sent to sleep, we cannot
> > > wake it by writing to the hid device, which is what you
> > > would expect to work.
> > >
> > > We're running on Xilinx Zynqmp soc/DWC3 290A.
> > >
> > > We have set the bmAttributes ch9 USB_CONFIG_ATT_WAKEUP bit and do see
> > > the set_feature request to enable remote
> > > wakeup, just before the pc goes to sleep.
> >
> > Do you see a wakeup request from the gadget to the host?
> 
> No, I don't see any wakeup request towards the host.

As one would expect, given that there was no call to 
usb_gadget_wakeup().

> > > We noticed the recent relevant work
> > > https://lore.kernel.org/linux-usb/1679694482-16430-1-git-send-email-quic_eserrao@xxxxxxxxxxx/,
> > > regarding function suspend/resume and remote wakeup improvements.
> > >
> > > However, the main question we have is: what would be the right place
> > > in the gadget framework to fix the issue where a hid write
> > > doesn't trigger a remote wake up when the usb device is suspended and
> > > the host has enabled remote wakeup.
> >
> > Probably the drivers/usb/gadget/function/f_hid.c file.  I don't know
> > anything about how this gadget driver works, but the file doesn't have
> > any calls to usb_gadget_wakeup(), which means it won't generate a wakeup
> > request no matter what you write to it.
> >
> > Alan Stern
> >
> 
> That's what my initial thought was also, and that certainly works.
> But then I wondered if it isn't a better idea to handle this further down, to
> avoid having to write similar code in all function drivers, say in the
> gadget core?

The gadget core doesn't know when the user wants to issue a wakeup 
request; only the function driver knows this.  (For instance, only 
f_hid.c knows when there has been an hid write.)  And the whole point of 
usb_gadget_wakeup() is that it provides a way for the function drivers 
to tell the gadget core to issue a wakeup request.

Alan Stern




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux