Hello, I am trying to explore tty drivers. To start with, I am trying to implement a simple loop back device(testing with echo and cat). The code works fine as far as write is concerned. When the user process (echo) calls write() on the device, the driver's write_room() is called and then write() is being called successfully. After which, the flush_chars() function is being called, in which, a work is scheduled to resend the data back to the user space. I have used the tty_insert_flip_char() and tty_flip_buffer_push() to get the job done. But it is so happening that the read process (cat) is blocking. What might be the reason for this blocking? My code could be found here : https://github.com/raghav3276/tty_test/blob/master/tty_test.c The code is written by taking a reference from LDD3, TTY drivers. I am implementing the driver on Linux-3.12.1 and I have seen that the approach has changed slightly! Also I have a few more questions regarding the flow of data : 1) During write process, I see that the write is being called twice. In the first call, the 'actual' data is being transferred until a new line is encountered and in the next call, two new lines are being transmitted. So is there any specific format for the data that is to be passed to the write() function? Is it mandatory to terminate the data with new line or NULL or anything else? 2) Is there any criteria that is to be satisfied to support the read functionality as the process that is trying to read the data is blocked? Any specific flags or minimum buffer count, etc? Thanks, Raghavendra ------------------------------------------------------------------------------------------------------------------------------- [ C-DAC is on Social-Media too. Kindly follow us at: Facebook: https://www.facebook.com/CDACINDIA & Twitter: @cdacindia ] This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken. ------------------------------------------------------------------------------------------------------------------------------- _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies