diff --git a/src/dev/posix/hasp_posix.cpp b/src/dev/posix/hasp_posix.cpp index db6aa584..e5f1b173 100644 --- a/src/dev/posix/hasp_posix.cpp +++ b/src/dev/posix/hasp_posix.cpp @@ -246,7 +246,7 @@ bool PosixDevice::is_system_pin(uint8_t pin) return false; } -void Win32Device::run_thread(void (*func)(void*), void* arg) +void PosixDevice::run_thread(void (*func)(void*), void* arg) { pthread_t thread; pthread_create(&thread, NULL, (void* (*)(void*))func, arg); diff --git a/src/main_pc.cpp b/src/main_pc.cpp index 63d3d2bb..40431d75 100644 --- a/src/main_pc.cpp +++ b/src/main_pc.cpp @@ -17,6 +17,7 @@ #if defined(POSIX) #include #include +#include #include #include #include @@ -112,6 +113,7 @@ void usage(const char* progName, const char* version) << std::endl << "Options:" << std::endl << " -h | --help Print this help" << std::endl + << " -q | --quiet Suppress console output (can improve performance)" << std::endl #if !USE_FBDEV << " -W | --width Width of the window" << std::endl << " -H | --height Height of the window" << std::endl @@ -140,6 +142,15 @@ int main(int argc, char* argv[]) for(int arg = 1; arg < argc; arg++) { if(strncmp(argv[arg], "--help", 6) == 0 || strncmp(argv[arg], "-h", 2) == 0) { showhelp = true; + } else if(strncmp(argv[arg], "--quiet", 7) == 0 || strncmp(argv[arg], "-q", 2) == 0) { +#if defined(WINDOWS) + FreeConsole(); +#endif +#if defined(POSIX) + int nullfd = open("/dev/null", O_WRONLY); + dup2(nullfd, 1); + close(nullfd); +#endif #if !USE_FBDEV } else if(strncmp(argv[arg], "--width", 7) == 0 || strncmp(argv[arg], "-W", 2) == 0) { if(arg + 1 < argc) {