mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
xbmc: add PR4592
Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
parent
c4157fd3af
commit
e6563a8902
@ -0,0 +1,62 @@
|
||||
From 6a926768eba981c6498f852fe26dfa6644da82ac Mon Sep 17 00:00:00 2001
|
||||
From: "Chris \"Koying\" Browet" <cbro@semperpax.com>
|
||||
Date: Wed, 23 Apr 2014 16:33:19 +0200
|
||||
Subject: [PATCH] FIX: [linux] fix & optimize input device checking
|
||||
|
||||
---
|
||||
xbmc/input/linux/LinuxInputDevices.cpp | 12 +++++++++++-
|
||||
xbmc/input/linux/LinuxInputDevices.h | 1 +
|
||||
2 files changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/xbmc/input/linux/LinuxInputDevices.cpp b/xbmc/input/linux/LinuxInputDevices.cpp
|
||||
index 4b642ae..f11ec01 100644
|
||||
--- a/xbmc/input/linux/LinuxInputDevices.cpp
|
||||
+++ b/xbmc/input/linux/LinuxInputDevices.cpp
|
||||
@@ -936,6 +936,11 @@ char* CLinuxInputDevice::GetDeviceName()
|
||||
return m_deviceName;
|
||||
}
|
||||
|
||||
+std::string CLinuxInputDevice::GetFileName()
|
||||
+{
|
||||
+ return m_fileName;
|
||||
+}
|
||||
+
|
||||
bool CLinuxInputDevice::IsUnplugged()
|
||||
{
|
||||
return m_bUnplugged;
|
||||
@@ -945,6 +950,11 @@ bool CLinuxInputDevices::CheckDevice(const char *device)
|
||||
{
|
||||
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)
|
||||
@@ -1016,7 +1026,7 @@ void CLinuxInputDevices::CheckHotplugged()
|
||||
|
||||
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;
|
||||
diff --git a/xbmc/input/linux/LinuxInputDevices.h b/xbmc/input/linux/LinuxInputDevices.h
|
||||
index c385ed7..a406d9c 100644
|
||||
--- a/xbmc/input/linux/LinuxInputDevices.h
|
||||
+++ b/xbmc/input/linux/LinuxInputDevices.h
|
||||
@@ -42,6 +42,7 @@ class CLinuxInputDevice
|
||||
~CLinuxInputDevice();
|
||||
XBMC_Event ReadEvent();
|
||||
char* GetDeviceName();
|
||||
+ std::string GetFileName();
|
||||
bool IsUnplugged();
|
||||
|
||||
private:
|
||||
--
|
||||
1.9.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user