Re: Newbie interested in using usbfs2.

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

 



Hi,

I agree with Alan analysis: you need one driver that create two instance of device, each managing 2 ep.

I just signal to you, but really take as last chance, http://sourceforge.net/projects/usu.

This is a 'meta driver', in the sense that filling two data structure at beginning of main source file usersU.c, you can manage any urb type and then see exported in proc file system, one object per endpoint pair. 

This project is tested with 2 usb application, audio device and bluetooth adapter (this is only the kernel part).
As example, this is the work to do for an audio device:

/* Endpoint# indexed, Object class (see later). */
static struct LinkT topol[]={
	{{0x00, 0}}, /* Never pass under our probe() already created.*/
	{{0x81, 0}},
	{{0x06, 10}},
	{{0x85, 10}},
};
/* Interface# indexed, Alternate setting */
static struct LinkT intf[]={
	{{1, 1}},
	{{2, 1}},
};

File /dev/USBDo/isoc, /dev/USBDo/intr is created
(For your case a little rework on file naming scheme is needed)

In the case you would like more info you can send me an email, perhaps without put in cc this mailing list to avoid to bore most people.

Have a good day
--- Mar 7/7/09, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> ha scritto:

> Da: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Oggetto: Re: Newbie interested in using usbfs2.
> A: "Sylvain PORTES" <portes.sylvain@xxxxxxxxx>
> Cc: linux-usb@xxxxxxxxxxxxxxx
> Data: Martedì 7 luglio 2009, 03:47
> On Mon, 6 Jul 2009, Sylvain PORTES
> wrote:
> 
> > Dear Alan,
> > 
> > Thanks a lot for your answer.
> > 
> > It seems I still have some code reverse engineering to
> do to find the
> > good example for my application.
> 
> You haven't stated your problem correctly.  The fact
> that you're
> dealing with more than one pair of endpoints isn't
> important.
> 
> Your real problem is that you want to create and register
> more than one 
> character device.  The USB core doesn't provide any
> support for this, 
> so you would have to write all the support routines
> yourself.
> 
> > What is according to you the best example of managing
> "independent"
> > access to two endpoints (in fact 4 : 2 (IN/OUT)
> pairs.
> 
> See, you're confused.  The number of endpoints doesn't
> matter.  What 
> matters is the number of character devices.
> 
> The usb-serial driver can register several char
> devices.  You can find 
> out about creating char devices and see some code examples
> in the Linux 
> Device Drivers book.
> 
> > My final application is a USB/I2C converter. My device
> is a
> > µController which has two I2C ports. The idea is to
> have a endpoint
> > pair for each I2C ports.
> > Indeed the max I2C throughput is 400 kbits/sec = 50
> kBytes/sec. With a
> > full speed interrupt endpoint the theoretical
> throughput is 64
> > kBytes/sec.
> > 
> > Then in fact I would have two devs (something like
> "usb_i2c1" and
> > "usb_i2c2") which could manage the same traditional
> fops for these
> > ports.
> > 
> > These dev files shall manage multiple threaded access
> ( asynch io I guess)
> 
> It would be easier for you if the different pairs of
> endpoints belonged 
> to different interfaces.  Can you change the device's
> firmware to 
> accomplish this?
> 
> > I am really interesting in having your expert point of
> view on the
> > best approach for doing such a driver.
> > 
> > I went on my research, I guess I have to look at USB
> serial converter
> > access. I had a look also at endpoint.c in the
> drivers/usb/core. I saw
> > that some endpoint devices are created in /dev/ but I
> don't know if I
> > can use it directly.
> 
> You can't.
> 
> Alan Stern
> 
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-usb" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


      
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

  Powered by Linux