How to make the USB host program?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2008-10-28 3:55 AM
Posted on October 28, 2008 at 11:55
How to make the USB host program?
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2011-05-17 3:49 AM
Posted on May 17, 2011 at 12:49
Hi,
I modified the Custom_HID USB demo program to make it keep sending the data in 'main' function, int main(void) { int i; unsigned short b; #ifdef DEBUG debug(); #endif Set_System(); USB_Interrupts_Config(); Set_USBClock(); USB_Init(); while (1) { for (i = 0; i < 1000000; i++); b++; UserToPMABufferCopy((u8 *)&b, GetEPTxAddr(ENDP1), 2); SetEPTxCount(ENDP1, 2); SetEPTxValid(ENDP1); } } This firmware works well and the BUSHOUND can get that USB data. I want to make my host program to get that data, I tried to make that program in both Windows and Linux. In Windows, I call SetupDiGetDeviceInterfaceDetail to get the device path of that Custom_HID device, then call CreateFile to open that devicepath. I can properly to get the VID & PID by calling HidD_GetAttributes, but I don't know how to read the data send from Custom_HID device, I tried both HidD_GetFeature, and ReadFile, but failed. In Linux I used the libusb, after correctly opened that Custom_HID device, I still can not read that data by calling both usb_bulk_read & usb_interrupt_read. Who can make a sample program to read that data? Regards, ZhangZQ