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

Reply via email to