#include "system.h"
#if defined(HAS_LINUX_EVENTS)
+#if defined(HAS_LIBAMCODEC)
+#include "utils/AMLUtils.h"
+#endif
+
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
{
bool enable = true;
-#if defined(HAS_AMLPLAYER)
- // ignore the native aml driver named 'key_input',
- // it is the dedicated power key handler (am_key_input)
- if (strncmp(m_deviceName, "key_input", strlen("key_input")) == 0)
- return;
- // ignore the native aml driver named 'aml_keypad',
- // it is the dedicated IR remote handler (amremote)
- else if (strncmp(m_deviceName, "aml_keypad", strlen("aml_keypad")) == 0)
- return;
-
- // turn off any keyboard autorepeat, there is a kernel bug
- // where if the cpu is max'ed then key up is missed and
- // we get a flood of EV_REP that never stop until next
- // key down/up. Very nasty when seeking during video playback.
- enable = false;
+#if defined(HAS_LIBAMCODEC)
+ if (aml_present())
+ {
+ // ignore the native aml driver named 'key_input',
+ // it is the dedicated power key handler (am_key_input)
+ if (strncmp(m_deviceName, "key_input", strlen("key_input")) == 0)
+ return;
+ // ignore the native aml driver named 'aml_keypad',
+ // it is the dedicated IR remote handler (amremote)
+ else if (strncmp(m_deviceName, "aml_keypad", strlen("aml_keypad")) == 0)
+ return;
+
+ // turn off any keyboard autorepeat, there is a kernel bug
+ // where if the cpu is max'ed then key up is missed and
+ // we get a flood of EV_REP that never stop until next
+ // key down/up. Very nasty when seeking during video playback.
+ enable = false;
+ }
#endif
if (enable)
//printf("pref: %d\n", m_devicePreferredId);
}
-char* CLinuxInputDevice::GetDeviceName()
+const std::string& CLinuxInputDevice::GetFileName()
{
- return m_deviceName;
+ return m_fileName;
}
bool CLinuxInputDevice::IsUnplugged()
{
int fd;
+ // Does the device exists?
+ struct stat buffer;
+ if (stat(device, &buffer) != 0)
+ return false;
+
/* Check if we are able to open the device */
fd = open(device, O_RDWR);
if (fd < 0)
for (size_t j = 0; j < m_devices.size(); j++)
{
- if (strcmp(m_devices[j]->GetDeviceName(),buf) == 0)
+ if (m_devices[j]->GetFileName().compare(buf) == 0)
{
ispresent = true;
break;