LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-15-2007, 11:50 PM   #1
agpperera
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Rep: Reputation: 0
how to test a simple char driver in FC5?


Hi every one,

I'm quite new to linux device drivers but I made a simple char device driver(prety much the scull in LDD3) How can I write a program to test it? (The read/write functions) Do I hav to have a node in /dev to do this? example code would be nice! (i686 machine/kernel=2.6.15)

thanks,
Prasanna
 
Old 10-16-2007, 05:15 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
You can write a program using the standard calls. First use open(), then write() and read(), just like for any other device (of course, if you support both read and write...).

It depends on your driver if you need to create your file in /dev. In the 2.6 kernel, rather not, but simply check if the file exists.
 
Old 10-17-2007, 02:16 AM   #3
agpperera
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks

Thanks

I tried it and it was quite ok. I used fread() fwrite() !!
 
  


Reply

Tags
char, driver, fc5, how, simple


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
simple test circuit to learn kernel device driver programming slzckboy Programming 3 01-30-2006 03:12 AM
FC5 test 1 x86-64 mickeyboa Fedora 0 12-11-2005 08:36 AM
About FC5-Test 1 TigerLinux Fedora 2 11-28-2005 11:03 PM
Char driver: what's the best way to do... perlMonkey Linux - Software 0 07-05-2005 08:34 AM
char driver on linux-kernel-2.6.10 prashy Programming 2 05-09-2005 02:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:05 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration