2332|0

89

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

HidD_GetProductString 得不到>126bytes(53 wild character) [复制链接]

一个关于win API     HidD_GetProductString 得不到>126bytes(53 wild character) string的问题:

各位usb大牛们  帮帮忙啦
=================

Hello everyone!

I have a problem when I use HidD_GetIProductString API to
get my HID UPS's ProductString.
It always return FALSE.
My Procuct String is about 132 bytes. It is a unicode string.

And in MSDN - HidD_GetProductString help content ,
it says:
The maximum possible number of characters in an embedded string is device specific. For USB devices, the maximum string length is 126 wide characters (not including the terminating NULL character).

My question is how to get a 132 bytes product string in my
winXP application? use another API function or...?
My customer didn't want to short the Produt String.

And I note that , when I connect the HID UPS to windows OS,
in the OS's Control panel/Power Option/Power Meter/Detail Info/battery status page, there's no battery name. and the
product string cann't be shown, it will only show "Prod" .

Does anyone know how to resolve it?
THANKS !

HidD_GetIndexedString refer to:
http://msdn.microsoft.com/en-us/library/ms790921.aspx

HidD_GetProductString refer to:
http://msdn.microsoft.com/en-us/library/ms790920.aspx



========================


My string is 132 bytes (66 characters) .
And I use CATC USB Chief to catch the bus data.
after usb device plug into winXP,
there are 3 Get_Desc(produt string).
No.1 Get_Desc wLength is 255, and get whole of string 132 bytes.
No.2 Get_Desc is same as No.1
No.3 Get_Desc wLength is 102 and only get 102 bytes.
and enumeration seems OK.

But in my MFC Application software
HidD_GetProductString still cann't return right value.
When GetLastError(), I got error code = 1784 (Error_Invalid_User_Buffer).
I don't know why?


===========================


Yes, it maybe a Windows API issue.

It's about the HidD_GetProductString().
When I change my usb device's ProductString to less than 126 bytes(63 wild character), the API function can get string well.
And the function will fail once I add the string to more than 126 bytes.

My usb device is a UPS which have a USB port.
It is a HID Power Device.
And I also find that winXP PowerMeter will also fail to
recognize the ups battery's long product string.
But the winXP device manager can recognize the string.

If you have a usb device under develop, you can try it.
点赞 关注

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/7 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表