usb设备的writefile问题 [英] Writefile problem with usb device
问题描述
你好我的朋友
我有一个使用usb总线与usb设备通信的项目。该设备有自己的驱动程序和通信protokol Guid。在它的guid中有这样的安全性:安装USB驱动程序后,任何程序都可以使用'CreateFile','ReadFile'和'WriteFile',常见的Windows系统功能与设备通信。所以我按照说明操作,Creatfile()函数运行良好。我的问题是Writefile()和ReadFile函数。它始终显示此错误3758100489:任何人都可以帮助我吗?非常感谢Ps USB路径是正确的100%
在guid书中有这样的说明:所有消息都使用Intel样式字节排序,其中大于一个字节的字段存储在内存中所以
,最不重要的部分是在最低地址。
所以我试图使用函数转换为littel Endien
我尝试了什么:
我试图在Creatfile()和Writefile()中使用重叠参数,但仍然遇到同样的问题。
i试图在guid的帮助下使用多种形式的消息包
Hallo my friends
I have a project to communicate with a usb device using usb bus. The device has its own driver and a communication protokol Guid . In its guid there is this senetence :"After USB driver is installed any program can communicate with the device by using ‘CreateFile’, ‘ReadFile’ and ‘WriteFile’, common Windows system functions." So I followed the instructions and the Creatfile() function works very well. My problem is with Writefile()and ReadFile functions. It shows always this Error 3758100489 : Can anyone help me ? thank you very much P.s USB path is right 100%
In the guid book there is this note:All messages use Intel style byte ordering where fields larger than one byte are stored in memory so
that the least significant part is in lowest address.
So i tried to use functions to convert to littel Endien too
What I have tried:
I tried to use overlapped parameter in Creatfile() and Writefile() but still have the same problem.
i tried to use many forms of message packet with help from the guid too
推荐答案
Windows API错误代码的一个奇怪之处是它们是最多的通常以十六进制形式记录。此错误代码为十六进制的E0001009,根据谷歌,它有一些不同的含义。一个是USBIO_ERR_NOT_BOUND。原因:句柄未绑定到管道。 USBIO驱动程序报告此错误。我建议您在设备的任何文档中查找此错误代码。
这里有几个提示:以十六进制显示错误代码。如果您使用printf或sprintf来处理它们,那么格式为%08X以十六进制显示错误代码。
此外,由于大多数Windows机器运行英特尔处理器的数据可能已经采用小端格式,因此您不必担心转换它。
One odd thing with Windows API error codes is they are most often documented in hexadecimal form. This error code is E0001009 in hex and according to google there are a few different meanings for it. One is USBIO_ERR_NOT_BOUND. Reason: The handle is not bound to a pipe. This error is reported by the USBIO driver. I recommend looking for this error code in any documentation you have for the device.
A couple of tips here: display your error codes in hex. If you use printf or sprintf to deal with them then the format is "%08X" to display the error code in hex.
Also, since most windows machines run on an Intel processor the data will likely be in little endian format already so you shouldn't have to worry about converting it.
这篇关于usb设备的writefile问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!