1
0
Fork 0

src/Input/FGLinuxEventInput.cxx: don't throw if we cannot open device.

Throwing halts execution; we now output a diagnostic and return false, and
flightgear appears ok to continue.
This commit is contained in:
Julian Smith 2021-02-21 17:09:41 +00:00
parent f3ef077730
commit c4c29f33d4

View file

@ -290,8 +290,13 @@ static inline bool bitSet( unsigned char * buf, unsigned bit )
bool FGLinuxInputDevice::Open()
{
if( fd != -1 ) return true;
if( (fd = ::open( devname.c_str(), O_RDWR )) == -1 ) {
throw std::exception();
if( (fd = ::open( devname.c_str(), O_RDWR )) == -1 ) {
SG_LOG( SG_INPUT, SG_ALERT, "Cannot open devname='" << devname
<< "'. errno=" << errno
<< ": " << strerror(errno)
);
//throw std::exception();
return false;
}
if( GetGrab() && ioctl( fd, EVIOCGRAB, 2 ) == -1 ) {