v.digit problems: STILL

Janne Soimasuo jsoi at gis.joensuu.fi
Thu Sep 15 08:41:54 EDT 1994


Hi !

The problem with linux and v.digit is set_key.c-file. With linux you should use
some bsd-stuff. Furthermore you have to add -lbsd when linkng v.digit

There is still something wrong with linux and digitizing boards:
It works once (if it works at all) with same post configuration.
(/dev/ttyS0 etc.). If you try to use it another time the programs stops.

I donno if it is v.digit or linux which causes this problem.

Here is the set_key.c-file I got from Andy Burnett

(I posted this to D. Gerdes also)

Hope this helps you !
*******************************************************************************
* Janne Soimasuo            *     phone +358-73-151 4519                       *
* GIS & RS lab.             *     fax   +358-73-151 3590                       *
* Faculty of Forestry       *                                                  *
* University of Joensuu     *     email janne.soimasuo at joensuu.fi              *
*                           *           jsoi at gis.joensuu.fi                    *
* P.O.BOX 111               *                                                  *
* FIN-80101 JOENSUU         * "There never enough time to do all the nothing   *
* FINLAND                   *  you want"  Calvin                               *
********************************************************************************
set_key.c:

/*
**  US Army Construction Engineering Research Lab
**  Written by GRASS 3.0 Summer of 88,  -mh
*/

/**************************
*
*  This file includes
*	set_keyboard()   -  set the keyboard up for key_hit()
*	unset_keyboard() -  set the keyboard back to original mode
*	key_hit()	 -  will try to read a character from the keyboard.
*			if a key has been hit and it is placed it in the passed
*			in the buffer and a true value is returned.
*			if no key has been hit return false 0.
*
**************************/


#include	<bsd/sgtty.h>

#define		KEYBOARD	0

set_keyboard () {}
unset_keyboard () {}


int
key_hit(buf)
	char	*buf ;
{

	int	Keyhit ;

	if (ioctl (KEYBOARD, FIONREAD, &Keyhit) < 0)
	{
		printf ("\nioctl failed") ;
		close_down(-1) ;
	}

	if ( ! Keyhit)
		return (0) ;

	Get_curses_char(buf) ;

	return (Keyhit) ;

}




/********************
*
*	nodelay() is only on the 3B2.
*

#ifndef  USE_TERMIO
#include	<bsd/sgtty.h>
#endif

#define		KEYBOARD	0


set_keyboard ()
{
	return (0);
}



unset_keyboard ()
{
	return (0);
}


int
key_hit(buf)
	char	*buf ;
{

	int	status ;


	if (ioctl (KEYBOARD, FIONREAD, &status) < 0)
	{
		printf ("\nioctl failed") ;
		close_down(-1) ;
	}

	if ( ! status)
		return (0) ;

	Get_curses_char(buf) ;

	return (status) ;

}
****************************************/



More information about the grass-user mailing list