|
查看了一些文档,提到solaris10系统支持libusb,我写了一个简单的枚举设备ID的程序,用的是libusb进行通讯,但是执行时确什么都没有输出,希望各位指点一下
我的usb设备使用prtconfig -v 没有打印出来设备的vid 和pid,在网上找了一些资料,发现在/kernel/drv/scsa2usb.conf文件中添加便课找到产品的pid与vid
attribute-override-list = "vid=id reduced-cmd-support=true";
#protconf -v |grep 96
value='usb96e,6.109' + 'usb96e,6' + 'usbif96e,class3.0.0' + 'usbif96e,class3.0' + 'usbif96e,class3' + 'usbif,class3.0.0' + 'usbif,class3.0' + 'usbif,class3' + 'usb,device'
[root@solaris10:/usr/hongbin/source]#uname -a
SunOS solaris10 5.11 snv_79a i86pc i386 i86pc Solaris
[root@solaris10:/usr/hongbin/source]#cat Makefile
CC=gcc
CFLAGS=-I/usr/sfw/include
LDFLAGS=-L/usr/sfw/lib -R/usr/sfw/lib -lusb
SearchDevice:SearchDevice.o
$(CC) -o SearchDevice SearchDevice.o $(LDFLAGS)
SearchDevice.o:SearchDevice.c
$(CC) $(CFLAGS) -c SearchDevice.c
clean:
rm -fr *.o SearchDevice a.out core
[root@solaris10:/usr/hongbin/source]#cat SearchDevice.c
#include <stdio.h>
#include </usr/sfw/include/usb.h>
int main()
{
struct usb_bus *busses ;
struct usb_bus *bus ;
usb_init();
usb_find_busses();
usb_find_devices();
busses=usb_get_busses();
for (bus = busses; bus; bus = bus->next) {
struct usb_device *dev;
printf("111111\n");
for (dev = bus->devices; dev; dev = dev->next) {
struct usb_device_descriptor *desc;
printf("2222\n");
desc = &(dev->descriptor);
printf("Vendor/Product ID: %04x:%04x\n", desc->idVendor,
desc->idProduct);
}
}
return 0;
}
[root@solaris10:/usr/hongbin/source]#
执行上边的程序 只进入了 1循环体 ,没有执行第二个循环,还请高手帮忙看下(这段代码在linux下编译可以找到产品的信息) |
|