ugen example

Bernd Walter ticso at cicely12.cicely.de
Sun Jun 8 08:06:40 PDT 2003


On Mon, Jun 09, 2003 at 12:19:01AM +1000, Andrew wrote:
> Hi,
> 
> I'm just having a look at ugen, trying to see if I can get any action out
> of a USB-serial converter that has no existing driver. This is my first
> foray into the USB world so I apologise for any stupid questions...is
> there a good tutorial somewhere?

Not that I know.
But there is lot of sample code available.
usbdevs source is one of them.
usbctl from ftp://ftp.augustsson.net/pub/netbsd/sysutils-0.5.tgz is
another.
And also ports/misc/ftdi-eeprom is simple code, which can use ugen as
well as /dev/usb? to access the device.

> To find my device I open /dev/ugen? and call ioctl(USB_GET_DEVICE_DESC). I
> look at the returned idVendor and idProduct and check them against my hard
> coded figures. From what I can see from usbdevs only the last 2 bytes are
> significant? usbdevs produces 0x0743 for the vendor but I get 0x20743.

You must be doing something wrong - the values are 16bit only.
No chance to have anything larger.
See usb_device_descriptor_t in usb.h.

> When I work out what end point I need to talk to I thought opened
> /dev/ugen?.? but I only have a /dev/ugen? device (I'm using -CURRENT and
> devfs). I'm guessing I'm on the track here so I wouldn't mind a pointer to
> an example or some documentation.

If you have no /dev/ugen?.? then the device has no other endpoints in
its current configuration.
The usbctl tool mentioned above is good to check devices about their
capabilities.
http://www.cosmo-project.de/~bernd/usbutil.tgz is a port framework
for it - it is not in great shape (naddy@ send me a big list of things
to correct), but it works in vanilla configurations.

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



More information about the freebsd-hackers mailing list