Пример #1
0
static irqreturn_t kb_interrupt(int irq, void *dev_id)
{
	unsigned char scancode;
	scancode = read_kbd_input();
        printk("scancode = %d\n",scancode);
	upcode=scancode;
	wtevnt=1;
	wake_up_interruptible(&mykb_queue);
	return 0;
}
Пример #2
0
static irqreturn_t kb_interrupt(int irq, void *dev_id)
{
        unsigned char scancode;
        unsigned char kc;
        scancode = read_kbd_input();
        kc = key_code(scancode);
/* if key is know we will wake up the process otherwise we will not */
        if( kc !=255){
                up_code =key_ascii_codes[kc];
                wtevnt=1;
                wake_up_interruptible(&kb_queue);
        }
        return IRQ_HANDLED;
}
Пример #3
0
int main ( int argc,
	    char *argv[ ] )
/*
Function:   main
Author:     Neil Cossor
Modified:   20000122

Description:

   This function starts the program, gathers the log on data, logs on to the
   system, downloads various data, sets up the exit procedure,
   and kicks off the main loop.

Input Parameters:

    (generic C) The first string (argv[0]) is the program name, and each
    following string is an argument passed to the program from the command
    line. The last pointer (argv[argc]) is NULL.

    (app specific, if supplied.. may be NULLed by specifying "" in command line)
    argv[1] == name of logfile for output. Default LOGFILE.TXT
    argv[2] == name of User file, containing CLICK username, gateway name etc
	defaults to name (in const.h) #defined by USER_DATA_FILENAME
    argv[3] == name of script file to run. No default.
	If supplied, then it is
	- loaded immediately
	- run
	- and then the application exits
	If not supplied, then we run in interactive mode. Note that a script
	file can be LOADed and RUN from interactive mode.
*/
{
    int32   status_i		=   SUCCESSFUL;
    int8    command_line_s[USER_INPUT_BUFFER_LEN];


	click_details_xt z;
	int k = sizeof(z.log_reply_x.trans_reply_x );

    /* code */
    printf("\n\nWelcome to Version %s of the simulator.\n",SIM_VERSION);
    printf("______________________________________________\n\n");
    printf("\nThis session started on " );
    printf_time ();
    printf ("\n");
    printf ("Commandline args are :-\n");
    display_arglist ( argc, &argv[0] );

    // stash the supplied command line params
    // try for 4th param - script filename
    if ( argc > 3)
    {
	// have enough arguments for a script filename
	user_script_filename_ps = argv[3];
    }
    if ( argc > 2)
    {
	// have enough arguments for a user param filename
	strcpy ( user_param_filename_ps, argv[2] );
    }
    if ( argc > 1)
    {
	// have more arguments than just the program name - try for logfile name
	user_log_filename_ps = argv[1];
    }	// test if enuff params for a logfile name to be supplied

    // try to set everything up... including allocation of memory for generic data
    click_px = ISESim_init ( argc, &argv[0] );
    if (click_px == NULL)   // 0
    {
	printf("\nAborting - error starting logger\n");
	exit(0);
    }

    // if the caller supplied a SIM script file, then we just load that,
    // execute it, and exit
    if ( ( user_script_filename_ps != NULL )
	&& ( strlen ( user_script_filename_ps ) != 0 ) )
    {
	// load and run the script
	status_i = load_script_file ( user_script_filename_ps );
	// did the load work OK
	if (status_i == SUCCESSFUL)
	{
	    // attempt to actually run the script
	    // 1 argument, no "parameter", so it makes it default to 1 run
	    status_i = run_script_file ( click_px, 1, NULL );
	}   // test if script load worked OK
    }
    else
    {
	// print out help prompt
	printf("Commands useful at this point are:- \n\tLOAD LOGON HELP EXIT QUIT.\n\n");
	printf("Please Type '?' or Help for Help on Commands\n");

	status_i = SUCCESSFUL;
	while (status_i >= SUCCESSFUL)
	{
	    // zot the input line
	    memset (&command_line_s[0],
		   (char)0,
		    sizeof (command_line_s));

	    // process keyboard input
	    printf("ISESim> ");
	    // get a command from the user
	    read_kbd_input ( &command_line_s[0] );
	    // and process it
	    status_i = process_commands (click_px,
					    &command_line_s[0],
					    FALSE );
	}   // while no errors processing commands, and no exit/quit request
    };	// test if running a script from initial program arguments

    exit (status_i);
}   // main