diff options
-rw-r--r-- | tdecore/tdehw/tdeeventdevice.cpp | 254 | ||||
-rw-r--r-- | tdecore/tdehw/tdeeventdevice.h | 19 | ||||
-rw-r--r-- | tdecore/tdehw/tdehardwaredevices.cpp | 192 |
3 files changed, 271 insertions, 194 deletions
diff --git a/tdecore/tdehw/tdeeventdevice.cpp b/tdecore/tdehw/tdeeventdevice.cpp index 185c4153d..d8627d9b1 100644 --- a/tdecore/tdehw/tdeeventdevice.cpp +++ b/tdecore/tdehw/tdeeventdevice.cpp @@ -23,6 +23,7 @@ #include <linux/input.h> #include <tqsocketnotifier.h> +#include <tqtimer.h> #include "tdelocale.h" @@ -30,15 +31,36 @@ #include "config.h" +#define BITS_PER_LONG (sizeof(long) * 8) +#define NUM_BITS(x) ((((x) - 1) / BITS_PER_LONG) + 1) +#define OFF(x) ((x) % BITS_PER_LONG) +#define BIT(x) (1UL << OFF(x)) +#define LONG(x) ((x) / BITS_PER_LONG) +#define BIT_IS_SET(array, bit) ((array[LONG(bit)] >> OFF(bit)) & 1) + +#if defined(WITH_TDEHWLIB_DAEMONS) +#include <tqdbusconnection.h> +#include <tqdbusproxy.h> +#include <tqdbusmessage.h> +#include <tqdbusvariant.h> +#include <tqdbusdata.h> +#include <tqdbusdatalist.h> +#endif + TDEEventDevice::TDEEventDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) { m_fd = -1; - m_fdMonitorActive = false; + m_watchTimer = 0; + m_monitorActive = false; } TDEEventDevice::~TDEEventDevice() { if (m_fd >= 0) { close(m_fd); } + if (m_watchTimer) { + m_watchTimer->stop(); + delete m_watchTimer; + } } TDEEventDeviceType::TDEEventDeviceType TDEEventDevice::eventType() { @@ -50,17 +72,210 @@ void TDEEventDevice::internalSetEventType(TDEEventDeviceType::TDEEventDeviceType } TDESwitchType::TDESwitchType TDEEventDevice::providedSwitches() { + if (!m_monitorActive) { + internalReadProvidedSwitches(); + } return m_providedSwitches; } +void TDEEventDevice::internalReadProvidedSwitches() { + unsigned long switches[NUM_BITS(EV_CNT)]; + int r = 0; + + // Figure out which switch types are supported, if any + TDESwitchType::TDESwitchType supportedSwitches = TDESwitchType::Null; + if (m_fd >= 0) { + r = ioctl(m_fd, EVIOCGBIT(EV_SW, EV_CNT), switches); + } +#ifdef WITH_TDEHWLIB_DAEMONS + if( r < 1 ) { + TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); + if (dbusConn.isConnected()) { + TQT_DBusProxy switchesProxy("org.trinitydesktop.hardwarecontrol", + "/org/trinitydesktop/hardwarecontrol", + "org.trinitydesktop.hardwarecontrol.InputEvents", + dbusConn); + if (switchesProxy.canSend()) { + TQValueList<TQT_DBusData> params; + params << TQT_DBusData::fromString(deviceNode().ascii()); + TQT_DBusMessage reply = switchesProxy.sendWithReply("GetProvidedSwitches", params); + if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { + TQValueList<TQ_UINT32> list = reply[0].toList().toUInt32List(); + TQValueList<TQ_UINT32>::const_iterator it = list.begin(); + for (r = 0; it != list.end(); ++it, r++) { + switches[r] = (*it); + } + } + } + } + } +#endif + if (r > 0) { + if (BIT_IS_SET(switches, SW_LID)) { + supportedSwitches = supportedSwitches | TDESwitchType::Lid; + } + if (BIT_IS_SET(switches, SW_TABLET_MODE)) { + supportedSwitches = supportedSwitches | TDESwitchType::TabletMode; + } + if (BIT_IS_SET(switches, SW_RFKILL_ALL)) { + supportedSwitches = supportedSwitches | TDESwitchType::RFKill; + } + if (BIT_IS_SET(switches, SW_RADIO)) { + supportedSwitches = supportedSwitches | TDESwitchType::Radio; + } + if (BIT_IS_SET(switches, SW_MICROPHONE_INSERT)) { + supportedSwitches = supportedSwitches | TDESwitchType::MicrophoneInsert; + } + if (BIT_IS_SET(switches, SW_DOCK)) { + supportedSwitches = supportedSwitches | TDESwitchType::Dock; + } + if (BIT_IS_SET(switches, SW_LINEOUT_INSERT)) { + supportedSwitches = supportedSwitches | TDESwitchType::LineOutInsert; + } + if (BIT_IS_SET(switches, SW_JACK_PHYSICAL_INSERT)) { + supportedSwitches = supportedSwitches | TDESwitchType::JackPhysicalInsert; + } + if (BIT_IS_SET(switches, SW_VIDEOOUT_INSERT)) { + supportedSwitches = supportedSwitches | TDESwitchType::VideoOutInsert; + } +# ifdef SW_CAMERA_LENS_COVER + if (BIT_IS_SET(switches, SW_CAMERA_LENS_COVER)) { + supportedSwitches = supportedSwitches | TDESwitchType::CameraLensCover; + } +# endif +# ifdef SW_KEYPAD_SLIDE + if (BIT_IS_SET(switches, SW_KEYPAD_SLIDE)) { + supportedSwitches = supportedSwitches | TDESwitchType::KeypadSlide; + } +# endif +# ifdef SW_FRONT_PROXIMITY + if (BIT_IS_SET(switches, SW_FRONT_PROXIMITY)) { + supportedSwitches = supportedSwitches | TDESwitchType::FrontProximity; + } +# endif +# ifdef SW_ROTATE_LOCK + if (BIT_IS_SET(switches, SW_ROTATE_LOCK)) { + supportedSwitches = supportedSwitches | TDESwitchType::RotateLock; + } +# endif +# ifdef SW_LINEIN_INSERT + if (BIT_IS_SET(switches, SW_LINEIN_INSERT)) { + supportedSwitches = supportedSwitches | TDESwitchType::LineInInsert; + } +# endif + // Keep in sync with ACPI Event/Input identification routines above + if (systemPath().contains("PNP0C0D")) { + supportedSwitches = supportedSwitches | TDESwitchType::Lid; + } + if (systemPath().contains("PNP0C0E") || systemPath().contains("/LNXSLPBN")) { + supportedSwitches = supportedSwitches | TDESwitchType::SleepButton; + } + if (systemPath().contains("PNP0C0C") || systemPath().contains("/LNXPWRBN")) { + supportedSwitches = supportedSwitches | TDESwitchType::PowerButton; + } + } + m_providedSwitches = supportedSwitches; +} + void TDEEventDevice::internalSetProvidedSwitches(TDESwitchType::TDESwitchType sl) { m_providedSwitches = sl; } TDESwitchType::TDESwitchType TDEEventDevice::activeSwitches() { + if (!m_monitorActive) { + internalReadActiveSwitches(); + } return m_switchActive; } +void TDEEventDevice::internalReadActiveSwitches() { + unsigned long switches[NUM_BITS(EV_CNT)]; + int r = 0; + + TDESwitchType::TDESwitchType activeSwitches = TDESwitchType::Null; + if (m_fd >= 0) { + r = ioctl(m_fd, EVIOCGSW(sizeof(switches)), switches); + } +#ifdef WITH_TDEHWLIB_DAEMONS + if( r < 1 ) { + TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); + if (dbusConn.isConnected()) { + TQT_DBusProxy switchesProxy("org.trinitydesktop.hardwarecontrol", + "/org/trinitydesktop/hardwarecontrol", + "org.trinitydesktop.hardwarecontrol.InputEvents", + dbusConn); + if (switchesProxy.canSend()) { + TQValueList<TQT_DBusData> params; + params << TQT_DBusData::fromString(deviceNode().ascii()); + TQT_DBusMessage reply = switchesProxy.sendWithReply("GetActiveSwitches", params); + if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { + TQValueList<TQ_UINT32> list = reply[0].toList().toUInt32List(); + TQValueList<TQ_UINT32>::const_iterator it = list.begin(); + for (r = 0; it != list.end(); ++it, r++) { + switches[r] = (*it); + } + } + } + } + } +#endif + if (r > 0) { + if (BIT_IS_SET(switches, SW_LID)) { + activeSwitches = activeSwitches | TDESwitchType::Lid; + } + if (BIT_IS_SET(switches, SW_TABLET_MODE)) { + activeSwitches = activeSwitches | TDESwitchType::TabletMode; + } + if (BIT_IS_SET(switches, SW_RFKILL_ALL)) { + activeSwitches = activeSwitches | TDESwitchType::RFKill; + } + if (BIT_IS_SET(switches, SW_RADIO)) { + activeSwitches = activeSwitches | TDESwitchType::Radio; + } + if (BIT_IS_SET(switches, SW_MICROPHONE_INSERT)) { + activeSwitches = activeSwitches | TDESwitchType::MicrophoneInsert; + } + if (BIT_IS_SET(switches, SW_DOCK)) { + activeSwitches = activeSwitches | TDESwitchType::Dock; + } + if (BIT_IS_SET(switches, SW_LINEOUT_INSERT)) { + activeSwitches = activeSwitches | TDESwitchType::LineOutInsert; + } + if (BIT_IS_SET(switches, SW_JACK_PHYSICAL_INSERT)) { + activeSwitches = activeSwitches | TDESwitchType::JackPhysicalInsert; + } + if (BIT_IS_SET(switches, SW_VIDEOOUT_INSERT)) { + activeSwitches = activeSwitches | TDESwitchType::VideoOutInsert; + } +# ifdef SW_CAMERA_LENS_COVER + if (BIT_IS_SET(switches, SW_CAMERA_LENS_COVER)) { + activeSwitches = activeSwitches | TDESwitchType::CameraLensCover; + } +# endif +# ifdef SW_KEYPAD_SLIDE + if (BIT_IS_SET(switches, SW_KEYPAD_SLIDE)) { + activeSwitches = activeSwitches | TDESwitchType::KeypadSlide; + } +# endif +# ifdef SW_FRONT_PROXIMITY + if (BIT_IS_SET(switches, SW_FRONT_PROXIMITY)) { + activeSwitches = activeSwitches | TDESwitchType::FrontProximity; + } +# endif +# ifdef SW_ROTATE_LOCK + if (BIT_IS_SET(switches, SW_ROTATE_LOCK)) { + activeSwitches = activeSwitches | TDESwitchType::RotateLock; + } +# endif +# ifdef SW_LINEIN_INSERT + if (BIT_IS_SET(switches, SW_LINEIN_INSERT)) { + activeSwitches = activeSwitches | TDESwitchType::LineInInsert; + } +# endif + } + m_switchActive = activeSwitches; +} + void TDEEventDevice::internalSetActiveSwitches(TDESwitchType::TDESwitchType sl) { m_switchActive = sl; } @@ -124,17 +339,22 @@ TQStringList TDEEventDevice::friendlySwitchList(TDESwitchType::TDESwitchType swi return ret; } -void TDEEventDevice::internalStartFdMonitoring(TDEHardwareDevices* hwmanager) { - if (!m_fdMonitorActive) { +void TDEEventDevice::internalStartMonitoring(TDEHardwareDevices* hwmanager) { + if (!m_monitorActive) { // For security and performance reasons, only monitor known ACPI buttons if (eventType() != TDEEventDeviceType::Unknown) { if (m_fd >= 0) { m_eventNotifier = new TQSocketNotifier(m_fd, TQSocketNotifier::Read, this); connect( m_eventNotifier, TQT_SIGNAL(activated(int)), this, TQT_SLOT(eventReceived()) ); + m_monitorActive = true; } + } + if (m_monitorActive == true) { + // get initial state of switches + internalReadProvidedSwitches(); + internalReadActiveSwitches(); connect( this, TQT_SIGNAL(keyPressed(unsigned int, TDEEventDevice*)), hwmanager, TQT_SLOT(processEventDeviceKeyPressed(unsigned int, TDEEventDevice*)) ); } - m_fdMonitorActive = true; } } @@ -146,7 +366,33 @@ void TDEEventDevice::eventReceived() { if ((ev.type == EV_KEY) && (ev.value == 1)) { // Only detect keypress events (value == 1) emit keyPressed(ev.code, this); } + if (ev.type == EV_SW) { + emit switchChanged(); + } + } +} + +void TDEEventDevice::processActiveSwitches() { + TDESwitchType::TDESwitchType previousSwitches = m_switchActive; + internalReadActiveSwitches(); + + if (previousSwitches != m_switchActive) { + emit switchChanged(); + } +} + +void TDEEventDevice::connectNotify( const char* signal ) { + if( !m_monitorActive && qstrcmp( signal, TQT_SIGNAL(switchChanged())) == 0 ) { + m_watchTimer = new TQTimer(this); + connect( m_watchTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(processActiveSwitches()) ); + m_watchTimer->start( 2500, FALSE ); + m_monitorActive = true; + + // get initial state of switches + internalReadProvidedSwitches(); + internalReadActiveSwitches(); } + TQObject::connectNotify( signal ); } #include "tdeeventdevice.moc" diff --git a/tdecore/tdehw/tdeeventdevice.h b/tdecore/tdehw/tdeeventdevice.h index e2a03b10f..64130508c 100644 --- a/tdecore/tdehw/tdeeventdevice.h +++ b/tdecore/tdehw/tdeeventdevice.h @@ -122,12 +122,22 @@ class TDECORE_EXPORT TDEEventDevice : public TDEGenericDevice void internalSetEventType(TDEEventDeviceType::TDEEventDeviceType et); /** + * @internal + */ + void internalReadProvidedSwitches(); + + /** * @param sl a TDESwitchType::TDESwitchType with all switches provided by this device * @internal */ void internalSetProvidedSwitches(TDESwitchType::TDESwitchType sl); /** + * @internal + */ + void internalReadActiveSwitches(); + + /** * @param sl a TDESwitchType::TDESwitchType with all active switches provided by this device * @internal */ @@ -137,10 +147,12 @@ class TDECORE_EXPORT TDEEventDevice : public TDEGenericDevice * @param hwmanager the master hardware manager * @internal */ - void internalStartFdMonitoring(TDEHardwareDevices* hwmanager); + void internalStartMonitoring(TDEHardwareDevices* hwmanager); protected slots: void eventReceived(); + void processActiveSwitches(); + virtual void connectNotify( const char* signal ); signals: /** @@ -150,13 +162,16 @@ class TDECORE_EXPORT TDEEventDevice : public TDEGenericDevice */ void keyPressed(unsigned int keycode, TDEEventDevice* device); + void switchChanged(); + private: TDEEventDeviceType::TDEEventDeviceType m_eventType; TDESwitchType::TDESwitchType m_providedSwitches; TDESwitchType::TDESwitchType m_switchActive; int m_fd; - bool m_fdMonitorActive; + bool m_monitorActive; + TQTimer* m_watchTimer; TQSocketNotifier* m_eventNotifier; friend class TDEHardwareDevices; diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index 9bbaae3d5..dd46e3d1b 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -115,20 +115,9 @@ unsigned int reverse_bits(register unsigned int x) return((x >> 16) | (x << 16)); } -#define BITS_PER_LONG (sizeof(long) * 8) -#define NUM_BITS(x) ((((x) - 1) / BITS_PER_LONG) + 1) -#define OFF(x) ((x) % BITS_PER_LONG) -#define BIT(x) (1UL << OFF(x)) -#define LONG(x) ((x) / BITS_PER_LONG) -#define BIT_IS_SET(array, bit) ((array[LONG(bit)] >> OFF(bit)) & 1) - #if defined(WITH_TDEHWLIB_DAEMONS) || defined(WITH_UDISKS) || defined(WITH_UDISKS2) || defined(WITH_NETWORK_MANAGER_BACKEND) -#include <tqdbusconnection.h> -#include <tqdbusproxy.h> -#include <tqdbusmessage.h> #include <tqdbusvariant.h> #include <tqdbusdata.h> -#include <tqdbusdatalist.h> // Convenience method for tdehwlib DBUS calls // FIXME // Should probably be part of dbus-1-tqt @@ -3281,187 +3270,14 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist if (device->type() == TDEGenericDeviceType::Event) { // Try to obtain as much specific information about this event device as possible TDEEventDevice* edevice = dynamic_cast<TDEEventDevice*>(device); - int r; - unsigned long switches[NUM_BITS(EV_CNT)]; - // Figure out which switch types are supported, if any - TDESwitchType::TDESwitchType supportedSwitches = TDESwitchType::Null; - if (edevice->m_fd < 0) { + // Try to open input event device + if (edevice->m_fd < 0 && access (edevice->deviceNode().ascii(), R_OK) == 0) { edevice->m_fd = open(edevice->deviceNode().ascii(), O_RDONLY); } - r = ioctl(edevice->m_fd, EVIOCGBIT(EV_SW, EV_CNT), switches); -#ifdef WITH_TDEHWLIB_DAEMONS - if( r < 1 ) { - TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); - if (dbusConn.isConnected()) { - TQT_DBusProxy switchesProxy("org.trinitydesktop.hardwarecontrol", - "/org/trinitydesktop/hardwarecontrol", - "org.trinitydesktop.hardwarecontrol.InputEvents", - dbusConn); - if (switchesProxy.canSend()) { - TQValueList<TQT_DBusData> params; - params << TQT_DBusData::fromString(edevice->deviceNode().ascii()); - TQT_DBusMessage reply = switchesProxy.sendWithReply("GetProvidedSwitches", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { - TQValueList<TQ_UINT32> list = reply[0].toList().toUInt32List(); - TQValueList<TQ_UINT32>::const_iterator it = list.begin(); - for (r = 0; it != list.end(); ++it, r++) { - switches[r] = (*it); - } - } - } - } - } -#endif - if (r > 0) { - if (BIT_IS_SET(switches, SW_LID)) { - supportedSwitches = supportedSwitches | TDESwitchType::Lid; - } - if (BIT_IS_SET(switches, SW_TABLET_MODE)) { - supportedSwitches = supportedSwitches | TDESwitchType::TabletMode; - } - if (BIT_IS_SET(switches, SW_RFKILL_ALL)) { - supportedSwitches = supportedSwitches | TDESwitchType::RFKill; - } - if (BIT_IS_SET(switches, SW_RADIO)) { - supportedSwitches = supportedSwitches | TDESwitchType::Radio; - } - if (BIT_IS_SET(switches, SW_MICROPHONE_INSERT)) { - supportedSwitches = supportedSwitches | TDESwitchType::MicrophoneInsert; - } - if (BIT_IS_SET(switches, SW_DOCK)) { - supportedSwitches = supportedSwitches | TDESwitchType::Dock; - } - if (BIT_IS_SET(switches, SW_LINEOUT_INSERT)) { - supportedSwitches = supportedSwitches | TDESwitchType::LineOutInsert; - } - if (BIT_IS_SET(switches, SW_JACK_PHYSICAL_INSERT)) { - supportedSwitches = supportedSwitches | TDESwitchType::JackPhysicalInsert; - } - if (BIT_IS_SET(switches, SW_VIDEOOUT_INSERT)) { - supportedSwitches = supportedSwitches | TDESwitchType::VideoOutInsert; - } -# ifdef SW_CAMERA_LENS_COVER - if (BIT_IS_SET(switches, SW_CAMERA_LENS_COVER)) { - supportedSwitches = supportedSwitches | TDESwitchType::CameraLensCover; - } -# endif -# ifdef SW_KEYPAD_SLIDE - if (BIT_IS_SET(switches, SW_KEYPAD_SLIDE)) { - supportedSwitches = supportedSwitches | TDESwitchType::KeypadSlide; - } -# endif -# ifdef SW_FRONT_PROXIMITY - if (BIT_IS_SET(switches, SW_FRONT_PROXIMITY)) { - supportedSwitches = supportedSwitches | TDESwitchType::FrontProximity; - } -# endif -# ifdef SW_ROTATE_LOCK - if (BIT_IS_SET(switches, SW_ROTATE_LOCK)) { - supportedSwitches = supportedSwitches | TDESwitchType::RotateLock; - } -# endif -# ifdef SW_LINEIN_INSERT - if (BIT_IS_SET(switches, SW_LINEIN_INSERT)) { - supportedSwitches = supportedSwitches | TDESwitchType::LineInInsert; - } -# endif - // Keep in sync with ACPI Event/Input identification routines above - if (edevice->systemPath().contains("PNP0C0D")) { - supportedSwitches = supportedSwitches | TDESwitchType::Lid; - } - if (edevice->systemPath().contains("PNP0C0E") || edevice->systemPath().contains("/LNXSLPBN")) { - supportedSwitches = supportedSwitches | TDESwitchType::SleepButton; - } - if (edevice->systemPath().contains("PNP0C0C") || edevice->systemPath().contains("/LNXPWRBN")) { - supportedSwitches = supportedSwitches | TDESwitchType::PowerButton; - } - } - edevice->internalSetProvidedSwitches(supportedSwitches); - - // Figure out which switch types are active, if any - TDESwitchType::TDESwitchType activeSwitches = TDESwitchType::Null; - r = ioctl(edevice->m_fd, EVIOCGSW(sizeof(switches)), switches); -#ifdef WITH_TDEHWLIB_DAEMONS - if( r < 1 ) { - TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); - if (dbusConn.isConnected()) { - TQT_DBusProxy switchesProxy("org.trinitydesktop.hardwarecontrol", - "/org/trinitydesktop/hardwarecontrol", - "org.trinitydesktop.hardwarecontrol.InputEvents", - dbusConn); - if (switchesProxy.canSend()) { - TQValueList<TQT_DBusData> params; - params << TQT_DBusData::fromString(edevice->deviceNode().ascii()); - TQT_DBusMessage reply = switchesProxy.sendWithReply("GetActiveSwitches", params); - if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { - TQValueList<TQ_UINT32> list = reply[0].toList().toUInt32List(); - TQValueList<TQ_UINT32>::const_iterator it = list.begin(); - for (r = 0; it != list.end(); ++it, r++) { - switches[r] = (*it); - } - } - } - } - } -#endif - if (r > 0) { - if (BIT_IS_SET(switches, SW_LID)) { - activeSwitches = activeSwitches | TDESwitchType::Lid; - } - if (BIT_IS_SET(switches, SW_TABLET_MODE)) { - activeSwitches = activeSwitches | TDESwitchType::TabletMode; - } - if (BIT_IS_SET(switches, SW_RFKILL_ALL)) { - activeSwitches = activeSwitches | TDESwitchType::RFKill; - } - if (BIT_IS_SET(switches, SW_RADIO)) { - activeSwitches = activeSwitches | TDESwitchType::Radio; - } - if (BIT_IS_SET(switches, SW_MICROPHONE_INSERT)) { - activeSwitches = activeSwitches | TDESwitchType::MicrophoneInsert; - } - if (BIT_IS_SET(switches, SW_DOCK)) { - activeSwitches = activeSwitches | TDESwitchType::Dock; - } - if (BIT_IS_SET(switches, SW_LINEOUT_INSERT)) { - activeSwitches = activeSwitches | TDESwitchType::LineOutInsert; - } - if (BIT_IS_SET(switches, SW_JACK_PHYSICAL_INSERT)) { - activeSwitches = activeSwitches | TDESwitchType::JackPhysicalInsert; - } - if (BIT_IS_SET(switches, SW_VIDEOOUT_INSERT)) { - activeSwitches = activeSwitches | TDESwitchType::VideoOutInsert; - } -# ifdef SW_CAMERA_LENS_COVER - if (BIT_IS_SET(switches, SW_CAMERA_LENS_COVER)) { - activeSwitches = activeSwitches | TDESwitchType::CameraLensCover; - } -# endif -# ifdef SW_KEYPAD_SLIDE - if (BIT_IS_SET(switches, SW_KEYPAD_SLIDE)) { - activeSwitches = activeSwitches | TDESwitchType::KeypadSlide; - } -# endif -# ifdef SW_FRONT_PROXIMITY - if (BIT_IS_SET(switches, SW_FRONT_PROXIMITY)) { - activeSwitches = activeSwitches | TDESwitchType::FrontProximity; - } -# endif -# ifdef SW_ROTATE_LOCK - if (BIT_IS_SET(switches, SW_ROTATE_LOCK)) { - activeSwitches = activeSwitches | TDESwitchType::RotateLock; - } -# endif -# ifdef SW_LINEIN_INSERT - if (BIT_IS_SET(switches, SW_LINEIN_INSERT)) { - activeSwitches = activeSwitches | TDESwitchType::LineInInsert; - } -# endif - } - edevice->internalSetActiveSwitches(activeSwitches); - edevice->internalStartFdMonitoring(this); + // Start monitoring of input event device + edevice->internalStartMonitoring(this); } // Root devices are still special |