Re: Driver for something that's neither a device nor an interface driver?

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

 



On Fri, Sep 27, 2019 at 07:29:52PM +0200, Bastien Nocera wrote:
> 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.

What does the usb descriptors for the device look like?  Is it only the
"default" control endpoint and no interfaces?  What does the output of
'usbdevices' show for the device?

Normally you just bind to the "default" interface for the device, and
all is good, there should be a few other drivers in the tree that do
this, but I can't think of one off the top of my head at the moment.

thanks,

greg k-h



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

  Powered by Linux