C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 05-12-2009, 09:25 AM   #1
Registered User
 
Join Date: Mar 2009
Posts: 8
Question USB Connect

This might be in the wrong section but the title of this section is "Network/Device Communication" and I figured a USB device is a device.... I have only seen network posts in this section.

So my question is how could I connect to a USB device (i.e mouse) and send it raw data in c/c++(I am using unix)?

Thanks,
CorX
CorX is offline   Reply With Quote
Old 05-12-2009, 09:32 AM   #2
subminimalist
 
MK27's Avatar
 
Join Date: Jul 2008
Location: NYC
Posts: 3,946
Quote:
Originally Posted by CorX View Post
So my question is how could I connect to a USB device (i.e mouse) and send it raw data in c/c++(I am using unix)?
I've never used real unix but I am pretty sure the filesystem, etc, is almost identical to linux, which means devices generally have a device node (a special file type) in the /dev directory. You can try writing and reading from these as if they were normal files, however, the kernel is in charge and knows what is and is not an appropriate action -- eg, if you try and write something to the mouse, that will probably fail.

USB devices are controlled with bytecode/text, but it is not in a computer programming language, and the devices do not have the capacity to interpret C or C++. Unless they were made to do that, which would be very unusual; what is it specifically you are trying to do?
__________________

Accuracy and integrity mean nothing if you don't make it past the censors...PYTHAGORAS
MK27 is online now   Reply With Quote
Old 05-12-2009, 09:39 AM   #3
Registered User
 
Join Date: Mar 2009
Posts: 8
Sweet, thanks that makes perfect sense.
CorX is offline   Reply With Quote
Old 05-12-2009, 09:50 AM   #4
and the hat of vanishing
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,214
Jan Axelson's Lakeview Research
Clusty Search » linux usb howto
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Up to 8Mb PlusNet broadband from only £5.99 a month!
Salem is offline   Reply With Quote
Reply

Tags
c/c++, device, hardware, unix, usb

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Hardware + Software][C++ or C#] USB Fan Mywk C++ Programming 16 07-04-2009 03:12 PM
How to write program for Serial and USB which connect to external hardware? gogo C Programming 1 10-13-2004 12:15 PM
Client timed-out once on connect(), can never connect() again registering Networking/Device Communication 6 10-28-2003 03:46 PM
Usb 2.0 ober Tech Board 6 09-06-2003 10:14 AM
Printers On USB (TNT) A Brief History of Cprogramming.com 1 03-10-2002 11:48 AM


All times are GMT -6. The time now is 01:26 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22