2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "PeripheralBusUSB.h"
11 #include "peripherals/Peripherals.h"
12 #include "utils/StringUtils.h"
13 #include "utils/log.h"
15 const static GUID USB_RAW_GUID
= { 0xA5DCBF10, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } };
16 const static GUID USB_HID_GUID
= { 0x4D1E55B2, 0xF16F, 0x11CF, { 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } };
17 const static GUID USB_DISK_GUID
= { 0x53F56307, 0xB6BF, 0x11D0, { 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B } };
18 const static GUID USB_NIC_GUID
= { 0xAD498944, 0x762F, 0x11D0, { 0x8D, 0xCB, 0x00, 0xC0, 0x4F, 0xC3, 0x35, 0x8C } };
20 using namespace PERIPHERALS
;
21 using namespace std::chrono_literals
;
23 // Only to avoid endless loops while scanning for devices
24 #define MAX_BUS_DEVICES 2000
26 CPeripheralBusUSB::CPeripheralBusUSB(CPeripherals
&manager
) :
27 CPeripheralBus("PeripBusUSB", manager
, PERIPHERAL_BUS_USB
)
29 /* device removals aren't always triggering OnDeviceRemoved events, so poll for changes every 5 seconds to be sure we don't miss anything */
30 m_iRescanTime
= 5000ms
;
33 bool CPeripheralBusUSB::PerformDeviceScan(PeripheralScanResults
&results
)
35 /* XXX we'll just scan the RAW guid and find all devices. they'll show up as type 'unknown' in the UI,
36 but the other option is that they're detected more than once, because RAW will return all devices.
37 we have to scan the RAW guid here, because not every device is found by it's GUID correctly, e.g. CDC adapters. */
38 return PerformDeviceScan(&USB_RAW_GUID
, PERIPHERAL_UNKNOWN
, results
);
41 bool CPeripheralBusUSB::PerformDeviceScan(const GUID
*guid
, const PeripheralType defaultType
, PeripheralScanResults
&results
)
45 CLog::Log(LOGDEBUG
, "{} is not implemented", __FUNCTION__
);
50 bool GetProductAndVendorId(const PeripheralType type
, const std::string
&strDeviceLocation
, int *iVendorId
, int *iProductId
)
52 CLog::Log(LOGDEBUG
, "{} is not implemented", __FUNCTION__
);