- USB C++
- Posted by SerVel on February 22nd, 2005
Can anybody help me to reach USB port from C++.
(For evample to set/read a pin). Any suggestion are wellcome.
- Posted by Stephan Wolf [MVP] on February 22nd, 2005
I guess that's not a question of how you can achive this using C++ or
any other programming language, but rather whether you want to do this
from a user-mode program (application) or a kernel mode program
(device driver).
As I am not a USB expert, I can just guess if you want to directly
access "pins", you need to write a device driver. Although this can be
done using C++, drivers are usually written in C.
Other people will probably be able to help you more when you provide
more details of what you want to achieve.
Stephan
---
On Tue, 22 Feb 2005 17:01:04 +0200, "SerVel" <servel@mail.md> wrote:
- Posted by Robert Marquardt on February 22nd, 2005
SerVel wrote:
The suggestion is to first learn more about USB.
USB is a serial master slave bus not a serial line.
You do not address "the port". USB ports are completely invisible on
software level. Did you ever try to address your ethernet port?
On USB you talk to devices only.
Best have a look at Jan Axelsons website http://www.lvr.com
It is the reference site of USB. Best also buy her (!) book.
- Posted by Stephan Wolf [MVP] on February 22nd, 2005
On Tue, 22 Feb 2005 17:11:57 +0100, Robert Marquardt
<robert_marquardt@gmx.de> wrote:
If you also need to learn about "USB under Windows", best have a look
at Walter Oney's book "Programming the Windows Driver Model", see e.g.
http://www.oneysoft.com/
See also
http://www.microsoft.com/whdc/system/bus/usb/
Stephan
- Posted by Ray Trent on February 22nd, 2005
Even then, you can't really get down to the "pin" level. That's the
responsibility of the host controller hardware.
Stephan Wolf [MVP] wrote:
--
.../ray\..
- Posted by Jackal Huang on February 23rd, 2005
"SerVel" <servel@mail.md>...
What kind of usb device you want to reach?
What do you mean about set/read a pin?
Usually, you need to write a usb driver to operate on the usb device
except Windows provides standard driver for the device.
User mode program calls DeviceIoControl to send command to
the usb driver. usb driver performs suitable operations upon receiving
IOCTL command. If you have your own usb driver, just implement
the private IOCTL code in your driver. If you use standard driver,
you need to check DDK whether the standard driver provides suitable
IOCTL code for your request.
It doesn't matter whether you use C or C++.
Best Regards
Jackal Huang
- Posted by Stephan Wolf [MVP] on February 23rd, 2005
On Tue, 22 Feb 2005 14:32:36 -0800, Ray Trent <ratrent@nospam.nospam>
wrote:
Sure, but maybe there's some functionality available via IOCTLs that
would allow a user-mode program to "access" pins (ports) directly.
Much like the portio sample in the DDK
(...\WINDDK\3790\src\general\portio).
Stephan
- Posted by heinz on February 23rd, 2005
More than likely you will be controlling a USB device from a software
API that abstracts the hardware interface. Thus, think about USB in a
more abstract way, that is the packet level rather than at the
signaling level. To understand the USB bus, try the below tool because
you can view the pipe layout, watch packets flow, and send your own
packets: http://www.perisoft.net/bushound
- Posted by Ray Trent on February 24th, 2005
Ummm, no. You really can't directly tweak any of the 4 pins of a USB
port from anywhere outside of the firmware of the host controller. It's
just not that kind of port. The kind of thing you can do from software
is send a message to an endpoint, which is a much higher level operation.
Stephan Wolf [MVP] wrote:
--
.../ray\..

