[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Keyboard-problem with XaAES helmut-branch



Helmut Karlowski wrote:

> only possible under MiNT and toswin. I guess you can set your console to
> raw-mode, but I cannot find it atm (I used tcsetpgrp or similar, but I'm
> not sure if it really would work).

I'm using this in a non-GEM-program (stolen from somewhere):

void makeraw( struct termios *tattr )
{
	tattr->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
	/*tattr->c_iflag |= ICRNL;	/*no effect!?!*/
	tattr->c_oflag &= ~OPOST;
	tattr->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
	/*tattr->c_lflag |= ICANON;*/
	tattr->c_cflag &= ~(CSIZE|PARENB);
	tattr->c_cflag |= CS8;
	/*tattr->c_cflag |= CCTS_OFLOW|CRTS_IFLOW;*/

}


void
set_input_mode (int fileno)
{
	int i;
	struct termios tattr;
	char *name;


	/* Make sure fileno is a terminal. */
	if (!isatty (fileno))
	  {
	    fprintf (stderr, "Not a terminal.\n");
	    exit (EXIT_FAILURE);
	  }

	/* Save the terminal attributes so we can restore them later. */
	/*tcgetattr (fileno, &saved_attributes[i]);*/
	/*atexit (reset_input_mode_exit);*/
	/* Set the funny terminal modes. */
	tcgetattr (fileno, &tattr);
	makeraw( &tattr );
	/*tattr.c_lflag |= ICANON;*/
	/*tattr.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON (no canonical input) and no ECHO. */
	tattr.c_cc[VMIN] = 0;
	/*tattr.c_cc[VMIN] = 16;*/
	tattr.c_cc[VTIME] = 1;	/*wait 0.4s? for input*/
	tcsetattr (fileno, TCSAFLUSH, &tattr);
}



-Helmut