diff options
| author | Calvin Morrison <calvin@pobox.com> | 2026-05-24 14:45:24 -0400 |
|---|---|---|
| committer | Calvin Morrison <calvin@pobox.com> | 2026-05-24 14:45:24 -0400 |
| commit | ff020f03a29dd26bda0b891c562226fa7a61eb19 (patch) | |
| tree | 2152d68b222dfc654e55a2add1860cbc6e8e5bdf /src/model/ossmodel.cpp | |
| parent | 71d01139cf2ac4380c2ee13ecdcff77eb1d42897 (diff) | |
show error page in OSS mixer window when backend fails to open
If /dev/mixer can't be opened (missing device, bad permissions, etc.)
the window now shows the error reason instead of silently not appearing.
The tray is also skipped in the error case.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/model/ossmodel.cpp')
| -rw-r--r-- | src/model/ossmodel.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/model/ossmodel.cpp b/src/model/ossmodel.cpp index 35aa842..fb14c2c 100644 --- a/src/model/ossmodel.cpp +++ b/src/model/ossmodel.cpp @@ -4,6 +4,8 @@ #include <fcntl.h> #include <unistd.h> #include <stdio.h> +#include <errno.h> +#include <string.h> #include <tdeconfig.h> #include <tdeglobal.h> #include <tqtimer.h> @@ -34,7 +36,11 @@ bool OssModel::open() ::close(probe); openCard(i, TQString::fromLocal8Bit(path)); } - if ( m_devices.isEmpty() ) return false; + if ( m_devices.isEmpty() ) { + if ( m_lastError.isEmpty() ) + m_lastError = TQString("No OSS mixer devices found."); + return false; + } m_timer->start(500); emit ready(); return true; @@ -43,7 +49,12 @@ bool OssModel::open() void OssModel::openCard( int cardIdx, const TQString &path ) { int fd = ::open(path.local8Bit().data(), O_RDWR); - if ( fd < 0 ) return; + if ( fd < 0 ) { + if ( m_lastError.isEmpty() ) + m_lastError = path + ": " + TQString::fromLocal8Bit(strerror(errno)); + return; + } + m_lastError = TQString(); mixer_info info; TQString cardName; |
