From: Xiaofan C. <xia...@gm...> - 2011-06-30 01:44:02
|
On Thu, Jun 30, 2011 at 7:45 AM, Xiaofan Chen <xia...@gm...> wrote: > On Thursday, June 30, 2011, Yann Renard > <yan...@al...> wrote: >> I am on the process of porting some Win32 code to libusb under Linux. >> The Win32 code basically uses CreateFile to open the device, followed by >> DeviceIOControl / ReadFile calls to configure / request / read the device. >> >> I'm stuck with the DeviceIOControl calls which, I believe, should be >> mapped to libusb_control_transfer. > > No, unfortunately it is not that simple. The device must have a driver > under Windows. The ioctl is one of the ways that your user space > program communicates with the kernel driver. If you do not know the > protocol of the device, then you may have to do reverse engineering by > using USB sniffers under Windows. > Just for your information, here is the MSDN info on IOCTL. http://msdn.microsoft.com/en-us/library/aa363219%28v=vs.85%29.aspx If you have a hardware USB analyzer, then it will make things easier as well. Eg: http://www.ladyada.net/learn/diykinect/ You can also using a Windows VM under Linux and then try to use usbmon. http://www.mjmwired.net/kernel/Documentation/usb/usbmon.txt http://people.redhat.com/zaitcev/linux/ As for Software only USB Sniffer Under Windows, you can try out the following. Windows 7 only, quite good: http://blogs.msdn.com/b/usbcoreblog/archive/2009/12/04/etw-in-the-windows-7-usb-core-stack.aspx http://blogs.msdn.com/usbcoreblog/archive/2010/02/05/how-to-generate-and-view-a-winusb-debug-trace-log.aspx 32/64bit XP and above (you may need to disable code signing for 64bit Vista/7),relatively new. http://code.google.com/p/busdog/ Relatively old, 32/64bit XP only: http://www.pcausa.com/Utilities/UsbSnoop/ Old, 32bit XP or lower, may work for 32bit Vista/Win7, YMMV. http://sourceforge.net/projects/usbsnoop/ Or you can use trial version of commercial USB Sniffer for Windows. Eg: http://www.makestuff.eu/wordpress/?p=985 http://www.sysnucleus.com/usbtrace_download.html http://www.usblyzer.com/ http://www.sourcequest.com/ http://www.perisoft.net/bushound/ http://www.hhdsoftware.com/Products/home/usb-monitor.html http://www.aggsoft.com/usb-port-monitor.htm -- Xiaofan |