Re: Probe function question

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

 



> On Tue, 2014-06-17 at 09:31 +0200, Vlad Ungureanu wrote:
> > Hello,
> > 
> > I recently started to develop a USB kernel driver for a GoogleSummer Of Code
> > project and I'm running in some small issues. The source code is available at
> > https://github.com/ungureanuvladvictor/ADK-Driver/blob/master/adk-driver.c .
> 
> The debugging printks in your open method (around line 104) are
> obviously wrong. You test for NULL but then use the NULL pointer
> for debugging. The same bug in adk_release().
> 
> adk_delete() has a memory leak. You don't free the buffer.
> In adk_probe() please use the testing macros for endpoint
> type and direction.
> 

This is just a simple bad sketch, will fix all the issues for final tests.

> 
> > The driver matches the VID/PID of a LG Nexus5 and tries in the probe function
> > to switch it to ADK Mode *Accessory Development Kit Mode*. Afterwards the same
> > driver should deal with the device in ADK Mode and should find it's bulk IN/OUT
> > EPs.
> > 
> > The problem is that my probe callback is called twice for each mode of the
> > device, normal mode and ADK mode.
> 
> It is called for each interface.

Found out that already from the answers. :)

> 
> > If you look at this Gist:
> > https://gist.github.com/ungureanuvladvictor/44bc345037916bbd0bf1 lines 19 and
> > 25 is where the probe function is called for the normal device. Lines 58 and 66
> > are for the device in ADK mode. As I read from the documentation the probe
> > callback is called when a device that matches my device_table is found by the
> > usb core. In the log I see that the usb core calls probe for each interface it
> > has: lines 16, 22 and 55, 63.
> 
> USB drivers are drivers for interfaces, not whole devices. Each
> interface of a device is probed separately in turn. If you have
> a device that exposes two mutually exclusive access methods in
> the same configuration, you need to claim the second interface
> for the undesired method in the probe method and refuse to bind
> to the undesired interface in the probe method, as you cannot
> reliably predict which interface is probed first.
> Look at cdc-acm for an example of claiming other interfaces
> from within probe()

Thank you for pointing this hint out.

> 
> 	HTH
> 		Oliver
> 
> 

-- 
Vlad Ungureanu

Attachment: signature.asc
Description: Digital signature


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

  Powered by Linux