summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/model')
-rw-r--r--src/model/ossmodel.cpp15
-rw-r--r--src/model/ossmodel.h3
2 files changed, 16 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;
diff --git a/src/model/ossmodel.h b/src/model/ossmodel.h
index 8c3db8b..0ab6b15 100644
--- a/src/model/ossmodel.h
+++ b/src/model/ossmodel.h
@@ -25,6 +25,8 @@ public:
bool open();
void close();
+ TQString lastError() const { return m_lastError; }
+
TQValueList<OssCard> cards() const { return m_cards; }
TQPtrList<OssDevice> devices() const { return m_devices; }
TQPtrList<OssDevice> devicesForCard( int cardIdx ) const;
@@ -47,4 +49,5 @@ private:
TQPtrList<OssDevice> m_devices;
TQValueList<int> m_fds; // one open fd per card, owned here
TQTimer *m_timer;
+ TQString m_lastError;
};