Generic USB access
-
Hey all, I have several projects that I want to complete that involve USB devices. I was wondering if there is any generic way to grab the output and input to any USB device. I'm not looking for anything too clean, just something that works for the moment, as I will spend time adjusting the method to my various projects. At any rate, is there a generic way to access the output and input of any USB device in windows? (or even just grab the output?) thanks, - legit legit-tech.net I'm moving this post from the MFC/C++ forum (if an admin wants to remove that other post to prevent duplicate posts that'd be great!)
legit wrote:
I was wondering if there is any generic way to grab the output and input to any USB device.
No, there isn't. USB is not a port, like serial or parallel. It's a BUS, just like the PCI bus you stuff cards into inside the machine. Communicating with any device on the bus requires you to go through the interface supplied by the drivers for that device.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
legit wrote:
I was wondering if there is any generic way to grab the output and input to any USB device.
No, there isn't. USB is not a port, like serial or parallel. It's a BUS, just like the PCI bus you stuff cards into inside the machine. Communicating with any device on the bus requires you to go through the interface supplied by the drivers for that device.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
legit wrote:
I was wondering if there is any generic way to grab the output and input to any USB device.
No, there isn't. USB is not a port, like serial or parallel. It's a BUS, just like the PCI bus you stuff cards into inside the machine. Communicating with any device on the bus requires you to go through the interface supplied by the drivers for that device.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007I have a couple of USB boxes which support performing digital and analogue I/O. They didn't come with drivers (and as I run FILEMON when I install stuff, I can be reasonably sure of that!). However, there is an API library supplied to communicate with the hardware. Presumably this uses a standard MS-supplied driver to provide user-mode access to allow tx/rx of requests/replies sent to the devices?
Steve S Developer for hire
-
I have a couple of USB boxes which support performing digital and analogue I/O. They didn't come with drivers (and as I run FILEMON when I install stuff, I can be reasonably sure of that!). However, there is an API library supplied to communicate with the hardware. Presumably this uses a standard MS-supplied driver to provide user-mode access to allow tx/rx of requests/replies sent to the devices?
Steve S Developer for hire
You need the documentation on that SDK, otherwise, it's useless. That SDK is your only method of communication with the devices.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
I have a couple of USB boxes which support performing digital and analogue I/O. They didn't come with drivers (and as I run FILEMON when I install stuff, I can be reasonably sure of that!). However, there is an API library supplied to communicate with the hardware. Presumably this uses a standard MS-supplied driver to provide user-mode access to allow tx/rx of requests/replies sent to the devices?
Steve S Developer for hire
-
You need the documentation on that SDK, otherwise, it's useless. That SDK is your only method of communication with the devices.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007I appreciate that (and I have, and use, the documentation), but my point is that it must be using some user-level mechanism which does not depend on a manufacturer-specific driver, instead using some generic way of communication. My next obvious step would be to run Depends on the supplied DLL, and see what it loads that I don't recognise.
Steve S Developer for hire
-
Is this a windows supplied API? or did it come with the devices? Also, is there documentation for it? thanks
-
I appreciate that (and I have, and use, the documentation), but my point is that it must be using some user-level mechanism which does not depend on a manufacturer-specific driver, instead using some generic way of communication. My next obvious step would be to run Depends on the supplied DLL, and see what it loads that I don't recognise.
Steve S Developer for hire
Steve S wrote:
but my point is that it must be using some user-level mechanism which does not depend on a manufacturer-specific driver,
That's what the device's SDK is for. There are no "generic" communication methods with any USB devices.
Steve S wrote:
My next obvious step would be to run Depends on the supplied DLL, and see what it loads that I don't recognise.
Depends can tell you what functions a .DLL exports and will give you the function names, but it can NOT give you the number of parameters and the data types of those parameters. The only thing that can give you that is the docs on the SDK.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
Steve S wrote:
but my point is that it must be using some user-level mechanism which does not depend on a manufacturer-specific driver,
That's what the device's SDK is for. There are no "generic" communication methods with any USB devices.
Steve S wrote:
My next obvious step would be to run Depends on the supplied DLL, and see what it loads that I don't recognise.
Depends can tell you what functions a .DLL exports and will give you the function names, but it can NOT give you the number of parameters and the data types of those parameters. The only thing that can give you that is the docs on the SDK.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Dave Kreskowiak wrote:
Depends can tell you what functions a .DLL exports and will give you the function names, but it can NOT give you the number of parameters and the data types of those parameters. The only thing that can give you that is the docs on the SDK.
Very true, and in this case, since it also gives the names of functions that the DLL imports, it can tell you that it's using SETUPAPI functions, and functions from HID. The latter is what the library appears to be using for communication. However, we're now well off the original poster's track, although I may come back at a much later date with an article on how the supplied DLL does it's USB communication without a specific device driver :)
Steve S Developer for hire
-
Dave Kreskowiak wrote:
Depends can tell you what functions a .DLL exports and will give you the function names, but it can NOT give you the number of parameters and the data types of those parameters. The only thing that can give you that is the docs on the SDK.
Very true, and in this case, since it also gives the names of functions that the DLL imports, it can tell you that it's using SETUPAPI functions, and functions from HID. The latter is what the library appears to be using for communication. However, we're now well off the original poster's track, although I may come back at a much later date with an article on how the supplied DLL does it's USB communication without a specific device driver :)
Steve S Developer for hire
Steve S wrote:
although I may come back at a much later date with an article on how the supplied DLL does it's USB communication without a specific device driver
Sure, with the SETUPAPI, a bunch of DeviceIo calls, and the documentation on what the device's commands and responses are. It's generic, but only to a point. Eventually, you have to get into the specifics of the device.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007