X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInput%2FFGLinuxEventInput.cxx;h=39702cfc75998bfd91c60f100152bd9099252e5f;hb=5151f7f5e0ba7c7e6688bdfbc4cea365196e1ed3;hp=4825861daba8f9da6339582735a2277fbbdedc3c;hpb=31995420d3774ece908f7509758b452888212a42;p=flightgear.git diff --git a/src/Input/FGLinuxEventInput.cxx b/src/Input/FGLinuxEventInput.cxx index 4825861da..39702cfc7 100644 --- a/src/Input/FGLinuxEventInput.cxx +++ b/src/Input/FGLinuxEventInput.cxx @@ -23,6 +23,7 @@ #endif #include +#include #include #include #include "FGLinuxEventInput.hxx" @@ -413,9 +414,18 @@ void FGLinuxInputDevice::Send( const char * eventName, double value ) evt.value = (long)value; evt.time.tv_sec = 0; evt.time.tv_usec = 0; - write( fd, &evt, sizeof(evt) ); - SG_LOG( SG_INPUT, SG_DEBUG, "Written event " << eventName - << " as type=" << evt.type << ", code=" << evt.code << " value=" << evt.value ); + size_t bytes_written = write(fd, &evt, sizeof(evt)); + + if( bytes_written == sizeof(evt) ) + SG_LOG( SG_INPUT, + SG_DEBUG, + "Written event " << eventName << " as type=" << evt.type + << ", code=" << evt.code + << " value=" << evt.value ); + else + SG_LOG( SG_INPUT, + SG_WARN, + "Failed to write event: written = " << bytes_written ); } static char ugly_buffer[128];