git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix EVIOCGRAB ioctl
[enigma2.git]
/
lib
/
driver
/
rc.cpp
diff --git
a/lib/driver/rc.cpp
b/lib/driver/rc.cpp
index c7acd1138a1b35bc10c937e72df8e0d53453ff7d..c56fde448cd396ea72af4be94b4655e368b5e9bb 100644
(file)
--- a/
lib/driver/rc.cpp
+++ b/
lib/driver/rc.cpp
@@
-81,7
+81,6
@@
eRCShortDriver::eRCShortDriver(const char *filename): eRCDriver(eRCInput::getIns
{
sn=eSocketNotifier::create(eApp, handle, eSocketNotifier::Read);
CONNECT(sn->activated, eRCShortDriver::keyPressed);
{
sn=eSocketNotifier::create(eApp, handle, eSocketNotifier::Read);
CONNECT(sn->activated, eRCShortDriver::keyPressed);
- eRCInput::getInstance()->setFile(handle);
}
}
}
}
@@
-115,7
+114,6
@@
eRCInputEventDriver::eRCInputEventDriver(const char *filename): eRCDriver(eRCInp
{
sn=eSocketNotifier::create(eApp, handle, eSocketNotifier::Read);
CONNECT(sn->activated, eRCInputEventDriver::keyPressed);
{
sn=eSocketNotifier::create(eApp, handle, eSocketNotifier::Read);
CONNECT(sn->activated, eRCInputEventDriver::keyPressed);
- eRCInput::getInstance()->setFile(handle);
}
}
}
}
@@
-127,6
+125,16
@@
std::string eRCInputEventDriver::getDeviceName()
return name;
}
return name;
}
+void eRCInputEventDriver::setExclusive(bool b)
+{
+ if (handle >= 0)
+ {
+ int grab = b;
+ if (::ioctl(handle, EVIOCGRAB, grab) < 0)
+ perror("EVIOCGRAB");
+ }
+}
+
eRCInputEventDriver::~eRCInputEventDriver()
{
if (handle>=0)
eRCInputEventDriver::~eRCInputEventDriver()
{
if (handle>=0)
@@
-165,7
+173,6
@@
eRCInput::eRCInput()
{
ASSERT( !instance);
instance=this;
{
ASSERT( !instance);
instance=this;
- handle = -1;
locked = 0;
keyboardMode = kmNone;
}
locked = 0;
keyboardMode = kmNone;
}
@@
-183,21
+190,18
@@
bool eRCInput::open()
return false;
}
return false;
}
-
int
eRCInput::lock()
+
void
eRCInput::lock()
{
locked=1;
{
locked=1;
- return handle;
+ for (std::map<std::string,eRCDevice*>::iterator i=devices.begin(); i != devices.end(); ++i)
+ i->second->setExclusive(false);
}
void eRCInput::unlock()
{
}
void eRCInput::unlock()
{
- if (locked)
- locked=0;
-}
-
-void eRCInput::setFile(int newh)
-{
- handle=newh;
+ locked=0;
+ for (std::map<std::string,eRCDevice*>::iterator i=devices.begin(); i != devices.end(); ++i)
+ i->second->setExclusive(true);
}
void eRCInput::addDevice(const std::string &id, eRCDevice *dev)
}
void eRCInput::addDevice(const std::string &id, eRCDevice *dev)
@@
-216,7
+220,7
@@
eRCDevice *eRCInput::getDevice(const std::string &id)
if (i == devices.end())
{
eDebug("failed, possible choices are:");
if (i == devices.end())
{
eDebug("failed, possible choices are:");
- for (std::map<std::string,eRCDevice*>::iterator i=devices.begin(); i != devices.end(); ++i)
+ for (std::map<std::string,eRCDevice*>::iterator i=devices.begin(); i != devices.end(); ++i)
eDebug("%s", i->first.c_str());
return 0;
}
eDebug("%s", i->first.c_str());
return 0;
}