Hello,
I make driver for Point of Sale Printer, a wide range of Printer use
only a DTR/DSR hardware-handshaking. When I use a handshaking in the
userspace, the Printr has a overrun problem and our customer has a
problem with the tax office.my Patch relaize a simple DTR/DSR handhake with a small change of the
code. The change auf the userspace is very simple. e.g.cflags |= CDTRDSR;
The change of the stty tool at 2 lines.
Michael
diff -Nur linux-2.6/drivers/serial/8250.c linux-2.6.dsr_test/drivers/serial/8250.c
--- linux-2.6/drivers/serial/8250.c 2007-08-28 11:31:48.000000000 +0200
+++ linux-2.6.dsr_test/drivers/serial/8250.c 2007-08-31 13:20:57.000000000 +0200
@@ -1400,12 +1400,15 @@
up->port.info != NULL) {
if (status & UART_MSR_TERI)
up->port.icount.rng++;
- if (status & UART_MSR_DDSR)
- up->port.icount.dsr++;
if (status & UART_MSR_DDCD)
uart_handle_dcd_change(&up->port, status & UART_MSR_DCD);
- if (status & UART_MSR_DCTS)
- uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
+ if (status & (UART_MSR_DCTS|UART_MSR_DDSR)) {
+ if (status & UART_MSR_DDSR)
+ up->port.icount.dsr++;
+ else
+ up->port.icount.cts++;
+ uart_handle_dsr_cts_change(&up->port, status & UART_MSR_CTS, status & UART_MSR_DSR);
+ }wake_up_interruptible(&up->port.info->delta_msr_wait);
}
diff -Nur linux-2.6/drivers/serial/serial_core.c linux-2.6.dsr_test/drivers/serial/serial_core.c
--- linux-2.6/drivers/serial/serial_core.c 2007-08-28 11:31:48.000000000 +0200
+++ linux-2.6.dsr_test/drivers/serial/serial_core.c 2007-08-31 13:29:22.000000000 +0200
@@ -191,6 +191,13 @@
info->tty->hw_stopped = 1;
spin_unlock_irq(&port->lock);
}
+
+ if (info->flags & UIF_DSR_FLOW) {
+ spin_lock_irq(&port->lock);
+ if (!(port->ops->get_mctrl(port) & TIOCM_DSR))
+ info->tty->hw_stopped = 1;
+ spin_unlo...
On Fri, 31 Aug 2007 15:17:41 +0200
googling for CDTRDSR is useful. I see from
http://lkml.org/lkml/2006/12/10/49 that Russell was generally supportive,This will break all architectures except for i386. So for now I guess we
can do this:--- a/include/linux/termios.h~serial-8250-implement-dtr-dsr-handshaking-fix
+++ a/include/linux/termios.h
@@ -4,4 +4,8 @@
#include <linux/types.h>
#include <asm/termios.h>+#ifndef CDTRDSR
+#define CDTRDSR 0 /* remove this when all architectures have a definition */
+#endif
+
#endif
_but that's temporary. If we decide to proceed with this change then we
should add CDTRDSR to each arch's termbits.h. That'll be pretty
straightforward to arrange.Actually, let's spam them ...
--- a/include/linux/termios.h~serial-8250-implement-dtr-dsr-handshaking-fix
+++ a/include/linux/termios.h
@@ -4,4 +4,9 @@
#include <linux/types.h>
#include <asm/termios.h>+#ifndef CDTRDSR
+#warning This architecture should implement CDTRDSR
+#define CDTRDSR 0 /* remove this when all architectures have a definition */
+#endif
+
#endif
_-
Partially implemented - my point 1 seems to have been addressed but not
point 2. Point 2 is rather important, otherwise you can end up with a
port in stopped mode with no way to get it transmitting.Also, it doesn't seem to be tweaking the DTR signal at all, so how does
it tell the remote end to stop transmitting?Essentially, the author needs to search for CRTSCTS in serial_core.c and
*carefully* consider whether they need to modify those places as well.
I stress carefully, because at the moment we start the tty whenever
we move from CRTSCTS to no CRTSCTS. If you're moving CRTSCTS->CDTRDSR
then you only want to do this iff DSR is asserted.--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
-
| Brandeburg, Jesse | RE: [regression] e1000e broke e1000 (was: Re: [ANNOUNCE] e1000 toe1000e migration ... |
| Vladislav Bolkhovitin | Re: Integration of SCST in the mainstream Linux kernel |
| Linus Torvalds | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| IKEDA Munehiro | [RFD] Documentation/stable_api_nonsense.txt translated into Japanese |
git: | |
| Gerrit Renker | [PATCH 02/37] dccp: Implement lookup table for feature-negotiation information |
| Paweł Staszewski | Re: rib_trie / Fix inflate_threshold_root. Now=15 size=11 bits |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
