Re: Remote wake up in gadget drivers

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

 



On Fri, Jun 28, 2024 at 6:27 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
>
> > I assume that to take advantage of remote wake up, the device needs to
> > first of all set the USB_DEVICE_REMOTE_WAKEUP bit in bmAttributes.
>
> That bit gets set when the host tells the gadget to enable remote
> wakeup.  And generally the UDC driver handles this, not the gadget
> driver.

Right, sorry, I meant the USB_CONFIG_ATT_WAKEUP bit.

> > But then, is the wake up supposed to be initiated through the gadget
> > driver or through the UDC sysfs files as the ones that Darrion
> > mentioned?
>
> The wakeup request is initiated by the gadget driver calling
> usb_gadget_wakeup().
>
> > For the former case, I assume that adding a new ioctl to Raw Gadget
> > that calls usb_gadget_wakeup() would be a way to support this?
>
> Yes.
>
> > AFAICS, only the g_zero gadget driver calls usb_gadget_wakeup(). Do
> > the other gadget drivers just have no support for remote wake up?
>
> Grep shows that function/u_ether.c also calls usb_gadget_wakeup().  I
> don't know about most of the gadget drivers.  The f_mass_storage driver
> has no need for remote wakeup, for example, and the same is probably
> true for a lot of the others.  You'd think that the f_hid function would
> support remote wakeup, but maybe nobody ever implemented it.

Understood, thank you!

Darrion, you can try adding a new Raw Gadget ioctl that calls
usb_gadget_wakeup() and see if that works for you. This shouldn't be
hard: just add another handler to raw_ioctl().

And you probably also still need to set the USB_CONFIG_ATT_WAKEUP bit
in the USB config descriptor in the Raw Gadget keyboard example.

For a proper remote wake up support, I think we would also need
another two ioctls: one for checking whether the UDC supports remote
wake up and one for checking whether the device is suspended (the
former can be combined with reporting other UDC capabilities:
https://github.com/xairy/raw-gadget/issues/41).





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

  Powered by Linux