title: Why CTRL+C won't work when using RS-232 on Linux?
body: <p>First of all, I don't know if this should stay in SO or go to SU: you tell me. The solution might have to do with programming.</p>
  
  <p>I am executing Linux on an embedded device and communicating with it using RS-232 @ 9600 bauds. Everything works fine using PuTTY on Windows: I have a shell and can type and execute commands.</p>
  
  <p>The problem is: when I launch a command, I cannot CTRL+C. For example, when pinging some machine, ping goes into an infinite loop and I cannot stop it using CTRL+C. When at the Bash prompt, though, CTRL+C works and goes to the next line (so it is transmitted). I also noticed the terminal is showing <code>^C</code> when I do CTRL+C while running a command. When connecting through Telnet, CTRL+C works fine anywhere.</p>
  
  <p>I tried using PuTTY's "special command" break, but it doesn't work. I also tried different terminal emulators, same problem.</p>
  
  <p>So I guess the problem is somehow kernel-related. Is there anything I could look into regarding this?</p>
  
  <p><strong>Edit</strong>: I am running BusyBox v1.13.2. The output of <code>stty -a</code> (RS-232) is:</p>
  
  <pre><code>speed 9600 baud; rows 24; columns 80;
  intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = &lt;undef&gt;;
  eol2 = &lt;undef&gt;; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
  lnext = ^V; flush = ^O; min = 1; time = 0;
  -parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts
  -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff
  -iuclc -ixany -imaxbel
  opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
  isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
  echoctl echoke
  </code></pre>
  
  <p>The output of <code>stty -a</code> (Telnet) is:</p>
  
  <pre><code>speed 38400 baud; rows 24; columns 80;
  intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = &lt;undef&gt;;
  eol2 = &lt;undef&gt;; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
  lnext = ^V; flush = ^O; min = 1; time = 0;
  -parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
  -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
  -iuclc -ixany -imaxbel
  opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab3 bs0 vt0 ff0
  isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
  echoctl echoke
  </code></pre>
  
  <p>I just noticed that if I do <code>ls -la /bin</code>, which is a long command to execute since the list is long, I cannot break by just issuing CTRL+C, but I can when keeping the keys down. It breaks after about one second. This doesn't work with ping, however.</p>
  
  <p>In fact, if I do <code>seq 1 1000</code> and then press CTRL+C, it seems like it skips many lines at one shot at some point:</p>
  
  <pre><code>93
  94
  95
  ^C6
  897
  898
  899
  </code></pre>
  
  <p>Same thing happens with <code>ls -la /bin</code>:</p>
  
  <pre><code>lrwxrwxrwx    1 10042    2223            7 May  6  2012 dmesg -&gt; busybox
  lrwxrwxrwx    1 10042    2223            7 May  6  2012 dos2unix -&gt; busybox
  lrwxrwxrwx    1 10042    2223            7^C          7 May  6  2012 ipcrm -&gt; busybox
  lrwxrwxrwx    1 10042    2223            7 May  6  2012 ipcs -&gt; busybox
  lrwxrwxrwx    1 10042    2223            7 May  6  2012 iplink -&gt; busybox
  </code></pre>