Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added: static method to convert DevicePath into 'standardised' HIDNam…

…e for Win32
  • Loading branch information...
commit 7cce1e2a97b08df7beb06872e353005ceab3299b 1 parent 942afac
@malard malard authored
View
5 xbmc/input/KeymapLoader.cpp
@@ -91,4 +91,9 @@ bool CKeymapLoader::FindMappedDevice(const CStdString& deviceId, CStdString& key
keymapName = deviceIdIt->second;
return true;
+}
+
+CStdString CKeymapLoader::ParseWin32HIDName(CStdString deviceLongName)
+{
+ return deviceLongName.Mid(deviceLongName.find_last_of('\\')+1, deviceLongName.find_last_of('#') - deviceLongName.find_last_of('\\'));
}
View
6 xbmc/input/KeymapLoader.h
@@ -22,13 +22,17 @@
#include <map>
#include "utils/StdString.h"
+#ifndef KEYMAP_LOADER
+#define KEYMAP_LOADER
class CKeymapLoader
{
public:
CKeymapLoader();
void DeviceRemoved(const CStdString& deviceID);
void DeviceAdded(const CStdString& deviceID);
+ static CStdString ParseWin32HIDName(CStdString deviceLongName);
private:
void ParseDeviceMappings();
bool FindMappedDevice(const CStdString& deviceId, CStdString& keymapName);
-};
+};
+#endif
View
5 xbmc/win32/WIN32USBScan.cpp
@@ -65,10 +65,7 @@ CWIN32USBScan::CWIN32USBScan()
detailResult = SetupDiGetDeviceInterfaceDetail(hDevHandle, &deviceInterfaceData, devicedetailData, nBufferSize , &required, NULL);
- CStdString dbcc_name(devicedetailData->DevicePath);
- dbcc_name = dbcc_name.Mid(dbcc_name.find_last_of('\\')+1, dbcc_name.find_last_of('#') - dbcc_name.find_last_of('\\'));
-
- CKeymapLoader().DeviceAdded(dbcc_name);
+ CKeymapLoader().DeviceAdded(CKeymapLoader::ParseWin32HIDName(devicedetailData->DevicePath));
if(!detailResult)
continue;
View
3  xbmc/windowing/windows/WinEventsWin32.cpp
@@ -32,6 +32,7 @@
#include "windowing/WindowingFactory.h"
#include <dbt.h>
#include "guilib/LocalizeStrings.h"
+#include "input/KeymapLoader.h"
#include "input/KeyboardStat.h"
#include "guilib/GUIWindowManager.h"
#include "guilib/GUIControl.h" // for EVENT_RESULT
@@ -653,7 +654,7 @@ LRESULT CALLBACK CWinEventsWin32::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
{
PDEV_BROADCAST_DEVICEINTERFACE b = (PDEV_BROADCAST_DEVICEINTERFACE) lParam;
CStdString dbcc_name(b->dbcc_name);
- dbcc_name = dbcc_name.Mid(dbcc_name.find_last_of('\\')+1, dbcc_name.find_last_of('#') - dbcc_name.find_last_of('\\'));
+ dbcc_name = CKeymapLoader::ParseWin32HIDName(b->dbcc_name);
switch (wParam)
{
case DBT_DEVICEARRIVAL:
Please sign in to comment.
Something went wrong with that request. Please try again.