I am writing a kernel mode device driver which needs to read and write data
from serial port ( /dev/ttyS1 in this case ).
The driver is for an embedded system target MIPS running on Linux. However
my problem is both on standard Intel PC running Red Hat Linux (Kernel
2.4-7). So all the further discussion will be for standard Linux PC; since
if i get this to work i should get my embeddded system to work too.
I have two approaches to accomplish my task.
1. Open /dev/ttyS1 from my Kernel mode Device Driver and then read/write
2. Write my own custom serial port device driver. Disable the standard Linux
serial port device driver and load my custom serial driver.
Approach 1 seems to be the easier and best suited for my task. And hence i
am working on it.
I could successfully open the serial port (/dev/ttyS1) from my Kernel mode
Device Driver. I could successfully write data into it too. [ Using kcp.c as
my reference which uses filp_open, FILE_FD->f_op->write Kernel API ].
However i am facing problem while reading data from the Serial Port using
the same reference API's [ FILE_FD->f_op->read API ].
This is what i am doing.
I have a test harnsess [ user mode application ] that opens my kernel mode
driver [ i have tried both blocked and non blocked mode approaches ]. In my
Kernel driver I use the same mode to open the standard serial port (
/dev/ttyS1 ) using filp_open API.
The test harness is in a continuous loop to read 4 bytes from my kernel
mode device driver. In my Kernel mode device driver's read routine, i also
read from /dev/ttyS1 using FILE_FD->f_op->read API for the same number of
bytes. But i observe that i am not getting any data from the standard serial
port device driver [/dev/ttyS1]. I get a return value of -512 when i
terminate my user mode test harness (using ctrl c ).
I am at my wits end as to what the problem might be. Can somebody please
enlighten me on the same. Any help and suggestion regarding the same would
be appreciated greatly.
Thanks a lot in advance.
Thanks and Regards,
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/