[BusyBox] re: CTRL-C over serial console

Doug Edwards dedwards at synergymicro.com
Thu Jun 20 13:28:03 UTC 2002


Thanks.  I tried solution #3 and it worked fine.


Thanks again.

Doug Edwards





At 1:49 PM +0000 6/20/02, gopi at india.tejasnetworks.com wrote:
>I am attatching the mail that was exchanged on this subject in the 
>ppc mailing list.
>
>I tried the option (1) and (3) and it works.
>(1) is ithe easiest thing to do.  You have to make the change in /etc/inittab
>
>thanx
>gopi
>
>---------- Forwarded message ----------
>Date: Thu, 31 Jan 2002 13:34:34 -0800
>From: Scott Anderson <scott_anderson at mvista.com>
>To: gopi at india.tejasnetworks.com
>Cc: linuxppc-dev at lists.linuxppc.org
>Subject: Re: why is tty->pgrp set to -1 for console?
>
>gopi at india.tejasnetworks.com wrote:
>>    What is the correct procedure to follow to get around this problem
>>  and get ctrl-c working on console?
>
>It looks like everyone is taking a swing at this one, so I think I'll
>join in.  First off, the easiest way I've found to track down why
>ctrl-c doesn't work is to just run "ps -j".  For ctrl-c to work, you
>need a controlling terminal (the TTY column) and a process group.  If
>you have a '?' in the TTY column, ctrl-c won't work.  In the past I
>have seen this happen because of this code in drivers/char/tty_io.c:
>         if (device == SYSCONS_DEV) {
>                 struct console *c = console_drivers;
>                 while(c && !c->device)
>                         c = c->next;
>                 if (!c)
>                         return -ENODEV;
>                 device = c->device(c);
>                 filp->f_flags |= O_NONBLOCK; /* Don't let 
>/dev/console block */
>                 noctty = 1;
>         }
>Note that O_NOCTTY (no controlling terminal) is forced on whenever
>/dev/console is opened (noctty = 1).  Possible workarounds:
>   1) Run getty on something other than /dev/console.  For example,
>      if you console is on the first serial port, run getty on /dev/ttyS0.
>      I believe this is the "correct" answer.
>   2) You could also change getty to do a TIOCSCTTY ioctl explicitly after
>      it has opened the terminal.
>   3) You could remove the forcing of noctty on from tty_io.c
>
>     Scott Anderson
>     scott_anderson at mvista.com   MontaVista Software Inc.
>     (408)328-9214               1237 East Arques Ave.
>     http://www.mvista.com       Sunnyvale, CA  94085
>
>  > From gopi at india.tejasnetworks.com Fri Feb  1 11:35:42 2002
>>  Date: Thu, 31 Jan 2002 20:58:58 +0000 (GMT)
>>  From: gopi at india.tejasnetworks.com
>>  To: linuxppc-embedded at lists.linuxppc.org
>>  Cc: linuxppc-dev at lists.linuxppc.org
>>  Subject: why is tty->pgrp set to -1 for console?
>>
>>  hi..
>>
>>    We had a problem that ctrl-c was not working on the console.  I
>>  figured out that, ctrl-c was getting recognized as the 'intr' signal,
>>  but the function isig (in drivers/char/n_tty.c) sends a signal only if
>  > the tty->pgrp > 0.
>  >
>  >   I have put a print stmt in this function and checked that the value
>  >   is 'tty->pgrp = ffffffff' (which is -1).
>  >
>  >   What is the correct procedure to follow to get around this problem
>>  and get ctrl-c working on console?
>>
>>  thanx
>>  gopi
>>
>>  following is the output of stty -a on the console
>>  ---------------------------------------------------------------------
>>  speed 9600 baud; rows 0; columns 0; line = 
>>0;                                  
>>  intr = ^C; quit = ^\; erase = ^?; kill = ^X; eof = ^D; eol = 
>><undef>;          
>>  eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase =
>>  ^W;     
>>  lnext = ^V; flush = ^U; 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
>  > ---------------------------------------------------------------------
>>
>>
>
>
>
>
>
>On Thu, 20 Jun 2002, Matthias Fuchs wrote:
>
>>  Hi Doug,
>>
>>  the problem also came up on my PPC system. I am not using uclibc!
>>  Also CTRL-C is working over telnet connections.
>>
>>  The patch that was send to the list some time ago is very huge. 
>>And I counld'n apply it
>>  to recent CVS version (0.61pre). It did not only fix the CTRL-C 
>>problem. But I didn't care about the
>>  other enhancements it brought.
>>
>>  Matthias
>>
>>  Doug Edwards wrote:
>>  >
>>  >
>>  > |Matthias Fuchs  matthias.fuchs at esd-electronics.com
>>  > |/Wed Jun 12 03:01:03 2002/
>>  > |
>>  > |Hi,
>>  > |
>>  > |in april I mentioned a problem with CTRL-C over a serial console (it
>>  > did not |work).
>>  > |Ilquiz posted a huge patch to solve this problem.
>>  > |
>>  > |My quiestion: Is this problem already fixed in the CVS ?
>>  > |
>>  > |Matthias
>>  >
>>  >
>>  > I'm encountering this problem as well.  I'm using busybox 0.60.3 and a
>>  > uclibc snapshot dated June 6 on ppc running the 2.4.12 kernel (modified
>>  > for our hardware).  I can use CTRL-C when connected through telnet, but
>>  > not through the serial console.
>>  >
>>  > I was not on the discussion list when the patch was sent, so I don't
>>  > know what the fix is.  I do need to fix this problem.
>>  >
>>  > By the way, busybox is a great piece of software.  It's working very
>>  > well for my embedded project.
>>  >
>>  > Thanks,
>>  >
>>  > Doug
>>  >
>>  > --
>>  > _____________________
>>  >
>>  > Doug Edwards
>>  >
>>  > Synergy Microsystems
>>  > 9605 Scranton Rd., Suite 700
>>  > San Diego, CA  92121-1773
>>  > dedwards at synergymicro.com
>>  > (858)452-0020
>>  > http://www.synergymicro.com
>>  > _____________________
>>
>>
>>




More information about the busybox mailing list