![]() |
self written usb driver: received data is retransmitted
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 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; |
Your read call back code is okay. Based on some conditions received characters are echoed in the tty layer.
Check the function n_tty_receive_char() in drivers/tty/n_tty.c. This function echoes the charactors on the tx using the process_echoes() function. You can put the printk's in the n_tty_recieve_char() and check which condition is met to make the characters echoed on tx. You can even use stty command on your device file and check the condtions. |
stty -F /dev/ttyUSB1 -echo prevents the characters being echoed.
The tty flags are however only persisted if the device is opened: stty -F /dev/ttyUSB1 -echo is only persisted if I keep the device opened by cat /dev/ttyUSB1. I guess that set_termios function is lacking something. But what ? Code:
static void usbrsa_set_termios(struct tty_struct *tty, |
Found it. Actually, there is nothing lacking but too much:
I had set usb_serial_driver.init_termios to an init function assuming that it is only called if the driver initializes, i.e. when the function assigned to the attach-hook (usb_serial_driver.attach) is called by the usb system. I wonder what the init_termios hook is normally used for ? Thanks Tilman |
| All times are GMT -5. The time now is 05:29 PM. |