完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
问候语!我有一个问题与MC2200芯片。它被Windows XP检测为HID设备,但不能通过HID控制。我尝试发送配置命令(16字节= {0x10 0 0 0 0 0 0 0 0 0 0 0 0 0),并得到“参数不正确”错误。我的源代码列出:也尝试使用HIDAPI库并得到错误:谢谢你的帮助!
以上来自于百度翻译 以下为原文 Greetings! I have a problem with mcp2200 chip. It was detected by Windows XP as HID device, but it can't be controled throught HID. I tried to send configure command (16 bytes = {0x10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}) and got "The parameter is incorrect" error. My source code are listed bellow: char *path = "\\?\HID#Vid_04d8&Pid_00df&MI_02#9&fa410ca&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"; HANDLE h = CreateFileA(path, GENERIC_WRITE |GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); //result: h=0x00000fca unsigned char wdata[16]; memset(wdata, 0, sizeof(wdata)); wdata[0] = 0x10; //CONFIGURE BOOL res = WriteFile(h, dat, 16, &bytes_written, NULL) //result: res=0, bytes_written=0 int errorCode= GetLastError(); //result: errorCode = 87 (The parameter is incorrect) also I tried to use a hidapi library and got error too: hid_device *device = hid_open( 0x04D8, 0x00DF, NULL ); //result: got device handler. it's ok hid_set_nonblocking(device, 1); wdata[0] = 0x10; //CONFIGURE int res = hid_write(device, wdata, 16); //result: res=-1 Thanks for any help! |
|
相关推荐
7个回答
|
|
但是,您是否将第一字节设置为“设备ID”?(通常为1或2)
以上来自于百度翻译 以下为原文 But did you set the 1st Byte to the "Report ID" as your device expects? (usually 1 or 2) |
|
|
|
是的,我做到了。我尝试发送17字节报告={0x80+ 16字节0x00 }。(在MC2200 HID接口命令描述中没有ID=1或2的报告)
以上来自于百度翻译 以下为原文 Yes, I did. I tried to sent 17 bytes report = {0x80 + 16 bytes of 0x00} for example. (There are no reports with ID=1 or 2 in MCP2200 HID Interface Command Description) |
|
|
|
如文档(http://WW1.Microchip .com/下载/ En/DeViceOC/93066 A.pdf)中所描述的:“从/MC2200生成读/写数据的16字节长HID报告”
以上来自于百度翻译 以下为原文 As described in document (http://ww1.microchip.com/downloads/en/DeviceDoc/93066A.pdf): "16 bytes long HID reports generated to read/write data from/to MCP2200" |
|
|
|
然后你需要发送17字节。如果你得到“参数错误”,那么字节的数量与HID描述符(+1)的输出报告大小不匹配,或者发送的第一个字节不是有效的报告ID(或者如果只有一个报告ID)为零。引用的DOC没有说明它是什么样的报告。我假设SeaRealEng/Outlook报表,虽然这些特征报告的可能性很小,在这种情况下,您应该使用HIDStaseTuffE()和HIDGETFraseUp()。
以上来自于百度翻译 以下为原文 Then you need to send 17 bytes. If you get "parameter error" then either the number of bytes doesn't match the output report size from the HID descriptor (+1), or the first byte of what you send is not the valid report id (or zero if there's only one report Id). The doc you quoted doesn't say what kind of report it is. I would assume that these are input/output reports, although there's a small chance that these are feature reports, in which case you should use HIDSetFeature() and HIDGetFeature(). |
|
|
|
顺便说一下,在第一个代码中,你在“WDATA”中准备数据,然后将“DAT”传递给WreWr.Fo()。
以上来自于百度翻译 以下为原文 BTW: In your first code snipped you prepare data in "wdata", but then pass "dat" to WriteFile(). |
|
|
|
我用很少的组合发送了17个字节,但仍然没有找到正确的字节。不幸的是,我现在无法访问芯片。我将在星期一尝试使用HyStValk和HiDigFoice。谢谢你的帮助,祝你周末愉快!
以上来自于百度翻译 以下为原文 I sent 17 bytes in few combinations, still not found right one. Unfortunatelly I have no access to chip right now. I will try to use HIDSetFeature and HIDGetFeature on Monday. Thanks for your help and have a nice weekends! |
|
|
|
嗯,根据THISTHP://WW.Microchip .com/下载/ En/DeViceOC/93066 A。PDF没有“报告ID”。谁知道…
以上来自于百度翻译 以下为原文 Well, according to this http://ww1.microchip.com/downloads/en/DeviceDoc/93066A.pdf there's no "report ID" byte. who knows... |
|
|
|
只有小组成员才能发言,加入小组>>
5195 浏览 9 评论
2013 浏览 8 评论
1937 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3185 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2240 浏览 5 评论
751浏览 1评论
637浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
522浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
648浏览 0评论
549浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-2 17:35 , Processed in 1.461743 second(s), Total 60, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号