Hi,
I am writting a driver for a serial converter.
In principle, receiving and sending data already works.
Data that is received is however echoed and thereby retransmitted on the tx feed. I suspect the tty layer, but know to little about it to really pinpoint it to that.
Looking at other postings, this question might be too detailed and too close to the kernel for the forum. If so, I would appreciate information on where to sent this question to.
Thank you and best regards
Tilman
Debug message from /var/log/messages
Code:
[ 7357.548188] usbrsa ttyUSB1: usbrsa_read_callback - length = 4, data = 41 42 43 44
[ 7357.548200] drivers/usb/serial/usbrsa.c: usbrsa_write_room(): 640
[ 7357.548203] drivers/usb/serial/usbrsa.c: usbrsa_write - port 1
[ 7357.548238] usbrsa ttyUSB1: usbrsa_write - length = 1, data = 42
[ 7357.548247] drivers/usb/serial/usbrsa.c: usbrsa_write_room(): 512
[ 7357.548261] usbrsa ttyUSB1: usbrsa_write - length = 1, data = 43
[ 7357.548270] drivers/usb/serial/usbrsa.c: usbrsa_write_room(): 448
[ 7357.548281] drivers/usb/serial/usbrsa.c: usbrsa_write - port 1{ [ 7357.548283] usbrsa ttyUSB1: usbrsa_write - length = 1, data = 44
Here a code fragment from the completion handler that processes the received data from the usb-to-serial-convertor. The received data is stored in a transfer buffer to which
data points.
Am I doing this correctly ?
Code:
data = urb->transfer_buffer;
tty = tty_port_tty_get(&port->port);
if (tty != NULL && urb->actual_length > 0) {
tty_insert_flip_string(tty, data, urb->actual_length);
tty_flip_buffer_push(tty);
}
tty_kref_put(tty);