diff --git a/ChangeLog b/ChangeLog
index cd87d08130..115e5fd92f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1382,3 +1382,6 @@ openvix: developer 6.6.011.006
openvix: developer 6.6.011.007
openvix: developer 6.6.012.001
openvix: developer 6.6.012.002
+openvix: developer 6.6.013.001
+openvix: developer 6.6.013.002
+openvix: developer 6.6.013.003
diff --git a/data/setup.xml b/data/setup.xml
index 5beb5added..7b34260c93 100644
--- a/data/setup.xml
+++ b/data/setup.xml
@@ -28,6 +28,7 @@
- config.misc.usegstplaybin3
- config.misc.RCSource
- config.skin.pixmap_force_alphablending
+ - config.usage.picon_lookup_priority
- config.misc.softcam_streamrelay_url
diff --git a/dm9x0.patch b/dm9x0.patch
deleted file mode 100644
index ab2107b90a..0000000000
--- a/dm9x0.patch
+++ /dev/null
@@ -1,1817 +0,0 @@
-diff --git a/.github/workflows/buildbot.yml b/.github/workflows/buildbot.yml
-index 0db1c7f0853..e46e714b074 100644
---- a/.github/workflows/buildbot.yml
-+++ b/.github/workflows/buildbot.yml
-@@ -2,7 +2,7 @@ name: buildbot
-
- on:
- push:
-- branches: [ Developer ]
-+ branches: [ Developer, dm9x0 ]
-
- workflow_dispatch:
-
-diff --git a/.github/workflows/enigma2.yml b/.github/workflows/enigma2.yml
-index c681dd91b34..c955896a3ff 100644
---- a/.github/workflows/enigma2.yml
-+++ b/.github/workflows/enigma2.yml
-@@ -2,12 +2,12 @@ name: Enigma2 Python 3
-
- on:
- push:
-- branches: [ Release, Developer, FCC ]
-+ branches: [ Release, Developer, FCC, dm9x0 ]
- paths-ignore:
- - '**/README'
- - '**/DOCS'
- pull_request:
-- branches: [Release, Developer, FCC ]
-+ branches: [Release, Developer, FCC, dm9x0 ]
- paths-ignore:
- - '**/README'
- - '**/DOCS'
-diff --git a/CI/build.sh b/CI/build.sh
-index e340647b4e3..f58eeae85cd 100755
---- a/CI/build.sh
-+++ b/CI/build.sh
-@@ -13,7 +13,7 @@ commit_files() {
- rm -rf *.pyc
- rm -rf *.pyo
- rm -rf *.mo
-- git checkout Developer
-+ git checkout dm9x0
- ./CI/chmod.sh
- ./CI/dos2unix.sh
- ./CI/PEP8.sh
-@@ -21,7 +21,7 @@ commit_files() {
-
- upload_files() {
- git remote add upstream https://${GITHUB_TOKEN}@github.com/OpenViX/enigma2.git > /dev/null 2>&1
-- git push --quiet upstream Developer || echo "failed to push with error $?"
-+ git push --quiet upstream dm9x0 || echo "failed to push with error $?"
- }
-
- setup_git
-diff --git a/configure.ac b/configure.ac
-index 094c1ff5691..05988050c51 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -91,6 +91,8 @@ AM_CONDITIONAL(DM800, test "$BOXTYPE" == "dm800")
- AM_CONDITIONAL(DM8000, test "$BOXTYPE" == "dm8000")
- AM_CONDITIONAL(DM800SE, test "$BOXTYPE" == "dm800se")
- AM_CONDITIONAL(DM800SEV2, test "$BOXTYPE" == "dm800sev2")
-+AM_CONDITIONAL(DM900, test "$BOXTYPE" == "dm900")
-+AM_CONDITIONAL(DM920, test "$BOXTYPE" == "dm920")
- AM_CONDITIONAL(E3HD, test "$BOXTYPE" == "e3hd")
- AM_CONDITIONAL(EBOX5000, test "$BOXTYPE" == "ebox5000")
- AM_CONDITIONAL(EBOX5100, test "$BOXTYPE" == "ebox5100")
-@@ -306,6 +308,17 @@ if test x"$withcolorlcd220" != xno ; then
- fi
- AM_CONDITIONAL(HAVE_COLORLCD220, test x"$withcolorlcd220" != xno)
-
-+AC_ARG_WITH(colorlcd390,
-+ AS_HELP_STRING([--with-colorlcd390], [use 390x240 16bpp color display, yes or no]),
-+ [[withcolorlcd390=$withval]],
-+ [[withcolorlcd390=no]]
-+)
-+if test x"$withcolorlcd390" != xno ; then
-+ AC_DEFINE(HAVE_COLORLCD390, 1,[Define when using a 390x240 color display device])
-+fi
-+
-+AM_CONDITIONAL(HAVE_COLORLCD390, test x"$withcolorlcd390" != xno)
-+
- AC_ARG_WITH(colorlcd400,
- AS_HELP_STRING([--with-colorlcd400], [use 400x176 16bpp color display, yes or no]),
- [[withcolorlcd400=$withval]],
-@@ -402,6 +415,14 @@ if test `echo "$BOXTYPE" | cut -b 1-2` == "vu"; then
- AC_DEFINE(FORCE_ADVANCED_REMOTE, 1,[define to fixup the input device identification when the remote control is actually an 'advanced' remote (with play/forward/rewind keys)])
- fi
-
-+if test "$BOXTYPE" == "dm900" -o "$BOXTYPE" == "dm920"; then
-+ AC_DEFINE(CONFIG_ION, 1,[define BOX use ION Allocator])
-+ AC_DEFINE(HAVE_HDMIIN_DM, 1,[has hdmi in dm])
-+ AC_DEFINE(LCD_DM900_Y_OFFSET, 4,[define LCD Y offset for dm900 and dm920])
-+ AC_DEFINE(DREAMBOX_DUAL_TUNER, 1,[define it is dreambox dual tuner present])
-+ AC_DEFINE(FORCE_NO_BLENDING_ACCELERATION, 1,[define when the framebuffer acceleration does not have alphablending support, though the autodetection might indicate that it does])
-+fi
-+
- if test `echo "$BOXTYPE" | cut -b 1-2` == "gb"; then
- AC_DEFINE(KEY_PLAY_ACTUALLY_IS_KEY_PLAYPAUSE, 1,[define when rc sends a KEY_PLAY event for its KEY_PLAYPAUSE key])
- AC_DEFINE(FORCE_NO_BLENDING_ACCELERATION, 1,[define when the framebuffer acceleration does not have alphablending support, though the autodetection might indicate that it does])
-@@ -586,6 +607,7 @@ data/7segment/Makefile
- data/display96/Makefile
- data/display128/Makefile
- data/display220/Makefile
-+data/display390/Makefile
- data/display400/Makefile
- data/display480/Makefile
- data/display720/Makefile
-diff --git a/data/Makefile.am b/data/Makefile.am
-index 72c31ec8d3a..123c4f64f6e 100644
---- a/data/Makefile.am
-+++ b/data/Makefile.am
-@@ -41,6 +41,10 @@ if HAVE_COLORLCD220
- SUBDIRS += display220
- endif
-
-+if HAVE_COLORLCD390
-+SUBDIRS += display390
-+endif
-+
- if HAVE_COLORLCD400
- SUBDIRS += display400
- endif
-diff --git a/data/display400/skin_display.xml b/data/display400/skin_display.xml
-index 55d0d8a26e7..6d45e70db6f 100644
---- a/data/display400/skin_display.xml
-+++ b/data/display400/skin_display.xml
-@@ -238,24 +238,13 @@
-
-
-
--
-- FullDate
-+
-+ ShortDate
-
--
-+
- Format:%H:%M
-
--
--
--
--
--
--
--
--
--
--
-
--
-
-
-
-diff --git a/interfaces/ion.h b/interfaces/ion.h
-new file mode 100644
-index 00000000000..6370495f8d0
---- /dev/null
-+++ b/interfaces/ion.h
-@@ -0,0 +1,204 @@
-+/*
-+ * drivers/staging/android/uapi/ion.h
-+ *
-+ * Copyright (C) 2011 Google, Inc.
-+ *
-+ * This software is licensed under the terms of the GNU General Public
-+ * License version 2, as published by the Free Software Foundation, and
-+ * may be copied, distributed, and modified under those terms.
-+ *
-+ * 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.
-+ *
-+ */
-+
-+#ifndef _UAPI_LINUX_ION_H
-+#define _UAPI_LINUX_ION_H
-+
-+#include
-+#include
-+
-+typedef int ion_user_handle_t;
-+
-+/**
-+ * enum ion_heap_types - list of all possible types of heaps
-+ * @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc
-+ * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
-+ * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
-+ * carveout heap, allocations are physically
-+ * contiguous
-+ * @ION_HEAP_TYPE_DMA: memory allocated via DMA API
-+ * @ION_NUM_HEAPS: helper for iterating over heaps, a bit mask
-+ * is used to identify the heaps, so only 32
-+ * total heap types are supported
-+ */
-+enum ion_heap_type {
-+ ION_HEAP_TYPE_SYSTEM,
-+ ION_HEAP_TYPE_SYSTEM_CONTIG,
-+ ION_HEAP_TYPE_CARVEOUT,
-+ ION_HEAP_TYPE_CHUNK,
-+ ION_HEAP_TYPE_DMA,
-+ ION_HEAP_TYPE_CUSTOM, /* must be last so device specific heaps always
-+ are at the end of this enum */
-+ ION_NUM_HEAPS = 16,
-+};
-+
-+#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
-+#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
-+#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
-+#define ION_HEAP_TYPE_DMA_MASK (1 << ION_HEAP_TYPE_DMA)
-+
-+#define ION_NUM_HEAP_IDS sizeof(unsigned int) * 8
-+
-+/**
-+ * allocation flags - the lower 16 bits are used by core ion, the upper 16
-+ * bits are reserved for use by the heaps themselves.
-+ */
-+#define ION_FLAG_CACHED 1 /* mappings of this buffer should be
-+ cached, ion will do cache
-+ maintenance when the buffer is
-+ mapped for dma */
-+#define ION_FLAG_CACHED_NEEDS_SYNC 2 /* mappings of this buffer will created
-+ at mmap time, if this is set
-+ caches must be managed manually */
-+
-+/**
-+ * DOC: Ion Userspace API
-+ *
-+ * create a client by opening /dev/ion
-+ * most operations handled via following ioctls
-+ *
-+ */
-+
-+/**
-+ * struct ion_allocation_data - metadata passed from userspace for allocations
-+ * @len: size of the allocation
-+ * @align: required alignment of the allocation
-+ * @heap_id_mask: mask of heap ids to allocate from
-+ * @flags: flags passed to heap
-+ * @handle: pointer that will be populated with a cookie to use to
-+ * refer to this allocation
-+ *
-+ * Provided by userspace as an argument to the ioctl
-+ */
-+struct ion_allocation_data {
-+ size_t len;
-+ size_t align;
-+ unsigned int heap_id_mask;
-+ unsigned int flags;
-+ ion_user_handle_t handle;
-+};
-+
-+/**
-+ * struct ion_fd_data - metadata passed to/from userspace for a handle/fd pair
-+ * @handle: a handle
-+ * @fd: a file descriptor representing that handle
-+ *
-+ * For ION_IOC_SHARE or ION_IOC_MAP userspace populates the handle field with
-+ * the handle returned from ion alloc, and the kernel returns the file
-+ * descriptor to share or map in the fd field. For ION_IOC_IMPORT, userspace
-+ * provides the file descriptor and the kernel returns the handle.
-+ */
-+struct ion_fd_data {
-+ ion_user_handle_t handle;
-+ int fd;
-+};
-+
-+/**
-+ * struct ion_handle_data - a handle passed to/from the kernel
-+ * @handle: a handle
-+ */
-+struct ion_handle_data {
-+ ion_user_handle_t handle;
-+};
-+
-+/**
-+ * struct ion_custom_data - metadata passed to/from userspace for a custom ioctl
-+ * @cmd: the custom ioctl function to call
-+ * @arg: additional data to pass to the custom ioctl, typically a user
-+ * pointer to a predefined structure
-+ *
-+ * This works just like the regular cmd and arg fields of an ioctl.
-+ */
-+struct ion_custom_data {
-+ unsigned int cmd;
-+ unsigned long arg;
-+};
-+
-+struct ion_phys_data {
-+ ion_user_handle_t handle;
-+ unsigned long addr;
-+ size_t len;
-+};
-+
-+#define ION_IOC_MAGIC 'I'
-+
-+/**
-+ * DOC: ION_IOC_ALLOC - allocate memory
-+ *
-+ * Takes an ion_allocation_data struct and returns it with the handle field
-+ * populated with the opaque handle for the allocation.
-+ */
-+#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \
-+ struct ion_allocation_data)
-+
-+/**
-+ * DOC: ION_IOC_FREE - free memory
-+ *
-+ * Takes an ion_handle_data struct and frees the handle.
-+ */
-+#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
-+
-+/**
-+ * DOC: ION_IOC_MAP - get a file descriptor to mmap
-+ *
-+ * Takes an ion_fd_data struct with the handle field populated with a valid
-+ * opaque handle. Returns the struct with the fd field set to a file
-+ * descriptor open in the current address space. This file descriptor
-+ * can then be used as an argument to mmap.
-+ */
-+#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
-+
-+/**
-+ * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation
-+ *
-+ * Takes an ion_fd_data struct with the handle field populated with a valid
-+ * opaque handle. Returns the struct with the fd field set to a file
-+ * descriptor open in the current address space. This file descriptor
-+ * can then be passed to another process. The corresponding opaque handle can
-+ * be retrieved via ION_IOC_IMPORT.
-+ */
-+#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
-+
-+/**
-+ * DOC: ION_IOC_IMPORT - imports a shared file descriptor
-+ *
-+ * Takes an ion_fd_data struct with the fd field populated with a valid file
-+ * descriptor obtained from ION_IOC_SHARE and returns the struct with the handle
-+ * filed set to the corresponding opaque handle.
-+ */
-+#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data)
-+
-+/**
-+ * DOC: ION_IOC_SYNC - syncs a shared file descriptors to memory
-+ *
-+ * Deprecated in favor of using the dma_buf api's correctly (syncing
-+ * will happend automatically when the buffer is mapped to a device).
-+ * If necessary should be used after touching a cached buffer from the cpu,
-+ * this will make the buffer in memory coherent.
-+ */
-+#define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data)
-+
-+/**
-+ * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
-+ *
-+ * Takes the argument of the architecture specific ioctl to call and
-+ * passes appropriate userdata for that ioctl
-+ */
-+#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
-+
-+#define ION_IOC_PHYS _IOWR(ION_IOC_MAGIC, 8, struct ion_phys_data)
-+
-+#endif /* _UAPI_LINUX_ION_H */
-diff --git a/lib/driver/avswitch.cpp b/lib/driver/avswitch.cpp
-index 955c6c59fd7..7d601b56f40 100644
---- a/lib/driver/avswitch.cpp
-+++ b/lib/driver/avswitch.cpp
-@@ -255,7 +255,12 @@ int eAVSwitch::getResolutionY(int defaultVal, int flags) const
- int eAVSwitch::getFrameRate(int defaultVal, int flags) const
- {
-
-+#ifdef DREAMBOX
-+ const char *fileName = "/proc/stb/vmpeg/0/fallback_framerate";
-+#else
- const char *fileName = "/proc/stb/vmpeg/0/framerate";
-+#endif
-+
- int value = 0;
- int ret = CFile::parseInt(&value, fileName, __MODULE__, flags);
- if (ret != 0)
-diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp
-index 95f5609dd9c..4fb21ec1667 100644
---- a/lib/dvb/decoder.cpp
-+++ b/lib/dvb/decoder.cpp
-@@ -147,7 +147,11 @@ int eDVBAudio::startPid(int pid, int type)
- bypass = 0x40;
- break;
- case aDDP:
-+#ifdef DREAMBOX
-+ bypass = 7;
-+#else
- bypass = 0x22;
-+#endif
- break;
- }
-
-@@ -341,7 +345,11 @@ eDVBVideo::eDVBVideo(eDVBDemux *demux, int dev, bool fcc_enable)
- #define VIDEO_STREAMTYPE_MPEG4_Part2 4
- #define VIDEO_STREAMTYPE_VC1_SM 5
- #define VIDEO_STREAMTYPE_MPEG1 6
-+#ifdef DREAMBOX
-+#define VIDEO_STREAMTYPE_H265_HEVC 22
-+#else
- #define VIDEO_STREAMTYPE_H265_HEVC 7
-+#endif
- #define VIDEO_STREAMTYPE_AVS 16
- #define VIDEO_STREAMTYPE_AVS2 40
-
-diff --git a/lib/dvb/fbc.cpp b/lib/dvb/fbc.cpp
-index 6d8b06d3cc2..56a4c4f98d3 100644
---- a/lib/dvb/fbc.cpp
-+++ b/lib/dvb/fbc.cpp
-@@ -13,6 +13,24 @@
-
- int eFBCTunerManager::ReadProcInt(int fe_index, const std::string & entry)
- {
-+#ifdef DREAMBOX
-+ std::string value;
-+ std::stringstream path;
-+ std::ifstream file;
-+
-+ path << "/proc/stb/frontend/" << fe_index << "/" << entry;
-+ file.open(path.str().c_str());
-+
-+ if(!file.is_open())
-+ return(-1);
-+
-+ file >> value;
-+
-+ if(file.bad() || file.fail())
-+ return(-1);
-+ eDebug("[eFBCTunerManager::ReadProcInt] val: %s", value.c_str());
-+ return(value == "A" ? 0 : 1);
-+#else
- int value;
- std::stringstream path;
- std::ifstream file;
-@@ -29,6 +47,7 @@ int eFBCTunerManager::ReadProcInt(int fe_index, const std::string & entry)
- return(-1);
-
- return(value);
-+#endif
- }
-
- void eFBCTunerManager::WriteProcInt(int fe_index, const std::string & entry, int value)
-@@ -45,6 +64,41 @@ void eFBCTunerManager::WriteProcInt(int fe_index, const std::string & entry, int
- file << value;
- }
-
-+void eFBCTunerManager::WriteProcStr(int fe_index, const std::string & entry, int value)
-+{
-+ std::stringstream path;
-+ std::ofstream file;
-+
-+ path << "/proc/stb/frontend/" << fe_index << "/" << entry;
-+ file.open(path.str().c_str());
-+
-+ if(!file.is_open())
-+ return;
-+ eDebug("[eFBCTunerManager::WriteProcStr] val: %d", value);
-+ file << (value == 0 ? "A" : "B");
-+}
-+
-+#ifdef DREAMBOX
-+void eFBCTunerManager::LoadConnectChoices(int fe_index, std::string &choices)
-+{
-+ std::stringstream path;
-+ std::ifstream file;
-+ std::string line;
-+ std::string::const_iterator it;
-+ int fbc_id;
-+
-+ path << "/proc/stb/frontend/" << fe_index << "/input_choices";
-+ file.open(path.str().c_str());
-+
-+ if(!file.is_open())
-+ return;
-+
-+ file >> choices;
-+
-+ if(file.bad() || file.fail())
-+ return;
-+}
-+#else
- void eFBCTunerManager::LoadConnectChoices(int fe_index, connect_choices_t &choices)
- {
- std::stringstream path;
-@@ -77,6 +131,7 @@ void eFBCTunerManager::LoadConnectChoices(int fe_index, connect_choices_t &choic
- }
- }
- }
-+#endif
-
- DEFINE_REF(eFBCTunerManager);
-
-@@ -93,7 +148,7 @@ eFBCTunerManager::eFBCTunerManager(ePtr res_mgr)
- eSmartPtrList &frontends = m_res_mgr->m_frontend;
- eSmartPtrList &frontends_simulate = m_res_mgr->m_simulate_frontend;
- tuner_t tuner;
-- int fe_id, fbc_prev_set_id;
-+ int fe_id, fbc_prev_set_id;
-
- if(!m_instance)
- m_instance = this;
-@@ -109,22 +164,34 @@ eFBCTunerManager::eFBCTunerManager(ePtr res_mgr)
- continue; // ignore DVB-C/T FBC tuners because they need no special treatment
-
- fe_id = FESlotID(it);
-- tuner.set_id = ReadProcInt(fe_id, "fbc_set_id");
-
-+#ifdef DREAMBOX
-+ tuner.set_id = ReadProcInt(fe_id, "input");
-+#else
-+ tuner.set_id = ReadProcInt(fe_id, "fbc_set_id");
-+#endif
- if(tuner.set_id >= 0)
- {
- if(fbc_prev_set_id != tuner.set_id)
- {
- fbc_prev_set_id = tuner.set_id;
-+#ifdef DREAMBOX
-+ LoadConnectChoices(fe_id, tuner.input_choices);
-+#else
- LoadConnectChoices(fe_id, tuner.connect_choices);
-+#endif
- tuner.id = 0;
- }
--
-+#ifdef DREAMBOX
-+ tuner.is_root = tuner.id < 2;
-+#else
- if(tuner.id < (int)tuner.connect_choices.size())
- tuner.is_root = tuner.connect_choices.test(tuner.id);
- else
- tuner.is_root = false;
-
-+#endif
-+
- tuner.default_id = tuner.is_root ? tuner.id : 0;
- m_tuners[fe_id] = tuner;
- SetProcFBCID(fe_id, tuner.default_id, false);
-@@ -141,8 +208,14 @@ eFBCTunerManager::eFBCTunerManager(ePtr res_mgr)
- if (!(it->m_frontend->supportsDeliverySystem(SYS_DVBS, false) || it->m_frontend->supportsDeliverySystem(SYS_DVBS2, false)))
- continue;
-
-+#ifdef DREAMBOX
-+ if(ReadProcInt(FESlotID(it), "input") >= 0)
-+ it->m_frontend->set_FBCTuner(true);
-+#else
- if(ReadProcInt(FESlotID(it), "fbc_set_id") >= 0)
- it->m_frontend->set_FBCTuner(true);
-+#endif
-+
- }
- }
-
-@@ -154,8 +227,12 @@ eFBCTunerManager::~eFBCTunerManager()
-
- void eFBCTunerManager::SetProcFBCID(int fe_id, int fbc_connect, bool fbc_is_linked)
- {
-+#ifdef DREAMBOX
-+ WriteProcStr(fe_id, "input", fbc_connect);
-+#else
- WriteProcInt(fe_id, "fbc_connect", fbc_connect);
- WriteProcInt(fe_id, "fbc_link", fbc_is_linked ? 1 : 0);
-+#endif
- }
-
- int eFBCTunerManager::FESlotID(eDVBRegisteredFrontend *fe)
-@@ -412,7 +489,7 @@ int eFBCTunerManager::IsCompatibleWith(ePtr &feparm, eDV
-
- if(IsSCR(*it))
- continue;
--
-+
- // temporarily add this leaf to the current "linked" chain, at the tail
-
- fe_insert_point = GetTail(*it);
-diff --git a/lib/dvb/fbc.h b/lib/dvb/fbc.h
-index a479961086a..b70f9b7dfc9 100644
---- a/lib/dvb/fbc.h
-+++ b/lib/dvb/fbc.h
-@@ -25,6 +25,7 @@ private:
- int id;
- int default_id;
- connect_choices_t connect_choices;
-+ std::string input_choices;
- } tuner_t;
-
- typedef std::map tuners_t;
-@@ -42,7 +43,12 @@ private:
-
- static int ReadProcInt(int, const std::string &);
- static void WriteProcInt(int, const std::string &, int);
-+ static void WriteProcStr(int, const std::string &, int);
-+#ifdef DREAMBOX
-+ static void LoadConnectChoices(int, std::string &);
-+#else
- static void LoadConnectChoices(int, connect_choices_t &);
-+#endif
- static void SetProcFBCID(int, int, bool);
- static int FESlotID(eDVBRegisteredFrontend *);
- static bool IsLinked(eDVBRegisteredFrontend *);
-diff --git a/lib/dvb_ci/dvbci.cpp b/lib/dvb_ci/dvbci.cpp
-index a4681b1ff39..a744ae6a70b 100644
---- a/lib/dvb_ci/dvbci.cpp
-+++ b/lib/dvb_ci/dvbci.cpp
-@@ -6,6 +6,7 @@
- #include
- #include
- #include
-+#include
-
- #include
- #include
-@@ -33,6 +34,78 @@ eDVBCIInterfaces *eDVBCIInterfaces::instance = 0;
- pthread_mutex_t eDVBCIInterfaces::m_pmt_handler_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
- pthread_mutex_t eDVBCIInterfaces::m_slot_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-
-+static char* readInputCI(int NimNumber)
-+{
-+ char id1[] = "NIM Socket";
-+ char id2[] = "Input_Name";
-+ char keys1[] = "1234567890";
-+ char keys2[] = "12ABCDabcd";
-+ char *inputName = 0;
-+ char buf[256];
-+ FILE *f;
-+
-+ f = fopen("/proc/bus/nim_sockets", "rt");
-+ if (f)
-+ {
-+ while (fgets(buf, sizeof(buf), f))
-+ {
-+ char *p = strcasestr(buf, id1);
-+ if (!p)
-+ continue;
-+
-+ p += strlen(id1);
-+ p += strcspn(p, keys1);
-+ if (*p && strtol(p, 0, 0) == NimNumber)
-+ break;
-+ }
-+
-+ while (fgets(buf, sizeof(buf), f))
-+ {
-+ if (strcasestr(buf, id1))
-+ break;
-+
-+ char *p = strcasestr(buf, id2);
-+ if (!p)
-+ continue;
-+
-+ p = strchr(p + strlen(id2), ':');
-+ if (!p)
-+ continue;
-+
-+ p++;
-+ p += strcspn(p, keys2);
-+ size_t len = strspn(p, keys2);
-+ if (len > 0)
-+ {
-+ inputName = strndup(p, len);
-+ break;
-+ }
-+ }
-+
-+ fclose(f);
-+ }
-+
-+ return inputName;
-+}
-+
-+static std::string getTunerLetterDM(int NimNumber)
-+{
-+ char *srcCI = readInputCI(NimNumber);
-+ if (srcCI) {
-+ std::string ret = std::string(srcCI);
-+ free(srcCI);
-+ if (ret.size() == 1){
-+ int corr = 1;
-+ if (NimNumber > 7) {
-+ corr = -7;
-+ }
-+ return ret + std::to_string(NimNumber + corr);
-+ }
-+ return ret;
-+ }
-+ return eDVBCISlot::getTunerLetter(NimNumber);
-+}
-+
- eDVBCIInterfaces::eDVBCIInterfaces()
- : m_messagepump_thread(this,1, "dvbci"), m_messagepump_main(eApp,1, "dvbci"), m_runTimer(eTimer::create(this))
- {
-@@ -69,7 +142,11 @@ eDVBCIInterfaces::eDVBCIInterfaces()
- }
-
- for (eSmartPtrList::iterator it(m_slots.begin()); it != m_slots.end(); ++it)
-+#ifdef DREAMBOX_DUAL_TUNER
-+ it->setSource(getTunerLetterDM(0));
-+#else
- it->setSource("A");
-+#endif
-
- for (int tuner_no = 0; tuner_no < 26; ++tuner_no) // NOTE: this assumes tuners are A .. Z max.
- {
-@@ -80,7 +157,11 @@ eDVBCIInterfaces::eDVBCIInterfaces()
- if(::access(path.str().c_str(), R_OK) < 0)
- break;
-
-+#ifdef DREAMBOX_DUAL_TUNER
-+ setInputSource(tuner_no, getTunerLetterDM(tuner_no));
-+#else
- setInputSource(tuner_no, eDVBCISlot::getTunerLetter(tuner_no));
-+#endif
- }
-
- eDebug("[CI] done, found %d common interface slots", num_ci);
-@@ -310,7 +391,11 @@ void eDVBCIInterfaces::ciRemoved(eDVBCISlot *slot)
- if (slot->linked_next)
- slot->linked_next->setSource(slot->current_source);
- else // last CI in chain
-+#ifdef DREAMBOX_DUAL_TUNER
-+ setInputSource(slot->current_tuner, getTunerLetterDM(slot->current_tuner));
-+#else
- setInputSource(slot->current_tuner, eDVBCISlot::getTunerLetter(slot->current_tuner));
-+#endif
- slot->linked_next = 0;
- slot->use_count=0;
- slot->plugged=true;
-@@ -581,7 +666,11 @@ void eDVBCIInterfaces::recheckPMTHandlers()
- if (tunernum != -1)
- {
- setInputSource(tunernum, ci_source.str());
-+#ifdef DREAMBOX_DUAL_TUNER
-+ ci_it->setSource(getTunerLetterDM(tunernum));
-+#else
- ci_it->setSource(eDVBCISlot::getTunerLetter(tunernum));
-+#endif
- }
- else
- {
-@@ -711,7 +800,11 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler)
- {
- case finish_use_tuner_a:
- {
-+#ifdef DREAMBOX_DUAL_TUNER
-+ finish_source = getTunerLetterDM(0);
-+#else
- finish_source = "A";
-+#endif
- break;
- }
-
-@@ -734,7 +827,11 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler)
- if(finish_source == "")
- {
- eDebug("[CI] warning: CI streaming finish mode not set, assuming \"tuner A\"");
-+#ifdef DREAMBOX_DUAL_TUNER
-+ finish_source = getTunerLetterDM(0);
-+#else
- finish_source = "A";
-+#endif
- }
-
- slot->setSource(finish_source);
-@@ -746,7 +843,11 @@ void eDVBCIInterfaces::removePMTHandler(eDVBServicePMTHandler *pmthandler)
- if (slot->linked_next)
- slot->linked_next->setSource(slot->current_source);
- else
-+#ifdef DREAMBOX_DUAL_TUNER
-+ setInputSource(slot->current_tuner, getTunerLetterDM(slot->current_tuner));
-+#else
- setInputSource(slot->current_tuner, eDVBCISlot::getTunerLetter(slot->current_tuner));
-+#endif
-
- if (base_slot != slot)
- {
-@@ -1134,7 +1235,11 @@ void eDVBCIInterfaces::setCIPlusRouting(int slotid)
- new_input_source << "CI" << slot->getSlotID();
-
- setInputSource(tunernum, new_input_source.str());
-+#ifdef DREAMBOX_DUAL_TUNER
-+ slot->setSource(getTunerLetterDM(tunernum));
-+#else
- slot->setSource(eDVBCISlot::getTunerLetter(tunernum));
-+#endif
-
- slot->setCIPlusRoutingParameter(tunernum, ciplus_routing_input, ciplus_routing_ci_input);
- eDebug("[CI] CIRouting active slotid=%d tuner=%d old_input=%s old_ci_input=%s", slotid, tunernum, ciplus_routing_input.c_str(), ciplus_routing_ci_input.c_str());
-diff --git a/lib/dvb_ci/dvbci.h b/lib/dvb_ci/dvbci.h
-index 511944b9770..5d11f624b45 100644
---- a/lib/dvb_ci/dvbci.h
-+++ b/lib/dvb_ci/dvbci.h
-@@ -110,8 +110,8 @@ class eDVBCISlot: public iObject, public sigc::trackable
- int setClockRate(const std::string &rate);
- void determineCIVersion();
- int setEnabled(bool);
-- static std::string getTunerLetter(int tuner_no) { return std::string(1, char(65 + tuner_no)); }
- public:
-+ static std::string getTunerLetter(int tuner_no) { return std::string(1, char(65 + tuner_no)); }
- enum {stateRemoved, stateInserted, stateInvalid, stateResetted, stateDisabled};
- enum {versionUnknown = -1, versionCI = 0, versionCIPlus1 = 1, versionCIPlus2 = 2};
- eDVBCISlot(eMainloop *context, int nr);
-diff --git a/lib/gdi/epng.cpp b/lib/gdi/epng.cpp
-index 449ccc9c14e..8745975b723 100644
---- a/lib/gdi/epng.cpp
-+++ b/lib/gdi/epng.cpp
-@@ -3,10 +3,15 @@
- #include
- #include
- #include
--#include
-+#include
- #include
- #include
- #include
-+#include
-+
-+#include