Subject: Re: Trapping CTRL-AMIGA-AMIGA
To: Markus Illenseer <markus@techfak.uni-bielefeld.de>
From: Michael L. Hitch <osymh@gemini.oscs.montana.edu>
List: amiga
Date: 01/11/1995 11:58:18
On Jan 11,  5:09pm, Markus Illenseer wrote:
> 
>  We want a secure implementation for either purposefull or accidental
> press of C-A-A.

  OK, then how about something like this.  This detects the reset warning
characters and does a bootsync().  There's a long DELAY() afterwards so I
can see what it does before the hard reset actuall occurs.


*** /tmp/sys/arch/amiga/dev/kbd.c	Fri Dec  2 04:19:46 1994
--- sys/arch/amiga/dev/kbd.c	Wed Jan 11 11:36:41 1995
***************
*** 208,231 ****
    struct kbd_softc *k = &kbd_softc;
    struct firm_event *fe;
    int put;
   
    /* now only invoked from generic CIA interrupt handler if there *is*
       a keyboard interrupt pending */
      
!   in = ciaa.sdr;
    /* ack */
    ciaa.cra |= (1 << 6);	/* serial line output */
    /* wait 200 microseconds (for bloody Cherry keyboards..) */
!   DELAY(200);
    ciaa.cra &= ~(1 << 6);
  
-   c = ~in;	/* keyboard data is inverted */
- 
    /* process the character */
    
!   c = (c >> 1) | (c << 7);	/* rotate right once */
  
-   
    /* if not in event mode, deliver straight to ite to process key stroke */
    if (! k->k_event_mode)
      {
--- 208,242 ----
    struct kbd_softc *k = &kbd_softc;
    struct firm_event *fe;
    int put;
+   static int reset_warning = 0;
   
    /* now only invoked from generic CIA interrupt handler if there *is*
       a keyboard interrupt pending */
      
!   c = ~ciaa.sdr;	/* keyboard data is inverted */
! 
!   c = (c >> 1) | (c << 7);	/* rotate right once */
! 
    /* ack */
    ciaa.cra |= (1 << 6);	/* serial line output */
+ 
+   if (reset_warning && c == 0x78) {	/* Second reset warning? */
+     printf ("kbdintr:  keyboard reset\n");
+     bootsync();
+     DELAY(50000000);
+   }
    /* wait 200 microseconds (for bloody Cherry keyboards..) */
!   DELAY(2000);
    ciaa.cra &= ~(1 << 6);
  
    /* process the character */
    
!   if (c == 0x78) {
!     reset_warning++;			/* Received 1st reset warning */
!     printf ("kbdintr:  keyboard reset warning\n");
!     return;				/* Don't bother processing it */
!   }
  
    /* if not in event mode, deliver straight to ite to process key stroke */
    if (! k->k_event_mode)
      {

-- 
Michael L. Hitch			INTERNET:  osymh@montana.edu
Computer Consultant
Office of Systems and Computing Services
Montana State University	Bozeman, MT	USA