Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
346 views
in Technique[技术] by (71.8m points)

c# - Why DeviceInformation.Name does not display correct name

I am developing custom HID device. I can see the name in device manager (MyCustomDevice). However when I find the device using DeviceWatcher, the DeviceInformation.Name property has value Unknown USB Device (Port Reset Failed). Other applications using WIN32 apis can get correct name of device without problem.

My code:

// Selector for enabled HID devices
string selector = "System.Devices.InterfaceClassGuid:="{4D1E55B2-F16F-11CF-88CB-001111000030}" AND System.Devices.InterfaceEnabled:=System.StructuredQueryType.Boolean#True";
_watcher = DeviceInformation.CreateWatcher(selector, properties);
_watcher.Added += (s, deviceInformation) => {
    Console.WriteLine(deviceInformation.Name); // prints "Unknown USB Device (Port Reset Failed)"
};

Device functions correctly, I can communicate with it - the only problem is this Name. Is there possibility to fix it other than going back to WIN32?

To clarify things: The device uses standard hidusb.sys driver, and there are no yellow exclamation marks in device manager.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...