From 374841d68b1eea4923e428c2138cd779b399abd2 Mon Sep 17 00:00:00 2001 From: Anton Fedchin Date: Tue, 3 Apr 2018 18:33:01 +0300 Subject: [win10] peripherals: move implementation to platform folder. --- cmake/treedata/windowsstore/subdirs.txt | 4 +- xbmc/peripherals/bus/PeripheralBusUSB.h | 2 +- xbmc/peripherals/bus/win10/CMakeLists.txt | 5 -- xbmc/peripherals/bus/win10/PeripheralBusUSB.cpp | 66 ---------------------- xbmc/peripherals/bus/win10/PeripheralBusUSB.h | 43 -------------- xbmc/platform/win10/peripherals/CMakeLists.txt | 5 ++ .../win10/peripherals/PeripheralBusUSB.cpp | 66 ++++++++++++++++++++++ xbmc/platform/win10/peripherals/PeripheralBusUSB.h | 43 ++++++++++++++ 8 files changed, 117 insertions(+), 117 deletions(-) delete mode 100644 xbmc/peripherals/bus/win10/CMakeLists.txt delete mode 100644 xbmc/peripherals/bus/win10/PeripheralBusUSB.cpp delete mode 100644 xbmc/peripherals/bus/win10/PeripheralBusUSB.h create mode 100644 xbmc/platform/win10/peripherals/CMakeLists.txt create mode 100644 xbmc/platform/win10/peripherals/PeripheralBusUSB.cpp create mode 100644 xbmc/platform/win10/peripherals/PeripheralBusUSB.h diff --git a/cmake/treedata/windowsstore/subdirs.txt b/cmake/treedata/windowsstore/subdirs.txt index d66845cb18..82d49b1f71 100644 --- a/cmake/treedata/windowsstore/subdirs.txt +++ b/cmake/treedata/windowsstore/subdirs.txt @@ -1,12 +1,12 @@ xbmc/platform/win10 platform/win10 xbmc/platform/win10/filesystem platform/win10/filesystem -xbmc/platform/win10/storage platfrom/win10/storage xbmc/platform/win10/network platform/win10/network +xbmc/platform/win10/peripherals platform/win10/peripherals +xbmc/platform/win10/storage platfrom/win10/storage xbmc/platform/win32/filesystem platform/win32/filesystem xbmc/input/touch input/touch xbmc/input/touch/generic input/touch/generic xbmc/network/mdns network/mdns -xbmc/peripherals/bus/win10 peripherals/bus/win10 xbmc/powermanagement/win10 powermanagement/win10 xbmc/utils/win32 utils/win32 xbmc/rendering/dx rendering/dx diff --git a/xbmc/peripherals/bus/PeripheralBusUSB.h b/xbmc/peripherals/bus/PeripheralBusUSB.h index baff025659..82bf8ee577 100644 --- a/xbmc/peripherals/bus/PeripheralBusUSB.h +++ b/xbmc/peripherals/bus/PeripheralBusUSB.h @@ -24,7 +24,7 @@ #include "win32/PeripheralBusUSB.h" #elif defined(TARGET_WINDOWS_STORE) #define HAVE_PERIPHERAL_BUS_USB 1 -#include "win10/PeripheralBusUSB.h" +#include "platform/win10/peripherals/PeripheralBusUSB.h" #elif defined(TARGET_LINUX) && defined(HAVE_LIBUDEV) #define HAVE_PERIPHERAL_BUS_USB 1 #include "linux/PeripheralBusUSBLibUdev.h" diff --git a/xbmc/peripherals/bus/win10/CMakeLists.txt b/xbmc/peripherals/bus/win10/CMakeLists.txt deleted file mode 100644 index b334acd48b..0000000000 --- a/xbmc/peripherals/bus/win10/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(SOURCES PeripheralBusUSB.cpp) - -set(HEADERS PeripheralBusUSB.h) - -core_add_library(peripherals_bus_win10) diff --git a/xbmc/peripherals/bus/win10/PeripheralBusUSB.cpp b/xbmc/peripherals/bus/win10/PeripheralBusUSB.cpp deleted file mode 100644 index 951b2d8ac1..0000000000 --- a/xbmc/peripherals/bus/win10/PeripheralBusUSB.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://kodi.tv - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#include "PeripheralBusUSB.h" -#include "peripherals/Peripherals.h" -#include "utils/log.h" -#include "utils/StringUtils.h" - -const static GUID USB_RAW_GUID = { 0xA5DCBF10, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } }; -const static GUID USB_HID_GUID = { 0x4D1E55B2, 0xF16F, 0x11CF, { 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } }; -const static GUID USB_DISK_GUID = { 0x53F56307, 0xB6BF, 0x11D0, { 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B } }; -const static GUID USB_NIC_GUID = { 0xAD498944, 0x762F, 0x11D0, { 0x8D, 0xCB, 0x00, 0xC0, 0x4F, 0xC3, 0x35, 0x8C } }; - -using namespace PERIPHERALS; - -// Only to avoid endless loops while scanning for devices -#define MAX_BUS_DEVICES 2000 - -CPeripheralBusUSB::CPeripheralBusUSB(CPeripherals &manager) : - CPeripheralBus("PeripBusUSB", manager, PERIPHERAL_BUS_USB) -{ - /* device removals aren't always triggering OnDeviceRemoved events, so poll for changes every 5 seconds to be sure we don't miss anything */ - m_iRescanTime = 5000; -} - -bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results) -{ - /* XXX we'll just scan the RAW guid and find all devices. they'll show up as type 'unknown' in the UI, - but the other option is that they're detected more than once, because RAW will return all devices. - we have to scan the RAW guid here, because not every device is found by it's GUID correctly, e.g. CDC adapters. */ - return PerformDeviceScan(&USB_RAW_GUID, PERIPHERAL_UNKNOWN, results); -} - -bool CPeripheralBusUSB::PerformDeviceScan(const GUID *guid, const PeripheralType defaultType, PeripheralScanResults &results) -{ - bool bReturn(false); - - CLog::Log(LOGDEBUG, "%s is not implemented", __FUNCTION__); - - return bReturn; -} - -bool GetProductAndVendorId(const PeripheralType type, const std::string &strDeviceLocation, int *iVendorId, int *iProductId) -{ - CLog::Log(LOGDEBUG, "%s is not implemented", __FUNCTION__); - - return false; -} - diff --git a/xbmc/peripherals/bus/win10/PeripheralBusUSB.h b/xbmc/peripherals/bus/win10/PeripheralBusUSB.h deleted file mode 100644 index b3991ee7b0..0000000000 --- a/xbmc/peripherals/bus/win10/PeripheralBusUSB.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2013 Team XBMC - * http://kodi.tv - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * . - * - */ - -#include "peripherals/bus/PeripheralBus.h" -#include //needed for GUID - -namespace PERIPHERALS -{ - class CPeripherals; - - class CPeripheralBusUSB : public CPeripheralBus - { - public: - CPeripheralBusUSB(CPeripherals &manager); - - /*! - * @see PeripheralBus::PerformDeviceScan() - */ - bool PerformDeviceScan(PeripheralScanResults &results); - - private: - bool PerformDeviceScan(const GUID *guid, const PeripheralType defaultType, PeripheralScanResults &results); - bool GetProductAndVendorId(const PeripheralType type, const std::string &strDeviceLocation, int *iVendorId, int *iProductId); - }; -} diff --git a/xbmc/platform/win10/peripherals/CMakeLists.txt b/xbmc/platform/win10/peripherals/CMakeLists.txt new file mode 100644 index 0000000000..b27b407494 --- /dev/null +++ b/xbmc/platform/win10/peripherals/CMakeLists.txt @@ -0,0 +1,5 @@ +set(SOURCES PeripheralBusUSB.cpp) + +set(HEADERS PeripheralBusUSB.h) + +core_add_library(platform_win10_peripherals) diff --git a/xbmc/platform/win10/peripherals/PeripheralBusUSB.cpp b/xbmc/platform/win10/peripherals/PeripheralBusUSB.cpp new file mode 100644 index 0000000000..951b2d8ac1 --- /dev/null +++ b/xbmc/platform/win10/peripherals/PeripheralBusUSB.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2005-2013 Team XBMC + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "PeripheralBusUSB.h" +#include "peripherals/Peripherals.h" +#include "utils/log.h" +#include "utils/StringUtils.h" + +const static GUID USB_RAW_GUID = { 0xA5DCBF10, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } }; +const static GUID USB_HID_GUID = { 0x4D1E55B2, 0xF16F, 0x11CF, { 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } }; +const static GUID USB_DISK_GUID = { 0x53F56307, 0xB6BF, 0x11D0, { 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B } }; +const static GUID USB_NIC_GUID = { 0xAD498944, 0x762F, 0x11D0, { 0x8D, 0xCB, 0x00, 0xC0, 0x4F, 0xC3, 0x35, 0x8C } }; + +using namespace PERIPHERALS; + +// Only to avoid endless loops while scanning for devices +#define MAX_BUS_DEVICES 2000 + +CPeripheralBusUSB::CPeripheralBusUSB(CPeripherals &manager) : + CPeripheralBus("PeripBusUSB", manager, PERIPHERAL_BUS_USB) +{ + /* device removals aren't always triggering OnDeviceRemoved events, so poll for changes every 5 seconds to be sure we don't miss anything */ + m_iRescanTime = 5000; +} + +bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults &results) +{ + /* XXX we'll just scan the RAW guid and find all devices. they'll show up as type 'unknown' in the UI, + but the other option is that they're detected more than once, because RAW will return all devices. + we have to scan the RAW guid here, because not every device is found by it's GUID correctly, e.g. CDC adapters. */ + return PerformDeviceScan(&USB_RAW_GUID, PERIPHERAL_UNKNOWN, results); +} + +bool CPeripheralBusUSB::PerformDeviceScan(const GUID *guid, const PeripheralType defaultType, PeripheralScanResults &results) +{ + bool bReturn(false); + + CLog::Log(LOGDEBUG, "%s is not implemented", __FUNCTION__); + + return bReturn; +} + +bool GetProductAndVendorId(const PeripheralType type, const std::string &strDeviceLocation, int *iVendorId, int *iProductId) +{ + CLog::Log(LOGDEBUG, "%s is not implemented", __FUNCTION__); + + return false; +} + diff --git a/xbmc/platform/win10/peripherals/PeripheralBusUSB.h b/xbmc/platform/win10/peripherals/PeripheralBusUSB.h new file mode 100644 index 0000000000..b3991ee7b0 --- /dev/null +++ b/xbmc/platform/win10/peripherals/PeripheralBusUSB.h @@ -0,0 +1,43 @@ +#pragma once +/* + * Copyright (C) 2005-2013 Team XBMC + * http://kodi.tv + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ + +#include "peripherals/bus/PeripheralBus.h" +#include //needed for GUID + +namespace PERIPHERALS +{ + class CPeripherals; + + class CPeripheralBusUSB : public CPeripheralBus + { + public: + CPeripheralBusUSB(CPeripherals &manager); + + /*! + * @see PeripheralBus::PerformDeviceScan() + */ + bool PerformDeviceScan(PeripheralScanResults &results); + + private: + bool PerformDeviceScan(const GUID *guid, const PeripheralType defaultType, PeripheralScanResults &results); + bool GetProductAndVendorId(const PeripheralType type, const std::string &strDeviceLocation, int *iVendorId, int *iProductId); + }; +} -- cgit v1.2.3