mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Enabling multiple gadgets on top of composite driver
@ 2012-04-13 10:51 Bhupesh SHARMA
  2012-04-13 10:59 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Bhupesh SHARMA @ 2012-04-13 10:51 UTC (permalink / raw)
  To: balbi; +Cc: gregkh, linux-usb, linux-kernel, stern

Hi,

I have a query regarding enabling multiple gadgets (like g_webcam, g_zero etc..)
on top of the Composite driver.

My use case is very simple:
	- I want to expose a USB composite device to a standard USB host, where
	  the Composite device supports a webcam gadget + zero gadget + some other gadget..

On the older kernels like 2.6.27, this was easily possible, but the latest
gadget code doesn't seem to support the same:
	- I can see that first a 'choicemenu' is provided which allows selection of only
	  one gadget at a time.

	- The "common" stuff like "composite.c", "epautoconfig.c" have been included in
	  each f_* function driver (for e.g. f_uvc.c, f_sourcesink.c, etc..), so even if
	  I somehow tweak the 'choicemenu' stuff, I get redeclaration errors.

	- If I somehow separate the "common" stuff and compile the same separately and
	  then compile zero gadget, webcam gadget etc.., I see that the 'usb_composite_probe'
	  call of only the 1st gadget passes correctly, but from the 2nd gadget driver
        onwards as 'composite' is already present the following check in 'usb_composite_probe'
	  fails:

		if(!driver || !driver->dev || !bind || composite)
			return -EINVAL;

I am hoping someone else must also have faced an issue like this before..

What is the best way to enable multiple gadgets (like g_webcam, g_zero etc..)
on top of the Composite driver or am I missing something here?

Regards,
Bhupesh
	
 

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

* Re: Enabling multiple gadgets on top of composite driver
  2012-04-13 10:51 Enabling multiple gadgets on top of composite driver Bhupesh SHARMA
@ 2012-04-13 10:59 ` Felipe Balbi
  2012-04-16  8:15   ` Bhupesh SHARMA
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2012-04-13 10:59 UTC (permalink / raw)
  To: Bhupesh SHARMA; +Cc: balbi, gregkh, linux-usb, linux-kernel, stern

[-- Attachment #1: Type: text/plain, Size: 1567 bytes --]

On Fri, Apr 13, 2012 at 06:51:26PM +0800, Bhupesh SHARMA wrote:
> Hi,
> 
> I have a query regarding enabling multiple gadgets (like g_webcam, g_zero etc..)
> on top of the Composite driver.
> 
> My use case is very simple:
> 	- I want to expose a USB composite device to a standard USB host, where
> 	  the Composite device supports a webcam gadget + zero gadget + some other gadget..

look at how nokia.c does it.

> On the older kernels like 2.6.27, this was easily possible, but the latest
> gadget code doesn't seem to support the same:
> 	- I can see that first a 'choicemenu' is provided which allows selection of only
> 	  one gadget at a time.

Answer M instead of Y to "USB Gadget Drivers"

> 	- The "common" stuff like "composite.c", "epautoconfig.c" have been included in
> 	  each f_* function driver (for e.g. f_uvc.c, f_sourcesink.c, etc..), so even if
> 	  I somehow tweak the 'choicemenu' stuff, I get redeclaration errors.

yeah, that still needs to be cleaned up. The story behind that is very
long.

> What is the best way to enable multiple gadgets (like g_webcam, g_zero
> etc..) on top of the Composite driver or am I missing something here?

Either you want multiple gadgets or you want a composite gadget, what is
it ? If you want a composite gadget, you need to write a small C file
which combines multiple functions together (see nokia.c), if you want
multiple gadget drivers, just make them all modules. I always compile
all gadget drivers as modules and can use any one of them at any time.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* RE: Enabling multiple gadgets on top of composite driver
  2012-04-13 10:59 ` Felipe Balbi
@ 2012-04-16  8:15   ` Bhupesh SHARMA
  0 siblings, 0 replies; 3+ messages in thread
From: Bhupesh SHARMA @ 2012-04-16  8:15 UTC (permalink / raw)
  To: balbi; +Cc: gregkh, linux-usb, linux-kernel, stern

Hi Felipe,

> -----Original Message-----
> From: Felipe Balbi [mailto:balbi@ti.com]
> Sent: Friday, April 13, 2012 4:29 PM
> To: Bhupesh SHARMA
> Cc: balbi@ti.com; gregkh@linuxfoundation.org; linux-
> usb@vger.kernel.org; linux-kernel@vger.kernel.org;
> stern@rowland.harvard.edu
> Subject: Re: Enabling multiple gadgets on top of composite driver
> 
> On Fri, Apr 13, 2012 at 06:51:26PM +0800, Bhupesh SHARMA wrote:
> > Hi,
> >
> > I have a query regarding enabling multiple gadgets (like g_webcam,
> > g_zero etc..) on top of the Composite driver.
> >
> > My use case is very simple:
> > 	- I want to expose a USB composite device to a standard USB host,
> where
> > 	  the Composite device supports a webcam gadget + zero gadget +
> some other gadget..
> 
> look at how nokia.c does it.

Ok.
 
> > On the older kernels like 2.6.27, this was easily possible, but the
> > latest gadget code doesn't seem to support the same:
> > 	- I can see that first a 'choicemenu' is provided which allows
> selection of only
> > 	  one gadget at a time.
> 
> Answer M instead of Y to "USB Gadget Drivers"
> 
> > 	- The "common" stuff like "composite.c", "epautoconfig.c" have
> been included in
> > 	  each f_* function driver (for e.g. f_uvc.c, f_sourcesink.c,
> etc..), so even if
> > 	  I somehow tweak the 'choicemenu' stuff, I get redeclaration
> errors.
> 
> yeah, that still needs to be cleaned up. The story behind that is very
> long.
> 
> > What is the best way to enable multiple gadgets (like g_webcam,
> g_zero
> > etc..) on top of the Composite driver or am I missing something here?
> 
> Either you want multiple gadgets or you want a composite gadget, what
> is it ? If you want a composite gadget, you need to write a small C
> file which combines multiple functions together (see nokia.c), if you
> want multiple gadget drivers, just make them all modules. I always
> compile all gadget drivers as modules and can use any one of them at
> any time.
> 

Thanks for your help.
I need to support multiple functions over a composite gadget. I will now
have a quick look at the 'nokia.c' driver.

Regards,
Bhupesh

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

end of thread, other threads:[~2012-04-16  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 10:51 Enabling multiple gadgets on top of composite driver Bhupesh SHARMA
2012-04-13 10:59 ` Felipe Balbi
2012-04-16  8:15   ` Bhupesh SHARMA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®