Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

/*
 * Project: S.Ha.R.K.
 *
 * Coordinators:
 *   Giorgio Buttazzo    <giorgio@sssup.it>
 *   Paolo Gai           <pj@gandalf.sssup.it>
 *
 * Authors     :
 *   Paolo Gai           <pj@gandalf.sssup.it>
 *   (see the web pages for full authors list)
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://shark.sssup.it
 */


/*
 * Copyright (C) 2000 Giorgio Buttazzo, Paolo Gai
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 *
 * CVS :        $Id: keycode.c,v 1.1 2002-11-11 08:22:46 pj Exp $
 */


#include <kernel/kern.h>
#include <drivers/keyb.h>

int main(int argc, char **argv)
{
    KEY_EVT k;

    clear();
    k.ascii = 0;

    cprintf("Press ESC to end the demo, 2 for itamap, 3 for engmap\n");
    while (k.ascii != ESC) {
        keyb_getcode(&k,BLOCK);
        if (k.ascii == '2') {
            keyb_set_map(itaMap);
            cprintf("\nItalian Keymap set\n");
        }
        if (k.ascii == '3') {
            keyb_set_map(engMap);
            cprintf("\nEnglish Keymap set\n");
        }
        if (isLeftCtrl(k)) putc_xy(72+0,0,RED,'L');
        else putc_xy(72+0,0,RED,' ');
        if (isRightCtrl(k)) putc_xy(72+1,0,RED,'R');
        else putc_xy(72+1,0,RED,' ');
        if (isLeftAlt(k)) putc_xy(72+2,0,GREEN,'L');
        else putc_xy(72+2,0,RED,' ');
        if (isRightAlt(k)) putc_xy(72+3,0,GREEN,'R');
        else putc_xy(72+3,0,RED,' ');
        if (isLeftShift(k)) putc_xy(72+4,0,YELLOW,'L');
        else putc_xy(72+4,0,RED,' ');
        if (isRightShift(k)) putc_xy(72+5,0,YELLOW,'R');
        else putc_xy(72+5,0,RED,' ');
       
        cprintf("%d [%c]\t",k.scan,k.ascii);

    }

    sys_end();
    return 0;
}