Results 1 to 3 of 3
Hello all,
To keep long story short, I am coding a character device driver(like scull), when I read from my character device driver using cat it simply waits for more ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-28-2011 #1Just Joined!
- Join Date
- Dec 2009
- Location
- Rajshahi || Dhaka, Bangladesh
- Posts
- 11
Modify Character Device Driver to Handle Cat
Hello all,
To keep long story short, I am coding a character device driver(like scull), when I read from my character device driver using cat it simply waits for more data to be fed in, doesn't quit). How can I modify the driver so that cat reads all the available data and quits. (I debugged and found out the driver opens instead of closing after each read.)
Thanks in advance.
Regards.
- 08-31-2011 #2Just Joined!
- Join Date
- Jul 2011
- Posts
- 16
Cat keeps reading as long as read() returns more than 0 bytes. In your driver, You give the data as long as you have data. If your driver has no data to give just return 0. When cat gets zero as return value of read() function, it exits.
- 08-31-2011 #3Just Joined!
- Join Date
- Dec 2009
- Location
- Rajshahi || Dhaka, Bangladesh
- Posts
- 11
Umm I realized the problem, thanx anyway. Its just I wanted to implement blocking read, and when device buffer is empty, I sent it to wait queue, that was the problem, and it turned out its exactly the behavior needed for our assignment.


Reply With Quote
