pkgsrc-Users archive

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

libusb problem ?



Hi,

I'm testing libusb. I've written a simple code (see below) which aims to list
all devices (product id and vendor id, nothing more)

It works on GNU/Linux, but on my NetBSD -current (.73) box with libusb from
pkgsrc, it displays *one* device *only*.

Where does the problem come ?

Thanks,

-----

// list usb devices
// build with:
// gcc test.c  -I /usr/pkg/include -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lusb -o
// test

#include <usb.h>
#include <stdio.h>

int main() {

        struct usb_bus *busses;
    
        usb_init();
        usb_find_busses();
        usb_find_devices();
    
        busses = usb_get_busses();
        
        struct usb_bus *bus;
       
    
        for (bus = busses; bus; bus = bus->next) {
                struct usb_device *dev;
    
                for (dev = bus->devices; dev; dev = dev->next) {
                        printf("\n\n## VID: %x\nPID: %x\n\n",
dev->descriptor.idVendor, dev->descriptor.idProduct);

                }
        }
}


-- 

Sébastien BOCAHU - zecrazytux

http://zecrazytux.net
zecrazytux%im.apinc.org@localhost
zecrazytux @ #labo-linux #labo-linux.bsd @ irc.freenode.org

Please avoid sending me files in proprietary formats,
such as microsoft word or excel.
Please use open standards instead (for example, pdf).
Plain text is *really* appreciated !



Home | Main Index | Thread Index | Old Index