Solved

Writing into a file from device driver

Posted on 2006-11-22
4
243 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
  • 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 25 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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 tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now