tags:

views:

267

answers:

1

I've read this: http://stackoverflow.com/questions/1176053/, which was an insightful article.

However, I have no great background in WMI, and I found the large amount of documentation to be overwhelming. I can't find what I'm looking for.

The situation is that I have a device that will send data over the USB port, to the soundcard of the PC in question.

Consider camera-software. You connect your camera, start the program, and you can control the program with the camera, and vica versa. For instance, you can press a button on the camera and it'll start transmitting to the program. Or you can click a button in the program and it will start querying for data.

I need to find a way to query and catch this data, safely and correct. It's probably a Stream of bytes, but searching for that doesn't produce any results.

I'm thinking I first need to somehow connect. Then send the query. Then receive.

However, connecting and querying both is something that I can't find in the example code, or the System.Management documentation on MSDN.

+1  A: 

I don't think that WMI code would be relevant for you, I think that's just able to get out basic information about the device. If you want to actually read and send data to it you'll have to use different APIs.
When I've done any USB develoment it's been mostly using HID which is fairly straightforward, but I don't think you can transfer audio streams using HID, you'll need to use the Audio class driver. Though you might need to use HID to find out information about the soundcard.

Some useful links to get you started are:

Jan Axelson's website (author of USB Complete) - http://www.lvr.com/index.html

A USB HID Component for C# - http://www.codeproject.com/KB/cs/USB_HID.aspx?msg=2004501

A USB library for .Net - http://www.icsharpcode.net/OpenSource/SharpUSBLib/

A Java sample for a webcam app - http://www.mutong.com/fischer/java/usbcam/

ho1