linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Driver for something that's neither a device nor an interface driver?
@ 2019-09-27 17:29 Bastien Nocera
  2019-09-27 17:38 ` Greg KH
  2019-09-27 17:56 ` Alan Stern
  0 siblings, 2 replies; 15+ messages in thread
From: Bastien Nocera @ 2019-09-27 17:29 UTC (permalink / raw)
  To: linux-usb; +Cc: benjamin.tissoires

Hey,

I'm trying to write a "power supply" class driver for Apple MFi
devices, and struggling a little with the USB drivers.

To ask many Apple devices to draw more power, we need to make a call to
the device using a vendor command. It doesn't go to an interface, but
to the device itself.

The call done in the kernel would look something like:
usb_control_msg(mfi->udev, usb_sndctrlpipe(mfi->udev, 0), 
                0x40, /* Vendor-defined USB get enabled capabilities request. */
                USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
                current_ma, /* wValue, current offset */
                current_ma, /* wIndex, current offset */
                NULL, 0, USB_CTRL_GET_TIMEOUT);

But I can't figure out what type of driver I'd need to just be able to
export that power_supply interface.

Trying to use a "struct usb_device_driver" didn't work as probe
functions were never called, and a "struct usb_driver" gets unbound
after user-space and the ipheth drivers comes around.

This is my "struct usb_driver" attempt:
https://github.com/hadess/apple-mfi-fastcharge

Any ideas what type of driver, or what trick I should be using here?

Cheers


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

end of thread, other threads:[~2019-09-28 12:57 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27 17:29 Driver for something that's neither a device nor an interface driver? Bastien Nocera
2019-09-27 17:38 ` Greg KH
2019-09-27 17:44   ` Bastien Nocera
2019-09-27 18:57     ` Greg KH
2019-09-27 19:08       ` Bastien Nocera
2019-09-27 17:56 ` Alan Stern
2019-09-27 18:49   ` Bastien Nocera
2019-09-27 19:25     ` Greg KH
2019-09-27 20:12       ` Bastien Nocera
2019-09-28  7:39         ` Greg KH
2019-09-28 10:42           ` Bastien Nocera
2019-09-28 12:18             ` Greg KH
2019-09-28 12:37               ` Bastien Nocera
2019-09-28 12:57                 ` Greg KH
2019-09-27 20:21     ` Alan Stern

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