void CPeripherals::CreatePeripheral(CPeripheralBus &bus, const PeripheralScanResult& result) { PeripheralPtr peripheral; PeripheralScanResult mappedResult = result; if (mappedResult.m_busType == PERIPHERAL_BUS_UNKNOWN) mappedResult.m_busType = bus.Type(); /* check whether there's something mapped in peripherals.xml */ GetMappingForDevice(bus, mappedResult); switch(mappedResult.m_mappedType) { case PERIPHERAL_HID: peripheral = PeripheralPtr(new CPeripheralHID(mappedResult, &bus)); break; case PERIPHERAL_NIC: peripheral = PeripheralPtr(new CPeripheralNIC(mappedResult, &bus)); break; case PERIPHERAL_DISK: peripheral = PeripheralPtr(new CPeripheralDisk(mappedResult, &bus)); break; case PERIPHERAL_NYXBOARD: peripheral = PeripheralPtr(new CPeripheralNyxboard(mappedResult, &bus)); break; case PERIPHERAL_TUNER: peripheral = PeripheralPtr(new CPeripheralTuner(mappedResult, &bus)); break; case PERIPHERAL_BLUETOOTH: peripheral = PeripheralPtr(new CPeripheralBluetooth(mappedResult, &bus)); break; case PERIPHERAL_CEC: #if defined(HAVE_LIBCEC) if (bus.Type() == PERIPHERAL_BUS_CEC) peripheral = PeripheralPtr(new CPeripheralCecAdapter(mappedResult, &bus)); #else if (!m_bMissingLibCecWarningDisplayed) { m_bMissingLibCecWarningDisplayed = true; CLog::Log(LOGWARNING, "%s - libCEC support has not been compiled in, so the CEC adapter cannot be used.", __FUNCTION__); CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Warning, g_localizeStrings.Get(36000), g_localizeStrings.Get(36017)); } #endif break; case PERIPHERAL_IMON: peripheral = PeripheralPtr(new CPeripheralImon(mappedResult, &bus)); break; case PERIPHERAL_JOYSTICK: peripheral = PeripheralPtr(new CPeripheralJoystick(mappedResult, &bus)); break; default: break; } if (peripheral) { /* try to initialise the new peripheral * Initialise() will make sure that each device is only initialised once */ if (peripheral->Initialise()) bus.Register(peripheral); else { CLog::Log(LOGDEBUG, "%s - failed to initialise peripheral on '%s'", __FUNCTION__, mappedResult.m_strLocation.c_str()); } } }