Sign in to follow this  
ZeRaW

USB interface C/C++ programming

Recommended Posts

Well, i have this project to make the interface of communication between a USB RC Plane remote control and a PC. I know that the remote comes with a driver and guidelines suc byte offsets for each usb command sent. now i heard that usb programming is similiar to network programming (and i am good in that). so all i need is some guidelines from people who already have developped some application that communicates with a USB device so i can begin my project, thank you.

Share this post


Link to post
Share on other sites
You can open ports using fopen(), but as to how you use this to communicate with devices, I have no idea. I tried fiddling with my modem once when I got bored but I didn't have any success (other than getting the port open). I kinda hope somebody else comes along with a decent reply...

Share this post


Link to post
Share on other sites
You can communicate with the driver through DeviceIoControl. You should have a header file for the driver containing some defines starting with IOCTL_*.

Otherwise you are screwed... :-)

I have done this some time ago, not really rocket science but ugly function calls, so create a small class for it. If have you further questions...

Share this post


Link to post
Share on other sites
Quote:
Original post by Gorax
You can open ports using fopen(), but as to how you use this to communicate with devices, I have no idea. I tried fiddling with my modem once when I got bored but I didn't have any success (other than getting the port open). I kinda hope somebody else comes along with a decent reply...


Yeah, be careful with that. I once crashed my optical mouse using 'fopen' and reading data from it. I printed out in hex, whatever I read, and after about a minute, the mouse light would go off, and even if I shut down the program, I'd have to restart the comp to get it working again. [smile]

Share this post


Link to post
Share on other sites
well while researching i cam across this:
http://msdn.microsoft.com/coding4fun/someassemblyrequired/isthatyou/default.aspx

it started as being very helpful and i was porting it to C,
then i found out i need hid.lib & "hidsdi.h" to use functions such as "HidD_GetHidGuid" and these come with windows device Kit (WDK & DDK) which need to be ordered from microsoft thus iam stuck , i will try other methods such as CreateFile and fopen altho this will be the 1st time i use them for communicating with USB i ll check DeviceIoControl too , Thank you for the info.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this