?
Solved

Writing into a file from device driver

Posted on 2006-11-22
4
Medium Priority
?
249 Views
Last Modified: 2012-05-05
Hello experts!

I am writing a simple character device driver in C. I wanted to know if there is a way that I can open a text file and then read/write into it from within the driver.

To summarize, I want to:
1. open a text file from within device driver
2. write some debug data into the file
3. close the text file

I am new to linux kernel programming. Please let me know if there is a way to achieve the above tasks.

Regards,
Vikram
0
Comment
Question by:Vikram_B
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 17996763
AFAIK you have to use printk() for that
0
 
LVL 27

Accepted Solution

by:
Nopius earned 100 total points
ID: 18000510
Short answer: NO WAY.
Long answer: probably possible but is _very_ difficult and highly unrecommended.

Read here an answer: http://uwsg.iu.edu/hypermail/linux/kernel/0005.3/0061.html
0
 

Author Comment

by:Vikram_B
ID: 18001086
Thanks Nopius! U saved a lot of my time and effort :)
0
 
LVL 27

Expert Comment

by:Nopius
ID: 18001298
Vikram_B: that was all about files. But as ahoffman say, printk() may help to debug driver. Using this function you can generate kernel log messages, that you may log via syslog or read with 'dmesg' command.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question