USB初始化
//USB初始化
void CFileManagerDlg::usbinit()
{
#define BUFFER_SIZE 64
struct usb_bus *bus;
struct usb_device *mydev;
usb_init();
usb_find_busses();
usb_find_devices();
for(bus = usb_get_busses(); bus; bus = bus->next)
{
if((mydev=bus->devices)!=0)
{
for(mydev = bus->devices; mydev; mydev = mydev->next)
{
if(mydev->descriptor.idVendor == MY_VID && mydev->descriptor.idProduct == MY_PID)
{
dev = usb_open(mydev);
usb_set_configuration(dev, MY_CONFIG);
usb_claim_interface(dev, 0);
GetDlgItem(IDC_STATIC_STATUS)->SetWindowText("设备已连接...");
}
}
}
else
{
GetDlgItem(IDC_STATIC_STATUS)->SetWindowText("设备未连接...");
}
}
}
冰冻三尺非一日之寒,火候未到,何以尘封!