[erlang-patches] Small fix to to_erl

Stefan Zegenhagen stefan.zegenhagen@REDACTED
Wed May 29 16:50:43 CEST 2013


Dear all,

we've stumbled across a small problem.

One of our devices does not like 'to_erl' to be run over a serial port.
When to_erl is started, we see "Attaching to /tm<0xFF>" being printed
and the device then refuses to accept any input. Occasionally, we have
seen a linux kernel error message "serial8250: too much work for irq16"
simultaneously. After some debugging we found out that cause is a call
to tcsetattr() by to_erl, immediately preceeded by some printf().

The UART in our device doesn't like hardware parameters to be changed
while output is concurrently active. In fact, the GNU libc manual also
mentions that it might be dangerous to change UART hardware parameters
when a transmission is ongoing.

The patch attached to this e-mail changes the behaviour of to_erl to use
TCSADRAIN instead of TCSANOW when changing terminal parameters. This
makes the serial driver wait for the output queues to be empty before
applying the terminal parameter change.


Kind regards,

-- 
Dr. Stefan Zegenhagen

arcutronix GmbH
Garbsener Landstr. 10
30419 Hannover
Germany

Tel:   +49 511 277-2734
Fax:   +49 511 277-2709
Email: stefan.zegenhagen@REDACTED
Web:   www.arcutronix.com

*Synchronize the Ethernet*

General Managers: Dipl. Ing. Juergen Schroeder, Dr. Josef Gfrerer -
Legal Form: GmbH, Registered office: Hannover, HRB 202442, Amtsgericht
Hannover; Ust-Id: DE257551767.

Please consider the environment before printing this message.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: to_erl.patch
Type: text/x-patch
Size: 1284 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130529/72a5d9b8/attachment.bin>


More information about the erlang-patches mailing list