NetBSD-Users archive

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

Why does my libusb example don't work



Hi all,

I'm despaired. Why does my simple program don't report anything. Please see
my attachment for details. I can't find any help on Google.

My devices are not recognized as I execute my simple program.

Any helpfull comments?

Regards

Volker
//main.c
#include <stdio.h>
#include <usb.h>

static struct usb_device* findVendorProductId()
{
  struct usb_bus *bus;
  struct usb_bus *busses;
  int vendor;
  int idProduct;

  usb_init();
  usb_find_busses();
  usb_find_devices();
  busses = usb_get_busses();

  for(bus = busses; bus; bus = bus->next)
  {
        printf("Los gehts...");           
        struct usb_device *dev;
    for(dev = bus->devices; dev; dev = dev->next)
                {
                        vendor    = dev->descriptor.idVendor;
                        idProduct = dev->descriptor.idProduct;

                        printf("Vendor %u",vendor);
                        printf("idProduct %u",idProduct);
                }
        }

  return 0;
}

int main(int argc,char** argv)
{

  printf("Trying to locate the devices...\n");
  findVendorProductId();

  return 0;
}




// Makefile
default:
        gcc -g -v -Wall -o main -R /usr/pkg/lib -I/usr/pkg/include 
-L/usr/pkg/lib -lusb main.c



// sudo usbdevs
addr 1: UHCI root hub, vendor 0x8086
 addr 2: Standard USB Hub, vendor 0x03eb
  addr 3: product 0x0001, vendor 0x0a12
  addr 4: usb serial converter, ftdi
addr 1: UHCI root hub, vendor 0x8086
addr 1: UHCI root hub, vendor 0x8086
addr 1: UHCI root hub, vendor 0x8086
addr 1: EHCI root hub, vendor 0x8086
 addr 2: USB2.0 UVC VGA WebCam, Image Processor


Home | Main Index | Thread Index | Old Index