LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 06-14-2011, 10:43 AM   #1
baraq
LQ Newbie
 
Registered: Jun 2011
Posts: 3

Rep: Reputation: Disabled
accessing device driver from C application


Hi,

I wrote device driver to USB device, I can see it is alive and sending the data that I set it to send from the shell
Code:
cat /dev/myDev
How can I read from the device using C code?
I've tried to open it as a file and read it's content to buffer but noting returns..

Code:
char bufferin[500];
FILE* myDev = fopen("/dev/myDev", "r+");

size = fread(bufferin, 500, 500, myDev);
Thanks
 
Old 06-14-2011, 03:01 PM   #2
baraq
LQ Newbie
 
Registered: Jun 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
anyone?
 
Old 06-15-2011, 02:47 AM   #3
baraq
LQ Newbie
 
Registered: Jun 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
OK
Found a solution

Code:
int myDevFd = open("/dev/myDev", O_RDWR);

size = read(myDevFd, bufferin, 500);
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can we send data from device driver to an user application? tanniru Linux - Kernel 3 05-12-2011 01:45 AM
Can we use fifos for transfering data from device driver to an user application? tanniru Linux - Kernel 2 05-11-2011 03:57 PM
Running application in kernel mode as device driver! hank007 Linux - Newbie 1 05-29-2009 07:21 AM
Accessing USB devices without device-driver barunparichha Linux - Software 5 07-22-2008 09:59 AM
Access linux device driver from a java application bnujos Programming 3 07-02-2003 04:55 AM


All times are GMT -5. The time now is 11:34 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration