From c4c29f33d47981d2379b4f81f815adcf506d7ad9 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Sun, 21 Feb 2021 17:09:41 +0000 Subject: [PATCH] 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. --- src/Input/FGLinuxEventInput.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Input/FGLinuxEventInput.cxx b/src/Input/FGLinuxEventInput.cxx index dcdae8d6e..20c3437b2 100644 --- a/src/Input/FGLinuxEventInput.cxx +++ b/src/Input/FGLinuxEventInput.cxx @@ -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 ) {