ugen example

Bernd Walter ticso at cicely12.cicely.de
Thu Jun 12 07:00:50 PDT 2003


On Thu, Jun 12, 2003 at 11:47:55PM +1000, Andrew wrote:
> 
> 
> On Thu, 12 Jun 2003, Bernd Walter wrote:
> 
> > Not all endpoints have to be available in the current configuration.
> > If you show me the output for your device I can tell you what is
> > available under which condition.
> 
> Thanks, output below.
> 
> Andrew
> 
> --
> 
> DEVICE addr 2
> DEVICE descriptor:
> bLength=18 bDescriptorType=device(1) bcdUSB=1.00 bDeviceClass=255
> bDeviceSubClass=255
> bDeviceProtocol=255 bMaxPacketSize=64 idVendor=0x0743 idProduct=0x0002
> bcdDevice=1
> iManufacturer=0() iProduct=0() iSerialNumber=0() bNumConfigurations=1
> 
> CONFIGURATION descriptor 0:
> bLength=9 bDescriptorType=config(2) wTotalLength=218 bNumInterface=1
> bConfigurationValue=1 iConfiguration=0() bmAttributes=80 bMaxPower=100 mA
> 
> INTERFACE descriptor 0:
> bLength=9 bDescriptorType=interface(4) bInterfaceNumber=0
> bAlternateSetting=0
> bNumEndpoints=0 bInterfaceClass=255 bInterfaceSubClass=255
> bInterfaceProtocol=255 iInterface=0()

This is interface 0, which is used by default.
It has no endpoints of it's own.
Beside endpoint 0 which is always available.

> INTERFACE descriptor 1:
> bLength=9 bDescriptorType=interface(4) bInterfaceNumber=0
> bAlternateSetting=1
> bNumEndpoints=13 bInterfaceClass=255 bInterfaceSubClass=255
> bInterfaceProtocol=255 iInterface=0()
> 
> ENDPOINT descriptor:
> bLength=7 bDescriptorType=endpoint(5) bEndpointAddress=1-in
> bmAttributes=interrupt wMaxPacketSize=16 bInterval=10

This one and the following endpoints are for interface 1.
This is an alternate Interface, which means, that you can either use
this or another interface - therefor ugen doesn't offer you
the endpoint of interface 1 - it's not active.
You have to select this interface with USB_SET_ALTINTERFACE.

> INTERFACE descriptor 2:
> bLength=9 bDescriptorType=interface(4) bInterfaceNumber=0
> bAlternateSetting=2
> bNumEndpoints=13 bInterfaceClass=255 bInterfaceSubClass=255
> bInterfaceProtocol=255 iInterface=0()

The same for Interface 2 and his endpoints.
It's an alternate interface.
Which one you want to use depends on your application and device.
You may want to read the device documentation to select the interface
which offers you the features that your application needs.

-- 
B.Walter                   BWCT                http://www.bwct.de
ticso at bwct.de                                  info at bwct.de



More information about the freebsd-hackers mailing list