author | mickeyl <mickeyl> | 2005-06-17 13:47:42 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-06-17 13:47:42 (UTC) |
commit | c36e39b5b1e450e64d4c38cb59e56048a2bec258 (patch) (side-by-side diff) | |
tree | 0e796a165a2e4ce8e24b8b79f15bb58f4265a7bb | |
parent | 0e11eb29a20ff6bff533a07ff604ed858237f82b (diff) | |
download | opie-c36e39b5b1e450e64d4c38cb59e56048a2bec258.zip opie-c36e39b5b1e450e64d4c38cb59e56048a2bec258.tar.gz opie-c36e39b5b1e450e64d4c38cb59e56048a2bec258.tar.bz2 |
- disable DEBUG in opcmciasystem
- fix suspend/resume logic
-rw-r--r-- | libopie2/opiecore/linux/opcmciasystem.cpp | 12 | ||||
-rw-r--r-- | noncore/applets/pcmcia/pcmcia.cpp | 9 |
2 files changed, 11 insertions, 10 deletions
diff --git a/libopie2/opiecore/linux/opcmciasystem.cpp b/libopie2/opiecore/linux/opcmciasystem.cpp index 2eece6b..054d261 100644 --- a/libopie2/opiecore/linux/opcmciasystem.cpp +++ b/libopie2/opiecore/linux/opcmciasystem.cpp @@ -46,13 +46,13 @@ using namespace Opie::Core; #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #define PROC_DEVICES "/proc/devices" -#define OPCMCIA_DEBUG 1 +// #define OPCMCIA_DEBUG 1 /*====================================================================================== * OPcmciaSystem *======================================================================================*/ OPcmciaSystem* OPcmciaSystem::_instance = 0; @@ -302,37 +302,37 @@ bool OPcmciaSocket::isSuspended() const return status() && Suspended; } bool OPcmciaSocket::eject() { - return ::ioctl( _fd, DS_EJECT_CARD ); + return ::ioctl( _fd, DS_EJECT_CARD ) != -1; } bool OPcmciaSocket::insert() { - return ::ioctl( _fd, DS_INSERT_CARD ); + return ::ioctl( _fd, DS_INSERT_CARD ) != -1; } bool OPcmciaSocket::suspend() { - return ::ioctl( _fd, DS_SUSPEND_CARD ); + return ::ioctl( _fd, DS_SUSPEND_CARD ) != -1; } bool OPcmciaSocket::resume() { - return ::ioctl( _fd, DS_RESUME_CARD ); + return ::ioctl( _fd, DS_RESUME_CARD ) != -1; } bool OPcmciaSocket::reset() { - return ::ioctl( _fd, DS_RESET_CARD ); + return ::ioctl( _fd, DS_RESET_CARD ) != -1; } QStringList OPcmciaSocket::productIdentity() const { QStringList list; diff --git a/noncore/applets/pcmcia/pcmcia.cpp b/noncore/applets/pcmcia/pcmcia.cpp index aea699f..99c1bc9 100644 --- a/noncore/applets/pcmcia/pcmcia.cpp +++ b/noncore/applets/pcmcia/pcmcia.cpp @@ -54,12 +54,13 @@ using namespace Opie::Ui; /* STD */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> +#include <errno.h> #include <fcntl.h> #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) #include <sys/vfs.h> #include <mntent.h> #endif @@ -133,14 +134,14 @@ void PcmciaManager::mousePressEvent( QMouseEvent* ) submenu->insertItem( "&Resume", RESUME+i*100 ); submenu->insertItem( "Rese&t", RESET+i*100 ); submenu->insertItem( "&Configure", CONFIGURE+i*100 ); submenu->setItemEnabled( EJECT+i*100, !it.current()->isEmpty() ); submenu->setItemEnabled( INSERT+i*100, it.current()->isEmpty() ); - submenu->setItemEnabled( SUSPEND+i*100, !it.current()->isEmpty() && !it.current()->isSuspended() ); - submenu->setItemEnabled( RESUME+i*100, !it.current()->isEmpty() && it.current()->isSuspended() ); + submenu->setItemEnabled( SUSPEND+i*100, !it.current()->isEmpty() && it.current()->isSuspended() ); + submenu->setItemEnabled( RESUME+i*100, !it.current()->isEmpty() && !it.current()->isSuspended() ); submenu->setItemEnabled( CONFIGURE+i*100, !it.current()->isEmpty() && !configuring ); connect( submenu, SIGNAL(activated(int)), this, SLOT(userCardAction(int)) ); menu->insertItem( tr( "%1: %2" ).arg( i++ ).arg( it.current()->identity() ), submenu, 1 ); ++it; } @@ -256,13 +257,13 @@ int PcmciaManager::position() void PcmciaManager::execCommand( const QStringList &strList ) { } void PcmciaManager::userCardAction( int action ) { - odebug << "user action requested. action = " << action << oendl; + odebug << "user action on socket " << action / 100 << " requested. action = " << action << oendl; int socket = action / 100; int what = action % 100; bool success = false; switch ( what ) @@ -275,13 +276,13 @@ void PcmciaManager::userCardAction( int action ) case RESET: success = OPcmciaSystem::instance()->socket( socket )->reset(); break; default: odebug << "not yet implemented" << oendl; } if ( !success ) { - owarn << "couldn't perform user action" << oendl; + owarn << "couldn't perform user action (" << strerror( errno ) << ")" << oendl; } } void PcmciaManager::configure( OPcmciaSocket* card ) { |