From cb5ab71294f8544719579813b28aeaf1bf57435b Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 17 Feb 2017 11:09:53 +0100 Subject: [PATCH 01/25] src/driver/scanepg.cpp avoid possible segfault Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4bfe34bf5dbaa005db9cf2b7c82bbd5942f486f7 Author: Jacek Jendrzej Date: 2017-02-17 (Fri, 17 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/scanepg.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/scanepg.cpp b/src/driver/scanepg.cpp index bd903b162..586c9023a 100644 --- a/src/driver/scanepg.cpp +++ b/src/driver/scanepg.cpp @@ -160,7 +160,7 @@ bool CEpgScan::AddSelected() void CEpgScan::AddTransponders() { - if(bouquetList->Bouquets.empty()) + if(!bouquetList || bouquetList->Bouquets.empty()) return; if (current_mode != g_settings.epg_scan) { From b59d0fa8f978cacc6b9436c5f436bf371b3ffe0d Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 17 Feb 2017 12:11:03 +0100 Subject: [PATCH 02/25] try to fix segfault with --enable-cleanup Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e908858c1902ca8d4f523a842b3a3c95ce3f4264 Author: Jacek Jendrzej Date: 2017-02-17 (Fri, 17 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/movieplayer.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 0fda64768..893508633 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -118,17 +118,24 @@ CMoviePlayerGui::CMoviePlayerGui() CMoviePlayerGui::~CMoviePlayerGui() { - //playback->Close(); if (this == instance_mp) stopPlayBack(); - delete moviebrowser; - moviebrowser = NULL; - delete filebrowser; - filebrowser = NULL; - delete bookmarkmanager; - bookmarkmanager = NULL; - delete playback; - playback = NULL; + if(moviebrowser){ + delete moviebrowser; + moviebrowser = NULL; + } + if(filebrowser){ + delete filebrowser; + filebrowser = NULL; + } + if(bookmarkmanager){ + delete bookmarkmanager; + bookmarkmanager = NULL; + } + if(playback){ + delete playback; + playback = NULL; + } if (this == instance_mp) { delete instance_bg; instance_bg = NULL; From c7cbed3137f3f5892f037e0977f4f32f0f533848 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sun, 19 Feb 2017 23:45:09 +0100 Subject: [PATCH 03/25] framebuffer: Add fbCopyArea function - Copies areas within the frame buffer - Hardware accelerated function for cs hd2 - Copying overlapping areas does not always work correctly without hardware acceleration Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/cc5a1b3b315a277dd39094c5f6083f4e397021db Author: Michael Liebmann Date: 2017-02-19 (Sun, 19 Feb 2017) Origin message was: ------------------ framebuffer: Add fbCopyArea function - Copies areas within the frame buffer - Hardware accelerated function for cs hd2 - Copying overlapping areas does not always work correctly without hardware acceleration ------------------ This commit was generated by Migit --- src/driver/fb_accel.h | 2 ++ src/driver/fb_accel_cs_hd1.cpp | 11 +++++++ src/driver/fb_accel_cs_hd2.cpp | 22 +++++++++++++ src/driver/fb_generic.cpp | 56 ++++++++++++++++++++++++++++++++++ src/driver/fb_generic.h | 1 + 5 files changed, 92 insertions(+) diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index f776908be..72bca8aa5 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -100,6 +100,7 @@ class CFbAccelCSHD1 inline void paintHLineRel(int x, int dx, int y, const fb_pixel_t col) { paintLine(x, y, x+dx, y, col); }; inline void paintVLineRel(int x, int y, int dy, const fb_pixel_t col) { paintLine(x, y, x, y+dy, col); }; void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL); + void fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y); void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); void waitForIdle(const char *func = NULL); @@ -123,6 +124,7 @@ class CFbAccelCSHD2 void paintHLineRel(int x, int dx, int y, const fb_pixel_t col); void paintVLineRel(int x, int y, int dy, const fb_pixel_t col); void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL); + void fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y); void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); fb_pixel_t * getBackBufferPointer() const; diff --git a/src/driver/fb_accel_cs_hd1.cpp b/src/driver/fb_accel_cs_hd1.cpp index 4b3df3d20..ca6bbb296 100644 --- a/src/driver/fb_accel_cs_hd1.cpp +++ b/src/driver/fb_accel_cs_hd1.cpp @@ -262,6 +262,17 @@ void CFbAccelCSHD1::paintBoxRel(const int x, const int y, const int dx, const in checkFbArea(x, y, dx, dy, false); } +void CFbAccelCSHD1::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y) +{ + uint32_t w_, h_; + w_ = (width > xRes) ? xRes : width; + h_ = (height > yRes) ? yRes : height; + + //printf("\033[33m>>>>\033[0m [CFbAccelCSHD1::%s:%d] fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); + printf("\033[31m>>>>\033[0m [CFbAccelCSHD1::%s:%d] sw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); + CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y); +} + void CFbAccelCSHD1::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) { int xc, yc; diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index bc2983560..538fba927 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -141,6 +141,28 @@ void CFbAccelCSHD2::paintBoxRel(const int x, const int y, const int dx, const in checkFbArea(x, y, dx, dy, false); } +void CFbAccelCSHD2::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y) +{ + uint32_t w_, h_; + w_ = (width > xRes) ? xRes : width; + h_ = (height > yRes) ? yRes : height; + + if(!(w_%4)) { + fb_copyarea area; + area.dx = dst_x; + area.dy = dst_y; + area.width = w_; + area.height = h_; + area.sx = src_x; + area.sy = src_y; + ioctl(fd, FBIO_COPY_AREA, &area); + //printf("\033[33m>>>>\033[0m [CFbAccelCSHD2::%s:%d] fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); + return; + } + //printf("\033[31m>>>>\033[0m [CFbAccelCSHD2::%s:%d] sw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); + CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y); +} + void CFbAccelCSHD2::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) { int xc, yc; diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 1160b9c44..7f49122b6 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -1580,6 +1580,62 @@ void * CFrameBuffer::convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, uns return int_convertRGB2FB(rgbbuff, x, y, 0, true); } +void CFrameBuffer::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y) +{ + uint32_t w_, h_, i; + fb_pixel_t *fromBuf = NULL, *toBuf = NULL; + fb_pixel_t *dst_p, *src_p; + fb_pixel_t * fbp = getFrameBufferPointer(); + fb_pixel_t * bbp = getBackBufferPointer(); + w_ = (width > xRes) ? xRes : width; + h_ = (height > yRes) ? yRes : height; + + if ((src_y < yRes) && (dst_y < yRes)) { /* copy within framebuffer */ + fromBuf = fbp; + toBuf = fbp; + } + else if ((src_y >= yRes) && (dst_y >= yRes)) { /* copy within backbuffer */ + fromBuf = bbp; + toBuf = bbp; + dst_y -= yRes; + src_y -= yRes; + } + else if (src_y >= yRes) { /* copy backbuffer => framebuffer */ + fromBuf = bbp; + toBuf = fbp; + src_y -= yRes; + } + else if (dst_y >= yRes) { /* copy framebuffer => backbuffer */ + fromBuf = fbp; + toBuf = bbp; + dst_y -= yRes; + } + if ((fromBuf == NULL) || (toBuf == NULL)) { + //printf(">>>>> [%s:%d] buff = NULL\n", __func__, __LINE__); + return; + } + if ((src_x == dst_x) && (src_y == dst_y) && (fromBuf == toBuf)) { /* self copy? */ + //printf(">>>>> [%s:%d] self copy?\n", __func__, __LINE__); + return; + } + + dst_p = toBuf + dst_y*stride/sizeof(fb_pixel_t); + src_p = fromBuf + src_y*stride/sizeof(fb_pixel_t); + if ((w_ == xRes) && (stride == (xRes*sizeof(fb_pixel_t)))) { /* copy full width */ + //printf(">>>>> [%s:%d] copy full width - dst_p: %p, src_p: %p\n", __func__, __LINE__, dst_p, src_p); + memcpy(dst_p, src_p, w_*h_*sizeof(fb_pixel_t)); + } + else { /* copy all other */ + //printf(">>>>> [%s:%d] copy all other - dst_p: %p, src_p: %p\n", __func__, __LINE__, dst_p, src_p); + uint32_t wMem = w_*sizeof(fb_pixel_t); + for (i = 0; i < h_; i++) { + memcpy(dst_p+dst_x, src_p+src_x, wMem); + dst_p += stride/sizeof(fb_pixel_t); + src_p += stride/sizeof(fb_pixel_t); + } + } +} + void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool /*transp*/) { int xc, yc; diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index 412a3df29..dfc13e773 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -266,6 +266,7 @@ class CFrameBuffer : public sigc::trackable void* convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp = 0xFF); void* convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y); void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF); + virtual void fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y); virtual void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); virtual void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); From e6c052192835df75e33c518dd231f0c50eed7402 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sun, 19 Feb 2017 23:45:12 +0100 Subject: [PATCH 04/25] tuxtxt: Use hw blitting with fbCopyArea() for cs hd2 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/b7110faaf6e19346c620924729bb8c5824ab4e16 Author: Michael Liebmann Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libtuxtxt/tuxtxt.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index dc7d5a7c5..394d8e29f 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -5595,7 +5595,7 @@ void CopyBB2FB() { fb_pixel_t *src, *dst, *topsrc; int fillcolor, i, screenwidth, swtmp; -#ifdef HAVE_SPARK_HARDWARE +#if defined(HAVE_SPARK_HARDWARE) || defined(BOXMODEL_CS_HD2) CFrameBuffer *f = CFrameBuffer::getInstance(); #endif @@ -5620,6 +5620,8 @@ void CopyBB2FB() #else #ifdef HAVE_SPARK_HARDWARE f->blit2FB(lbb, var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, 0, true); +#elif defined BOXMODEL_CS_HD2 + f->fbCopyArea(var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, var_screeninfo.yres); #else memcpy(lfb, lbb, fix_screeninfo.line_length*var_screeninfo.yres); #endif @@ -5668,12 +5670,16 @@ void CopyBB2FB() if (screenmode == 1) { screenwidth = ( TV43STARTX ); -#ifdef HAVE_SPARK_HARDWARE +#if defined(HAVE_SPARK_HARDWARE) || defined(BOXMODEL_CS_HD2) int cx = var_screeninfo.xres - TV43STARTX; /* x start */ int cw = TV43STARTX; /* width */ int cy = StartY; int ch = 24*fontheight; +#endif +#ifdef HAVE_SPARK_HARDWARE f->blit2FB(lbb, cw, ch, cx, cy, cx, cy, true); +#elif defined BOXMODEL_CS_HD2 + f->fbCopyArea(cw, ch, cx, cy, cx, cy+var_screeninfo.yres); #else fb_pixel_t *topdst = dst; size_t width = (ex - screenwidth) * sizeof(fb_pixel_t); From adb8a608d55c8c3deeaea639f035bfe70db4ed6b Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 15 Feb 2017 20:30:52 +0100 Subject: [PATCH 05/25] fb_generic: add swidth variable, "stride in fb_pixel_t units" this should allow to use fb_pixel_t pointer arithmetics more often instead of byte pointers Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7c7d5f08dd9abe1ac71370b1f2c6ff00d2da7805 Author: Stefan Seyfried Date: 2017-02-15 (Wed, 15 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/fb_accel.cpp | 1 - src/driver/fb_accel_cs_hd1.cpp | 3 ++- src/driver/fb_accel_cs_hd2.cpp | 3 ++- src/driver/fb_accel_glfb.cpp | 3 ++- src/driver/fb_accel_sti.cpp | 1 + src/driver/fb_accel_td.cpp | 3 ++- src/driver/fb_generic.cpp | 5 ++--- src/driver/fb_generic.h | 2 +- 8 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/driver/fb_accel.cpp b/src/driver/fb_accel.cpp index d8391ab34..ba8e052ce 100644 --- a/src/driver/fb_accel.cpp +++ b/src/driver/fb_accel.cpp @@ -82,7 +82,6 @@ void CFbAccel::paintBoxRel(const int x, const int y, const int dx, const int dy, void CFbAccel::paintRect(const int x, const int y, const int dx, const int dy, const fb_pixel_t col) { int line = 0; - int swidth = stride / sizeof(fb_pixel_t); fb_pixel_t *fbp = getFrameBufferPointer() + (swidth * y); int pos; while (line < dy) diff --git a/src/driver/fb_accel_cs_hd1.cpp b/src/driver/fb_accel_cs_hd1.cpp index ca6bbb296..2672dfd58 100644 --- a/src/driver/fb_accel_cs_hd1.cpp +++ b/src/driver/fb_accel_cs_hd1.cpp @@ -346,6 +346,7 @@ int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int) return -1; } stride = _fix.line_length; + swidth = stride / sizeof(fb_pixel_t); if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) printf("screen unblanking failed\n"); xRes = screeninfo.xres; @@ -355,7 +356,7 @@ int CFbAccelCSHD1::setMode(unsigned int, unsigned int, unsigned int) int needmem = stride * yRes * 2; if (available >= needmem) { - backbuffer = lfb + stride / sizeof(fb_pixel_t) * yRes; + backbuffer = lfb + swidth * yRes; return 0; } fprintf(stderr, LOGTAG "not enough FB memory (have %d, need %d)\n", available, needmem); diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index 538fba927..b801a37ff 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -216,6 +216,7 @@ int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int) return -1; } stride = _fix.line_length; + swidth = stride / sizeof(fb_pixel_t); if (ioctl(fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) printf("screen unblanking failed\n"); xRes = screeninfo.xres; @@ -225,7 +226,7 @@ int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int) int needmem = stride * yRes * 2; if (available >= needmem) { - backbuffer = lfb + stride / sizeof(fb_pixel_t) * yRes; + backbuffer = lfb + swidth * yRes; return 0; } fprintf(stderr, LOGTAG "not enough FB memory (have %d, need %d)\n", available, needmem); diff --git a/src/driver/fb_accel_glfb.cpp b/src/driver/fb_accel_glfb.cpp index f6784c48f..cc4054258 100644 --- a/src/driver/fb_accel_glfb.cpp +++ b/src/driver/fb_accel_glfb.cpp @@ -54,6 +54,7 @@ void CFbAccelGLFB::init(const char *) } screeninfo = glfb->getScreenInfo(); stride = 4 * screeninfo.xres; + swidth = screeninfo.xres; available = glfb->getOSDBuffer()->size(); /* allocated in glfb constructor */ lbb = lfb = reinterpret_cast(glfb->getOSDBuffer()->data()); @@ -135,7 +136,7 @@ int CFbAccelGLFB::setMode(unsigned int, unsigned int, unsigned int) int needmem = stride * yRes * 2; if (available >= needmem) { - backbuffer = lfb + stride / sizeof(fb_pixel_t) * yRes; + backbuffer = lfb + swidth * yRes; return 0; } fprintf(stderr, LOGTAG " not enough FB memory (have %d, need %d)\n", available, needmem); diff --git a/src/driver/fb_accel_sti.cpp b/src/driver/fb_accel_sti.cpp index 446fc3828..dfe0ac5c3 100644 --- a/src/driver/fb_accel_sti.cpp +++ b/src/driver/fb_accel_sti.cpp @@ -512,6 +512,7 @@ int CFbAccelSTi::setMode(unsigned int, unsigned int, unsigned int) yRes = screeninfo.yres = screeninfo.yres_virtual = DEFAULT_YRES; bpp = screeninfo.bits_per_pixel = DEFAULT_BPP; stride = screeninfo.xres * screeninfo.bits_per_pixel / 8; + swidth = screeninfo.xres; return 0; } diff --git a/src/driver/fb_accel_td.cpp b/src/driver/fb_accel_td.cpp index 7033ed0bc..7ecc562c2 100644 --- a/src/driver/fb_accel_td.cpp +++ b/src/driver/fb_accel_td.cpp @@ -156,6 +156,7 @@ void CFbAccelTD::init(const char *) lbb = lfb; /* the memory area to draw to... */ available = fix.smem_len; stride = fix.line_length; + swidth = stride / sizeof(fb_pixel_t); xRes = screeninfo.xres; yRes = screeninfo.yres; bpp = screeninfo.bits_per_pixel; @@ -169,7 +170,7 @@ int CFbAccelTD::setMode(unsigned int, unsigned int, unsigned int) int needmem = stride * yRes * 2; if (available >= needmem) { - backbuffer = lfb + stride / sizeof(fb_pixel_t) * yRes; + backbuffer = lfb + swidth * yRes; return 0; } fprintf(stderr, LOGTAG " not enough FB memory (have %d, need %d)\n", available, needmem); diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 7f49122b6..ef000297f 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -340,6 +340,7 @@ int CFrameBuffer::setMode(unsigned int /*nxRes*/, unsigned int /*nyRes*/, unsign } stride = _fix.line_length; + swidth = stride / sizeof(fb_pixel_t); printf("FB: %dx%dx%d line length %d. %s accelerator.\n", xRes, yRes, bpp, stride, "Not using graphics" ); @@ -623,7 +624,6 @@ void CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, const int line++; } } else { - int swidth = stride / sizeof(fb_pixel_t); fb_pixel_t *fbp = getFrameBufferPointer() + (swidth * y); int line = 0; while (line < dy) { @@ -934,7 +934,7 @@ void CFrameBuffer::paintPixel(const int x, const int y, const fb_pixel_t col) return; fb_pixel_t * pos = getFrameBufferPointer(); - pos += (stride / sizeof(fb_pixel_t)) * y; + pos += swidth * y; pos += x; *pos = col; @@ -1680,7 +1680,6 @@ void CFrameBuffer::blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t uint32_t xc = (width > xRes) ? (uint32_t)xRes : width; uint32_t yc = (height > yRes) ? (uint32_t)yRes : height; - uint32_t swidth = stride / sizeof(fb_pixel_t); fb_pixel_t *fbp = getFrameBufferPointer() + (swidth * yoff); fb_pixel_t* data = (fb_pixel_t*)boxBuf; diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index dfc13e773..44bd4f764 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -112,7 +112,7 @@ class CFrameBuffer : public sigc::trackable fb_pixel_t backgroundColor; std::string backgroundFilename; bool useBackgroundPaint; - unsigned int xRes, yRes, stride, bpp; + unsigned int xRes, yRes, stride, swidth, bpp; t_fb_var_screeninfo screeninfo; fb_cmap cmap; __u16 red[256], green[256], blue[256], trans[256]; From 333dafe23d1cfe77f07d499917b1e2e6e6534984 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 19 Feb 2017 11:29:20 +0100 Subject: [PATCH 06/25] fb_generic: use 32bit pointers instead of 8bit Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/dd653288d81d7d6b370524394b8431c7400e197e Author: Stefan Seyfried Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_generic.cpp | 40 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index ef000297f..3370fd25c 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -438,7 +438,7 @@ void CFrameBuffer::paletteSet(struct fb_cmap *map) void CFrameBuffer::paintHLineRelInternal2Buf(const int& x, const int& dx, const int& y, const int& box_dx, const fb_pixel_t& col, fb_pixel_t* buf) { - uint8_t * pos = ((uint8_t *)buf) + x * sizeof(fb_pixel_t) + box_dx * sizeof(fb_pixel_t) * y; + fb_pixel_t * pos = buf + x + box_dx * y; fb_pixel_t * dest = (fb_pixel_t *)pos; for (int i = 0; i < dx; i++) *(dest++) = col; @@ -639,11 +639,11 @@ void CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, const int void CFrameBuffer::paintVLineRelInternal(int x, int y, int dy, const fb_pixel_t col) { - uint8_t * pos = ((uint8_t *)getFrameBufferPointer()) + x * sizeof(fb_pixel_t) + stride * y; + fb_pixel_t *pos = getFrameBufferPointer() + x + swidth * y; for(int count=0;count Date: Sun, 19 Feb 2017 11:30:11 +0100 Subject: [PATCH 07/25] acinclude: move AC_SYS_LARGEFILE after AC_CANONICAL_* no idea why, but detection of 64bit largefile flags fails otherwise in some setups Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f94f960e8564c797dc96f54cd9c079ce55178fdb Author: Stefan Seyfried Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ This commit was generated by Migit --- acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index f5b22cab2..5a98110b7 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -3,7 +3,6 @@ AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE AC_GNU_SOURCE -AC_SYS_LARGEFILE AC_ARG_WITH(target, [ --with-target=TARGET target for compilation [[native,cdk]]], @@ -75,6 +74,7 @@ fi AC_CANONICAL_BUILD AC_CANONICAL_HOST +AC_SYS_LARGEFILE check_path () { return $(perl -e "if(\"$1\"=~m#^/usr/(local/)?bin#){print \"0\"}else{print \"1\";}") From 90fa290ed54cbcf389805d60c93ac700df0c42f1 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 19 Feb 2017 11:52:37 +0100 Subject: [PATCH 08/25] libtuxtxt: remove unused fd parameter from tuxtx_main() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/418819e261fbd7de78a18078a310e3c1f632b154 Author: Stefan Seyfried Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libtuxtxt/teletext.h | 2 +- lib/libtuxtxt/tuxtxt.cpp | 6 +++--- src/gui/movieplayer.cpp | 2 +- src/neutrino.cpp | 2 +- src/system/setting_helpers.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/libtuxtxt/teletext.h b/lib/libtuxtxt/teletext.h index 6bc3dc590..cb0037d1e 100644 --- a/lib/libtuxtxt/teletext.h +++ b/lib/libtuxtxt/teletext.h @@ -5,7 +5,7 @@ int tuxtxt_init(); void tuxtxt_close(); void tuxtxt_start(int tpid, int source = 0); // Start caching int tuxtxt_stop(); // Stop caching -int tuxtx_main(int _rc, int pid, int page = 0, int source = 0); +int tuxtx_main(int pid, int page = 0, int source = 0); void tuxtx_stop_subtitle(); int tuxtx_subtitle_running(int *pid, int *page, int *running); void tuxtx_pause_subtitle(bool pause = 1); diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 394d8e29f..8f630f769 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -1561,7 +1561,7 @@ void tuxtx_pause_subtitle(bool pause) //printf("TuxTxt subtitle unpause, running %d pid %d page %d\n", reader_running, sub_pid, sub_page); ttx_paused = 0; if(!reader_running && sub_pid && sub_page) - tuxtx_main(0, sub_pid, sub_page); + tuxtx_main(sub_pid, sub_page); } else { if(!reader_running) @@ -1599,7 +1599,7 @@ void tuxtx_set_pid(int pid, int page, const char * cc) printf("TuxTxt subtitle set pid %d page %d lang %s (%d)\n", sub_pid, sub_page, cc, cfg_national_subset); ttx_paused = 1; if(sub_pid && sub_page) - tuxtx_main(0, sub_pid, sub_page); + tuxtx_main(sub_pid, sub_page); #endif } @@ -1620,7 +1620,7 @@ int tuxtx_subtitle_running(int *pid, int *page, int *running) return ret; } -int tuxtx_main(int /*_rc*/, int pid, int page, int source) +int tuxtx_main(int pid, int page, int source) { char cvs_revision[] = "$Revision: 1.95 $"; diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 893508633..87499697e 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -1595,7 +1595,7 @@ void CMoviePlayerGui::PlayFileLoop(void) else { if (g_settings.cacheTXT) tuxtxt_stop(); - tuxtx_main(g_RCInput->getFileHandle(), g_RemoteControl->current_PIDs.PIDs.vtxtpid, 0, 2); + tuxtx_main(g_RemoteControl->current_PIDs.PIDs.vtxtpid, 0, 2); frameBuffer->paintBackground(); } if (restore) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 8ab84bd88..86b8d6d34 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2538,7 +2538,7 @@ void CNeutrinoApp::RealRun() StopSubtitles(); tuxtx_stop_subtitle(); - tuxtx_main(g_RCInput->getFileHandle(), g_RemoteControl->current_PIDs.PIDs.vtxtpid); + tuxtx_main(g_RemoteControl->current_PIDs.PIDs.vtxtpid); frameBuffer->paintBackground(); //if(!g_settings.cacheTXT) diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index e177a3a34..d14bae874 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -362,7 +362,7 @@ printf("CSubtitleChangeExec::exec: TTX, pid %x page %x lang %s\n", pid, page, pt tuxtx_stop_subtitle(); tuxtx_set_pid(pid, page, ptr); dvbsub_stop(); - tuxtx_main(g_RCInput->getFileHandle(), pid, page); + tuxtx_main(pid, page); } return menu_return::RETURN_EXIT; } From 1a998d3135ef2c8fec395d2aa18bbc22ddbce68b Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 19 Feb 2017 12:09:03 +0100 Subject: [PATCH 09/25] tuxtxt: remove unused dmx variable Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/dfddc62d0c54be0834eedf99e618a88de7f8a1ad Author: Stefan Seyfried Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libtuxtxt/libtuxtxt.cpp | 6 ------ lib/libtuxtxt/tuxtxt_def.h | 1 - 2 files changed, 7 deletions(-) diff --git a/lib/libtuxtxt/libtuxtxt.cpp b/lib/libtuxtxt/libtuxtxt.cpp index 40af36282..2754c24b3 100644 --- a/lib/libtuxtxt/libtuxtxt.cpp +++ b/lib/libtuxtxt/libtuxtxt.cpp @@ -36,7 +36,6 @@ int tuxtxt_init() tuxtxt_cache.thread_starting = 0; tuxtxt_cache.vtxtpid = -1; tuxtxt_cache.thread_id = 0; - tuxtxt_cache.dmx = -1; /* not sure if this is correct here... */ tuxtxt_cache.page = 0x100; return 1;//tuxtxt_init_demuxer(); @@ -82,11 +81,6 @@ void tuxtxt_close() printf ("libtuxtxt: cleaning up\n"); #endif tuxtxt_stop(); -#if 0 - if (tuxtxt_cache.dmx != -1) - close(tuxtxt_cache.dmx); -#endif - tuxtxt_cache.dmx = -1; tuxtxt_clear_cache(); tuxtxt_initialized=0; } diff --git a/lib/libtuxtxt/tuxtxt_def.h b/lib/libtuxtxt/tuxtxt_def.h index 255db1f74..6d25a0bec 100644 --- a/lib/libtuxtxt/tuxtxt_def.h +++ b/lib/libtuxtxt/tuxtxt_def.h @@ -92,7 +92,6 @@ typedef struct short flofpages[0x900][FLOFSIZE]; unsigned char adip[0x900][13]; unsigned char subpagetable[0x900]; - int dmx; int vtxtpid; int cached_pages, page, subpage, pageupdate,page_receiving, current_page[9], current_subpage[9]; int receiving, thread_starting, zap_subpage_manual; From 95048c1ebbd4f85dc8012c35b8a0e613e45a0314 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 19 Feb 2017 14:34:44 +0100 Subject: [PATCH 10/25] tuxtxt: remove old framebuffer device code Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/b3a79a3a33137e8c1bf86ef5b885e852f854791e Author: Stefan Seyfried Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libtuxtxt/tuxtxt.cpp | 94 ---------------------------------------- lib/libtuxtxt/tuxtxt.h | 2 +- 2 files changed, 1 insertion(+), 95 deletions(-) diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 8f630f769..2086d976c 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -47,8 +47,6 @@ static int cfg_national_subset; static int screen_x, screen_y, screen_w, screen_h; -//#define USE_FBPAN // FBIOPAN_DISPLAY seems to be working in current driver - fb_pixel_t *getFBp(int *y) { if (*y < (int)var_screeninfo.yres) @@ -1519,18 +1517,6 @@ void eval_l25() /****************************************************************************** * main loop * ******************************************************************************/ -static void cleanup_fb_pan() -{ -#ifdef USE_FBPAN - if (var_screeninfo.yoffset) - { - var_screeninfo.yoffset = 0; - if (ioctl(fb, FBIOPAN_DISPLAY, &var_screeninfo) == -1) - perror("TuxTxt "); - } -#endif -} - static void* reader_thread(void * /*arg*/) { printf("TuxTxt subtitle thread started\n"); @@ -1549,7 +1535,6 @@ static void* reader_thread(void * /*arg*/) } if(!ttx_paused) CleanUp(); - cleanup_fb_pan(); tuxtxt_close(); printf("TuxTxt subtitle thread stopped\n"); pthread_exit(NULL); @@ -1571,7 +1556,6 @@ void tuxtx_pause_subtitle(bool pause) while(!ttx_paused) usleep(10); printf("TuxTxt subtitle paused\n"); - cleanup_fb_pan(); } } @@ -1644,15 +1628,6 @@ int tuxtx_main(int pid, int page, int source) printf("TuxTxt %s\n", versioninfo); printf("for 32bpp framebuffer\n"); - fb = -1; -#ifdef USE_FBPAN - if ((fb=open("/dev/fb/0", O_RDWR)) == -1) - { - perror("TuxTxt "); - return 0; - } -#endif - CFrameBuffer *fbp = CFrameBuffer::getInstance(); lfb = fbp->getFrameBufferPointer(); lbb = fbp->getBackBufferPointer(); @@ -1664,28 +1639,12 @@ int tuxtx_main(int pid, int page, int source) else printf("[tuxtxt] using PID %x page %d\n", tuxtxt_cache.vtxtpid, tuxtxt_cache.page); -#if 0 /* just get it from the framebuffer class */ - /* get fixed screeninfo */ - if (ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1) - { - perror("TuxTxt "); - return 0; - } - - /* get variable screeninfo */ - if (ioctl(fb, FBIOGET_VSCREENINFO, &var_screeninfo) == -1) - { - perror("TuxTxt "); - return 0; - } -#else struct fb_var_screeninfo *var; var = fbp->getScreenInfo(); /* this is actually the length of the screen in pixels */ stride = fbp->getStride() / sizeof(fb_pixel_t); memcpy(&var_screeninfo, var, sizeof(struct fb_var_screeninfo)); fix_screeninfo.line_length = var_screeninfo.xres * sizeof(fb_pixel_t); -#endif /* set variable screeninfo for double buffering */ var_screeninfo.yoffset = 0; #if 0 @@ -1871,9 +1830,6 @@ int tuxtx_main(int pid, int page, int source) /* exit */ CleanUp(); - if (fb >= 0) - close(fb); - #if 1 if ( initialized ) tuxtxt_close(); @@ -2266,7 +2222,6 @@ void CleanUp() /* hide and close pig */ if (screenmode) SwitchScreenMode(0); /* turn off divided screen */ - //close(pig); #if TUXTXT_CFG_STANDALONE tuxtxt_stop_thread(); @@ -2278,9 +2233,6 @@ void CleanUp() //tuxtxt_stop(); #endif -#ifdef USE_FBPAN - cleanup_fb_pan(); -#endif //memset(lfb,0, var_screeninfo.yres*fix_screeninfo.line_length); //CFrameBuffer::getInstance()->paintBackground(); ClearFB(transp); @@ -3998,25 +3950,9 @@ void SwitchScreenMode(int newscreenmode) CFrameBuffer *f = CFrameBuffer::getInstance(); videoDecoder->Pig(tx, ty, tw, th, f->getScreenWidth(true), f->getScreenHeight(true)); -#if 0 - int sm = 0; - ioctl(pig, VIDIOC_OVERLAY, &sm); - sm = 1; - ioctl(pig, VIDIOC_G_FMT, &format); - format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY; - format.fmt.win.w.left = tx; - format.fmt.win.w.top = ty; - format.fmt.win.w.width = tw; - format.fmt.win.w.height = th; - ioctl(pig, VIDIOC_S_FMT, &format); - ioctl(pig, VIDIOC_OVERLAY, &sm); -#endif } else /* not split */ { -#if 0 - ioctl(pig, VIDIOC_OVERLAY, &screenmode); -#endif videoDecoder->Pig(-1, -1, -1, -1); int x = screen_x; @@ -5386,14 +5322,7 @@ void showlink(int column, int linkpage) int oldfontwidth = fontwidth; int yoffset; -#ifdef USE_FBPAN - if (var_screeninfo.yoffset) - yoffset = 0; - else - yoffset = var_screeninfo.yres; -#else yoffset = var_screeninfo.yres; //NEW -#endif int abx = ((displaywidth)%(40-nofirst) == 0 ? displaywidth+1 : (displaywidth)/(((displaywidth)%(40-nofirst)))+1);// distance between 'inserted' pixels int width = displaywidth /4; @@ -5606,25 +5535,12 @@ void CopyBB2FB() /* copy backbuffer to framebuffer */ if (!zoommode) { -#ifdef USE_FBPAN - /* if yoffset != 0, we had active page 1, and activate 0 */ - /* else active was page 0, activate page 1 */ - if (var_screeninfo.yoffset) - var_screeninfo.yoffset = 0; - else - var_screeninfo.yoffset = var_screeninfo.yres; - - //FIXME check zoom mode code - if (ioctl(fb, FBIOPAN_DISPLAY, &var_screeninfo) == -1) - perror("TuxTxt "); -#else #ifdef HAVE_SPARK_HARDWARE f->blit2FB(lbb, var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, 0, true); #elif defined BOXMODEL_CS_HD2 f->fbCopyArea(var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, var_screeninfo.yres); #else memcpy(lfb, lbb, fix_screeninfo.line_length*var_screeninfo.yres); -#endif #endif /* adapt background of backbuffer if changed */ @@ -5644,16 +5560,6 @@ void CopyBB2FB() src = topsrc = lbb + StartY * stride; dst = lfb + StartY * stride; -#ifdef USE_FBPAN - #error USE_FBPAN code is not working right now. - if (var_screeninfo.yoffset) - dst += fix_screeninfo.line_length * var_screeninfo.yres; - else - { - src += fix_screeninfo.line_length * var_screeninfo.yres; - topsrc += fix_screeninfo.line_length * var_screeninfo.yres; - } -#endif /* copy line25 in normal height */ if (!pagecatching ) memmove(dst + (24 * fontheight) * stride, src + (24 * fontheight) * stride, stride * fontheight); diff --git a/lib/libtuxtxt/tuxtxt.h b/lib/libtuxtxt/tuxtxt.h index b347d6420..9c49adf03 100644 --- a/lib/libtuxtxt/tuxtxt.h +++ b/lib/libtuxtxt/tuxtxt.h @@ -593,7 +593,7 @@ char versioninfo[16]; int hotlist[10]; int maxhotlist; -int pig, fb, lcd; +int lcd; int sx, ex, sy, ey; int PosX, PosY, StartX, StartY; int lastpage; From 4583af138536fcb95698b82fcd03bc7d5a0ac877 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 19 Feb 2017 17:57:59 +0100 Subject: [PATCH 11/25] fb_accel_glfb: fix color palette setting Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9385bd8bd9c704b129a3ee64e65d516376cf7207 Author: Stefan Seyfried Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_accel_glfb.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/driver/fb_accel_glfb.cpp b/src/driver/fb_accel_glfb.cpp index cc4054258..2d9ba539f 100644 --- a/src/driver/fb_accel_glfb.cpp +++ b/src/driver/fb_accel_glfb.cpp @@ -37,6 +37,7 @@ extern GLFramebuffer *glfb; #include #include +#include #define LOGTAG "[fb_glfb] " @@ -62,6 +63,33 @@ void CFbAccelGLFB::init(const char *) setMode(720, 576, 8 * sizeof(fb_pixel_t)); blit_thread = false; + + /* Windows Colors */ + int tr = 0xff; + paletteSetColor(0x1, 0x010101, tr); + paletteSetColor(0x2, 0x800000, tr); + paletteSetColor(0x3, 0x008000, tr); + paletteSetColor(0x4, 0x808000, tr); + paletteSetColor(0x5, 0x000080, tr); + paletteSetColor(0x6, 0x800080, tr); + paletteSetColor(0x7, 0x008080, tr); + paletteSetColor(0x8, 0xA0A0A0, tr); + paletteSetColor(0x9, 0x505050, tr); + paletteSetColor(0xA, 0xFF0000, tr); + paletteSetColor(0xB, 0x00FF00, tr); + paletteSetColor(0xC, 0xFFFF00, tr); + paletteSetColor(0xD, 0x0000FF, tr); + paletteSetColor(0xE, 0xFF00FF, tr); + paletteSetColor(0xF, 0x00FFFF, tr); + paletteSetColor(0x10, 0xFFFFFF, tr); + paletteSetColor(0x11, 0x000000, tr); + paletteSetColor(COL_BACKGROUND, 0x000000, 0x0); + + paletteSet(); + + useBackground(false); + m_transparent = m_transparent_default; + /* start the autoblit-thread (run() function) */ OpenThreads::Thread::start(); }; From f647b4a09fe0febf8946d929b0f86fbbbec3f155 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 19 Feb 2017 18:04:50 +0100 Subject: [PATCH 12/25] tuxtxt: remove old, unused input code Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/291eaa0450908cea1f33acdde98bed3dc10ed773 Author: Stefan Seyfried Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libtuxtxt/tuxtxt.cpp | 140 --------------------------------------- lib/libtuxtxt/tuxtxt.h | 33 --------- 2 files changed, 173 deletions(-) diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 2086d976c..4fec1c501 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -6331,146 +6331,6 @@ int GetRCCode() return 0; } -#if 0 -#if 1 -int GetRCCode() -{ - struct input_event ev; - static __u16 rc_last_key = KEY_RESERVED; - - int val = fcntl(rc, F_GETFL); - if(!(val & O_NONBLOCK)) - printf("[tuxtxt] GetRCCode in blocking mode.\n"); - - /* get code */ - if (read(rc, &ev, sizeof(ev)) == sizeof(ev)) - { - if (ev.value) - { - if (ev.code != rc_last_key || - ev.code == KEY_DOWN || ev.code == KEY_UP || /* allow direction keys */ - ev.code == KEY_LEFT || ev.code == KEY_RIGHT) /* to autorepeat... */ - { - rc_last_key = ev.code; - switch (ev.code) - { - case KEY_UP: RCCode = RC_UP; break; - case KEY_DOWN: RCCode = RC_DOWN; break; - case KEY_LEFT: RCCode = RC_LEFT; break; - case KEY_RIGHT: RCCode = RC_RIGHT; break; - case KEY_OK: RCCode = RC_OK; break; - case KEY_0: RCCode = RC_0; break; - case KEY_1: RCCode = RC_1; break; - case KEY_2: RCCode = RC_2; break; - case KEY_3: RCCode = RC_3; break; - case KEY_4: RCCode = RC_4; break; - case KEY_5: RCCode = RC_5; break; - case KEY_6: RCCode = RC_6; break; - case KEY_7: RCCode = RC_7; break; - case KEY_8: RCCode = RC_8; break; - case KEY_9: RCCode = RC_9; break; - case KEY_RED: RCCode = RC_RED; break; - case KEY_GREEN: RCCode = RC_GREEN; break; - case KEY_YELLOW: RCCode = RC_YELLOW; break; - case KEY_BLUE: RCCode = RC_BLUE; break; - case KEY_VOLUMEUP: RCCode = RC_PLUS; break; - case KEY_VOLUMEDOWN: RCCode = RC_MINUS; break; - case KEY_MUTE: RCCode = RC_MUTE; break; -#if !HAVE_TRIPLEDRAGON - /* on CS, change transparent mode with TEXT key */ - case KEY_TEXT: RCCode = RC_TEXT; break; -#else - /* on TD, cycle split screen mode with TTX key - * - the TD has a special key for transparent mode */ - case KEY_TEXT: RCCode = RC_MINUS; break; -#endif - case KEY_TTTV: RCCode = RC_MUTE; break; - case KEY_TTZOOM: RCCode = RC_PLUS; break; - case KEY_REVEAL: RCCode = RC_HELP; break; - //case KEY_HELP: RCCode = RC_HELP; break; - case KEY_INFO: RCCode = RC_HELP; break; - case KEY_MENU: RCCode = RC_DBOX; break; - case KEY_EXIT: RCCode = RC_HOME; break; - case KEY_POWER: RCCode = RC_STANDBY; break; - } -printf("[tuxtxt] new key, code %X\n", RCCode); - return 1; - } - } - else - { - RCCode = -1; - rc_last_key = KEY_RESERVED; - } - } - - RCCode = -1; - usleep(1000000/25); - - return 0; -} -#else -/* this is obsolete and can soon be removed */ -int GetRCCode() -{ - static unsigned short LastKey = -1; - int count; - if ((count = read(rc, &RCCode, 2)) != 2) - { - RCCode = -1; - usleep(1000000/100); - return 0; - } - - fprintf(stderr, "rccode: %04x\n", RCCode); - if (RCCode == LastKey && - RCCode != 0x18 && RCCode != 0x19 && /* allow direction keys */ - RCCode != 0x1b && RCCode != 0x1c) /* to autorepeat... */ - { - RCCode = -1; - return 1; - } - - LastKey = RCCode; - if ((RCCode & 0xFF00) == 0x0000) - { - switch (RCCode) - { - case 0x18: RCCode = RC_UP; break; - case 0x1c: RCCode = RC_DOWN; break; - case 0x19: RCCode = RC_LEFT; break; - case 0x1b: RCCode = RC_RIGHT; break; - case 0x1a: RCCode = RC_OK; break; - case 0x0e: RCCode = RC_0; break; - case 0x02: RCCode = RC_1; break; - case 0x03: RCCode = RC_2; break; - case 0x04: RCCode = RC_3; break; - case 0x05: RCCode = RC_4; break; - case 0x06: RCCode = RC_5; break; - case 0x07: RCCode = RC_6; break; - case 0x09: RCCode = RC_7; break; - case 0x0a: RCCode = RC_8; break; - case 0x0b: RCCode = RC_9; break; - case 0x1f: RCCode = RC_RED; break; - case 0x20: RCCode = RC_GREEN; break; - case 0x21: RCCode = RC_YELLOW; break; - case 0x22: RCCode = RC_BLUE; break; - case 0x29: RCCode = RC_PLUS; break; // [=X=] key -> double height - case 0x27: RCCode = RC_MINUS; break; // [txt] key -> split mode - case 0x11: RCCode = RC_MUTE; break; - case 0x28: RCCode = RC_MUTE; break; // [ /=] key - case 0x14: RCCode = RC_HELP; break; - case 0x2a: RCCode = RC_HELP; break; // [==?] key - case 0x12: RCCode = RC_DBOX; break; - case 0x15: RCCode = RC_HOME; break; - case 0x01: RCCode = RC_STANDBY; break; - } - return 1; - } - return 1; -} -#endif -#endif /* Local Variables: */ /* indent-tabs-mode:t */ /* tab-width:3 */ diff --git a/lib/libtuxtxt/tuxtxt.h b/lib/libtuxtxt/tuxtxt.h index 9c49adf03..7ccc8994c 100644 --- a/lib/libtuxtxt/tuxtxt.h +++ b/lib/libtuxtxt/tuxtxt.h @@ -32,8 +32,6 @@ #include -#include - #include #include @@ -146,36 +144,6 @@ int tv_pip_y; #define hold_mosaic 0x1E #define release_mosaic 0x1F -#if 0 -/* rc codes */ -#define RC_0 0x00 -#define RC_1 0x01 -#define RC_2 0x02 -#define RC_3 0x03 -#define RC_4 0x04 -#define RC_5 0x05 -#define RC_6 0x06 -#define RC_7 0x07 -#define RC_8 0x08 -#define RC_9 0x09 -#define RC_RIGHT 0x0A -#define RC_LEFT 0x0B -#define RC_UP 0x0C -#define RC_DOWN 0x0D -#define RC_OK 0x0E -#define RC_MUTE 0x0F -#define RC_STANDBY 0x10 -#define RC_GREEN 0x11 -#define RC_YELLOW 0x12 -#define RC_RED 0x13 -#define RC_BLUE 0x14 -#define RC_PLUS 0x15 -#define RC_MINUS 0x16 -#define RC_HELP 0x17 -#define RC_DBOX 0x18 -#define RC_TEXT 0x19 -#define RC_HOME 0x1F -#else #define RC_0 CRCInput::RC_0 #define RC_1 CRCInput::RC_1 #define RC_2 CRCInput::RC_2 @@ -216,7 +184,6 @@ int tv_pip_y; #define RC_SPLIT (CRCInput::RC_MaxRC + 1) #define RC_TEXT CRCInput::RC_text #endif -#endif typedef enum /* object type */ { From 2ded710c6ef99adc7b2d5d7838d4d0a7e532621a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 19 Feb 2017 18:14:57 +0100 Subject: [PATCH 13/25] tuxtxt: remove dead code, unnecessary header includes Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/cdc9935b8313780ef4314186770994f035fd133e Author: Stefan Seyfried Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libtuxtxt/libtuxtxt.cpp | 4 +--- lib/libtuxtxt/tuxtxt.h | 4 ---- lib/libtuxtxt/tuxtxt_common.h | 11 ----------- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/lib/libtuxtxt/libtuxtxt.cpp b/lib/libtuxtxt/libtuxtxt.cpp index 2754c24b3..28290ab0a 100644 --- a/lib/libtuxtxt/libtuxtxt.cpp +++ b/lib/libtuxtxt/libtuxtxt.cpp @@ -10,9 +10,7 @@ ******************************************************************************/ #define TUXTXT_DEBUG 0 - -#include -#include +#include #include "tuxtxt_def.h" #include "tuxtxt_common.h" diff --git a/lib/libtuxtxt/tuxtxt.h b/lib/libtuxtxt/tuxtxt.h index 7ccc8994c..4d8e3c452 100644 --- a/lib/libtuxtxt/tuxtxt.h +++ b/lib/libtuxtxt/tuxtxt.h @@ -21,7 +21,6 @@ #include -#include #include #include #include @@ -32,9 +31,6 @@ #include -#include -#include - #include "tuxtxt_def.h" #include diff --git a/lib/libtuxtxt/tuxtxt_common.h b/lib/libtuxtxt/tuxtxt_common.h index 0abbf87c1..52f9d419e 100644 --- a/lib/libtuxtxt/tuxtxt_common.h +++ b/lib/libtuxtxt/tuxtxt_common.h @@ -1,8 +1,6 @@ /* tuxtxt_common.h * for license info see the other tuxtxt files */ -#include -#include #include #include #include @@ -1132,15 +1130,6 @@ int tuxtxt_stop_thread() delete dmx; dmx = NULL; } -#if 0 - if (tuxtxt_cache.dmx != -1) - { - //ioctl(tuxtxt_cache.dmx, DMX_STOP); - -// close(tuxtxt_cache.dmx); - } -// tuxtxt_cache.dmx = -1; -#endif #if 1//TUXTXT_DEBUG printf("TuxTxt stopped service %x\n", tuxtxt_cache.vtxtpid); #endif From 8b9b2aa6143576060198250900ff2456a8c4b8ea Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Tue, 21 Feb 2017 06:25:12 +0100 Subject: [PATCH 14/25] fb_generic: use more swidth variables in fbCopyArea() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8bee8b4c6d7531f46cbe849f9477d46566660c7d Author: Michael Liebmann Date: 2017-02-21 (Tue, 21 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_generic.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 3370fd25c..37b66ca00 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -1617,9 +1617,9 @@ void CFrameBuffer::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, u return; } - dst_p = toBuf + dst_y*stride/sizeof(fb_pixel_t); - src_p = fromBuf + src_y*stride/sizeof(fb_pixel_t); - if ((w_ == xRes) && (stride == (xRes*sizeof(fb_pixel_t)))) { /* copy full width */ + dst_p = toBuf + dst_y*swidth; + src_p = fromBuf + src_y*swidth; + if ((w_ == xRes) && (swidth == xRes)) { /* copy full width */ //printf(">>>>> [%s:%d] copy full width - dst_p: %p, src_p: %p\n", __func__, __LINE__, dst_p, src_p); memcpy(dst_p, src_p, w_*h_*sizeof(fb_pixel_t)); } @@ -1628,8 +1628,8 @@ void CFrameBuffer::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, u uint32_t wMem = w_*sizeof(fb_pixel_t); for (i = 0; i < h_; i++) { memcpy(dst_p+dst_x, src_p+src_x, wMem); - dst_p += stride/sizeof(fb_pixel_t); - src_p += stride/sizeof(fb_pixel_t); + dst_p += swidth; + src_p += swidth; } } } From be9e1e020bb5a32c645688228104d6c69d1ed695 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 22 Feb 2017 06:21:21 +0100 Subject: [PATCH 15/25] src/system/helpers.cpp: Add function readLink() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0c182785e23b5e266338756cb8ba6efe193eefbf Author: Michael Liebmann Date: 2017-02-22 (Wed, 22 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/system/helpers.cpp | 10 ++++++++++ src/system/helpers.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index e6e4a1e2e..59d64524a 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -1272,3 +1272,13 @@ std::string Lang2ISO639_1(std::string& lang) return ret; } + +string readLink(string lnk) +{ + char buf[PATH_MAX]; + memset(buf, 0, sizeof(buf)-1); + if (readlink(lnk.c_str(), buf, sizeof(buf)-1) != -1) + return (string)buf; + + return ""; +} diff --git a/src/system/helpers.h b/src/system/helpers.h index e117e011e..c7f3ae06a 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -148,5 +148,6 @@ bool split_config_string(const std::string &str, std::map Date: Wed, 22 Feb 2017 06:21:25 +0100 Subject: [PATCH 16/25] rcinput: Transfer from neutrino-mp for better compatibility Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/d932a1a32683460d48b14755f303eb07eec53e2b Author: Michael Liebmann Date: 2017-02-22 (Wed, 22 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 61 ++++++++++++++++++++++++++++++++++++------ src/driver/rcinput.h | 8 ++++-- 2 files changed, 59 insertions(+), 10 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 419cd3769..a7a3da9de 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -4,7 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' 2003 thegoodguy - Copyright (C) 2008-2012 Stefan Seyfried + Copyright (C) 2008-2014,2016 Stefan Seyfried Copyright (C) 2013-2014 martii License: GPL @@ -65,7 +65,17 @@ #define ENABLE_REPEAT_CHECK +#if HAVE_SPARK_HARDWARE +/* this relies on event0 being the AOTOM frontpanel driver device + * TODO: what if another input device is present? */ +const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir", "/dev/input/event0"}; +#elif HAVE_GENERIC_HARDWARE +/* the FIFO created by libstb-hal */ +const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/tmp/neutrino.input"}; +#else +//const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir", "/dev/input/event0"}; const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir"}; +#endif typedef struct input_event t_input_event; #ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL @@ -535,7 +545,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 //static __u16 rc_last_key = KEY_MAX; static __u16 rc_last_repeat_key = KEY_MAX; - struct timeval tv; struct timeval tvselect; uint64_t InitialTimeout = Timeout; int64_t targetTimeout; @@ -559,7 +568,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 uint64_t getKeyBegin = time_monotonic_us(); while(1) { - /* we later check for ev.type = EV_SYN which is 0x00, so set something invalid here... */ timer_id = 0; if ( !timers.empty() ) { @@ -1228,7 +1236,11 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { if ((fd_rc[i] != -1) && (FD_ISSET(fd_rc[i], &rfds))) { + uint64_t now_pressed = 0; t_input_event ev; + memset(&ev, 0, sizeof(ev)); + /* we later check for ev.type = EV_SYN = 0x00, so set something invalid here... */ + ev.type = EV_MAX; int ret = read(fd_rc[i], &ev, sizeof(t_input_event)); if (ret != sizeof(t_input_event)) { if (errno == ENODEV) { @@ -1240,6 +1252,22 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } if (ev.type == EV_SYN) continue; /* ignore... */ + if (ev.value) { + /* try to compensate for possible changes in wall clock + * kernel ev.time default uses CLOCK_REALTIME, as does gettimeofday(). + * so subtract gettimeofday() from ev.time and then add + * CLOCK_MONOTONIC, which is supposed to not change with settimeofday. + * Everything would be much easier if we could use the post-kernel 3.4 + * EVIOCSCLOCKID ioctl :-) */ + struct timespec t1; + now_pressed = ev.time.tv_usec + ev.time.tv_sec * 1000000ULL; + if (!clock_gettime(CLOCK_MONOTONIC, &t1)) { + struct timeval t2; + gettimeofday(&t2, NULL); + now_pressed += t1.tv_sec * 1000000ULL + t1.tv_nsec / 1000; + now_pressed -= (t2.tv_usec + t2.tv_sec * 1000000ULL); + } + } SHTDCNT::getInstance()->resetSleepTimer(); if (ev.value && firstKey) { firstKey = false; @@ -1247,8 +1275,8 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } uint32_t trkey = translate(ev.code); -#ifdef DEBUG - printf("%d key: %04x value %d, translate: %04x -%s-\n", ev.value, ev.code, ev.value, trkey, getKeyName(trkey).c_str()); +#ifdef _DEBUG + printf("key: %04x value %d, translate: %04x -%s-\n", ev.code, ev.value, trkey, getKeyName(trkey).c_str()); #endif if (trkey == RC_nokey) continue; @@ -1286,15 +1314,22 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 #ifdef RCDEBUG printf("rc_last_key %04x rc_last_repeat_key %04x\n\n", rc_last_key, rc_last_repeat_key); #endif - uint64_t now_pressed; bool keyok = true; - +#if 0 + uint64_t now_pressed; tv = ev.time; now_pressed = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); +#endif if (trkey == rc_last_key) { /* only allow selected keys to be repeated */ if (mayRepeat(trkey, bAllowRepeatLR) || - (g_settings.shutdown_real_rcdelay && ((trkey == RC_standby) && (cs_get_revision() > 7))) ) + (g_settings.shutdown_real_rcdelay && + ((trkey == RC_standby) && +#if HAVE_COOL_HARDWARE + (cs_get_revision() > 7)))) +#else + (g_info.hw_caps->can_shutdown)))) +#endif { #ifdef ENABLE_REPEAT_CHECK if (rc_last_repeat_key != trkey) { @@ -1613,6 +1648,16 @@ int CRCInput::translate(int code) return RC_up; case 0x101: // FIXME -- needed? return RC_down; +#ifdef HAVE_AZBOX_HARDWARE + case KEY_HOME: + return RC_favorites; + case KEY_TV: + return RC_stop; + case KEY_RADIO: + return RC_record; + case KEY_PLAY: + return RC_pause; +#endif default: break; } diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index 5c6458506..4bd580f3f 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -115,8 +115,8 @@ */ -typedef uint32_t neutrino_msg_t; -typedef uint32_t neutrino_msg_data_t; +typedef unsigned long neutrino_msg_t; +typedef unsigned long neutrino_msg_data_t; #define NEUTRINO_UDS_NAME "/tmp/neutrino.sock" @@ -147,7 +147,11 @@ class CRCInput int fd_pipe_high_priority[2]; int fd_pipe_low_priority[2]; int fd_gamerc; +#ifdef HAVE_SPARK_HARDWARE +#define NUMBER_OF_EVENT_DEVICES 2 +#else #define NUMBER_OF_EVENT_DEVICES 1 +#endif int fd_rc[NUMBER_OF_EVENT_DEVICES]; int fd_keyb; int fd_event; From 3c7aca79492d026dd7343ac7211d4ef86a4fe7cc Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 22 Feb 2017 06:21:29 +0100 Subject: [PATCH 17/25] Fix compiler format warnings Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e35969afe26c6e1f42c0ea976804bfad2299b958 Author: Michael Liebmann Date: 2017-02-22 (Wed, 22 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/cam_menu.cpp | 2 +- src/gui/scan.cpp | 10 +++++----- src/gui/widget/listhelpers.cpp | 4 ++-- src/neutrino.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 1ea62fc18..9b2a9755a 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -502,7 +502,7 @@ int CCAMMenuHandler::doMenu(int slot, CA_SLOT_TYPE slotType) g_Locale->getText(slotType == CA_SLOT_TYPE_CI ? LOCALE_CI_WAITING : LOCALE_SC_WAITING)); g_RCInput->getMsgAbsoluteTimeout (&msg, &data, &timeoutEnd); - printf("CCAMMenuHandler::doMenu: msg %x data %x\n", msg, data); + printf("CCAMMenuHandler::doMenu: msg %lx data %lx\n", msg, data); if (msg == CRCInput::RC_timeout) { printf("CCAMMenuHandler::doMenu: menu timeout\n"); hideHintBox(); diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index 6f894ffe3..5a6213853 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -386,7 +386,7 @@ int CScanTs::handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data) break; case NeutrinoMessages::EVT_SCAN_NUM_TRANSPONDERS: - sprintf(buffer, "%u", data); + sprintf(buffer, "%ld", data); paintLine(xpos2, ypos_transponder, w - (8*fw), buffer); total = data; snprintf(str, sizeof(buffer), "scan: %d/%d", done, total); @@ -426,22 +426,22 @@ int CScanTs::handleMsg(neutrino_msg_t msg, neutrino_msg_data_t data) break; case NeutrinoMessages::EVT_SCAN_NUM_CHANNELS: - sprintf(buffer, " = %u", data); + sprintf(buffer, " = %ld", data); paintLine(xpos1 + 3 * (6*fw), ypos_service_numbers + mheight, width - 3 * (6*fw) - 10, buffer); break; case NeutrinoMessages::EVT_SCAN_FOUND_TV_CHAN: - sprintf(buffer, "%u", data); + sprintf(buffer, "%ld", data); paintLine(xpos1, ypos_service_numbers + mheight, (6*fw), buffer); break; case NeutrinoMessages::EVT_SCAN_FOUND_RADIO_CHAN: - sprintf(buffer, "%u", data); + sprintf(buffer, "%ld", data); paintLine(xpos1 + (6*fw), ypos_service_numbers + mheight, (6*fw), buffer); break; case NeutrinoMessages::EVT_SCAN_FOUND_DATA_CHAN: - sprintf(buffer, "%u", data); + sprintf(buffer, "%ld", data); paintLine(xpos1 + 2 * (6*fw), ypos_service_numbers + mheight, (6*fw), buffer); break; diff --git a/src/gui/widget/listhelpers.cpp b/src/gui/widget/listhelpers.cpp index 45af70358..9d3adf3ab 100644 --- a/src/gui/widget/listhelpers.cpp +++ b/src/gui/widget/listhelpers.cpp @@ -33,7 +33,7 @@ static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) return -1; if (msg >= CRCInput::RC_MaxRC) { - printf("CListHelpers:%s: invalid key? 0x%X\n", __func__, msg); + printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); return -1; } int key = (int)msg; @@ -46,7 +46,7 @@ static int upDownKey(int size, neutrino_msg_t msg, int lines, int sel) else if (msg == CRCInput::RC_down) step = 1; else { - printf("CListHelpers:%s: invalid key? 0x%X\n", __func__, msg); + printf("CListHelpers:%s: invalid key? 0x%lx\n", __func__, msg); return -1; } // printf("CListHelpers:%s: key 0x%04lx lines %d size %d sel %d\n", __func__, msg, lines, size, sel); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 86b8d6d34..a1ae72747 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2404,7 +2404,7 @@ void CNeutrinoApp::RealRun() m_idletime = time(NULL); if (m_screensaver) { - printf("[neutrino] CSreenSaver stop; msg: %X\n", msg); + printf("[neutrino] CScreenSaver stop; msg: %lX\n", msg); screensaver(false); frameBuffer->stopFrame(); @@ -3421,7 +3421,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) return messages_return::handled; } else if( msg == NeutrinoMessages::CHANGEMODE ) { - printf("CNeutrinoApp::handleMsg: CHANGEMODE to %d rezap %d\n", data & mode_mask, (data & norezap) != norezap); + printf("CNeutrinoApp::handleMsg: CHANGEMODE to %d rezap %d\n", (int)(data & mode_mask), (data & norezap) != norezap); if((data & mode_mask)== mode_radio) { if( mode != mode_radio ) { radioMode((data & norezap) != norezap); From b5ec2b42dfe5ec8c6b29ea031a28f2e6da887961 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 19 Feb 2017 23:16:09 +0100 Subject: [PATCH 18/25] rcinput: use a dynamic list of input devices Instead of the fixed, static list of input devices, scan /dev/input/ for proper event devices. A "good" input device is one that supports the EVIOCGBIT ioctl and at least the EV_KEY event type. This probably needs further fixes, e.g. in repeat rate setting code. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7b3aa2b181753f5963859a4d63436eb113367143 Author: Stefan Seyfried Date: 2017-02-19 (Sun, 19 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 180 ++++++++++++++++++++++++++++------------- src/driver/rcinput.h | 25 ++++-- 2 files changed, 139 insertions(+), 66 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index a7a3da9de..bbcfbb2b7 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -4,7 +4,7 @@ Copyright (C) 2001 Steffen Hehn 'McClean' 2003 thegoodguy - Copyright (C) 2008-2014,2016 Stefan Seyfried + Copyright (C) 2008-2014,2016-2017 Stefan Seyfried Copyright (C) 2013-2014 martii License: GPL @@ -33,7 +33,6 @@ #include #include -#include #include #include #include @@ -50,6 +49,8 @@ #include #include +#include + #include #include @@ -65,17 +66,6 @@ #define ENABLE_REPEAT_CHECK -#if HAVE_SPARK_HARDWARE -/* this relies on event0 being the AOTOM frontpanel driver device - * TODO: what if another input device is present? */ -const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir", "/dev/input/event0"}; -#elif HAVE_GENERIC_HARDWARE -/* the FIFO created by libstb-hal */ -const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/tmp/neutrino.input"}; -#else -//const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir", "/dev/input/event0"}; -const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir"}; -#endif typedef struct input_event t_input_event; #ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL @@ -83,6 +73,13 @@ static struct termio orig_termio; static bool saved_orig_termio = false; #endif /* KEYBOARD_INSTEAD_OF_REMOTE_CONTROL */ static bool input_stopped = false; +static struct timespec devinput_mtime = { 0, 0 }; + +#ifdef RCDEBUG +#define d_printf printf +#else +#define d_printf(...) +#endif /********************************************************************************* * Constructor - opens rc-input device, selects rc-hardware and starts threads @@ -146,13 +143,9 @@ CRCInput::CRCInput() perror("[neutrino] listen failed...\n"); exit( -1 ); } - - for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) - { - fd_rc[i] = -1; - } clickfd = -1; repeat_block = repeat_block_generic = 0; + checkdev(); open(); rc_last_key = KEY_MAX; firstKey = true; @@ -162,21 +155,93 @@ CRCInput::CRCInput() set_rc_hw(); } -/* if dev is given, open device with index , if not (re)open all */ -void CRCInput::open(int dev) +bool CRCInput::checkdev() { - if (dev == -1) - close(); - - for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) - { - if (dev != -1) { - if (i != dev || fd_rc[i] != -1) - continue; + /* stat()ing the directory is fast and cheap. If a device gets added or + * removed, the mtime of /dev/input/ will change, which in turn + * warrants a more thorough investigation */ + struct stat st; + if (stat("/dev/input/", &st) == 0) { + if (st.st_mtim.tv_sec != devinput_mtime.tv_sec || + st.st_mtim.tv_nsec != devinput_mtime.tv_nsec) { + devinput_mtime.tv_sec = st.st_mtim.tv_sec; + devinput_mtime.tv_nsec = st.st_mtim.tv_nsec; + printf("[rcinput:%s] /dev/input mtime changed\n", __func__); + return true; + } + return false; /* still the same... */ + } + printf("[rcinput:%s] stat /dev/input failed: %m\n", __func__); + return true; /* need to check anyway... */ +} + +bool CRCInput::checkpath(in_dev id) +{ + for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { + if ((*it).path == id.path) { + printf("[rcinput:%s] skipping already opened %s\n", __func__, id.path.c_str()); + return true; + } + } + return false; +} + +/* if recheck == true, only not already opened devices are opened, if not, close then (re)open all */ +void CRCInput::open(bool recheck) +{ + if (recheck == false) + close(); + /* close() takes the lock, too... */ + OpenThreads::ScopedLock m_lock(mutex); + + unsigned long evbit; + struct in_dev id; + DIR *dir; + struct dirent *dentry; + dir = opendir("/dev/input"); + if (! dir) { + printf("[rcinput:%s] opendir failed: %m\n", __func__); + return; + } + + while ((dentry = readdir(dir)) != NULL) + { + if (dentry->d_type != DT_CHR) { + d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name); + continue; + } + d_printf("[rcinput:%s] considering '%s'\n", __func__, dentry->d_name); + id.path = "/dev/input/" + std::string(dentry->d_name); + if (checkpath(id)) + continue; + id.fd = ::open(id.path.c_str(), O_RDWR|O_NONBLOCK|O_CLOEXEC); + if (id.fd == -1) { + printf("[rcinput:%s] open %s failed: %m\n", __func__, id.path.c_str()); + continue; + } + if (ioctl(id.fd, EVIOCGBIT(0, EV_MAX), &evbit) < 0) { + ::close(id.fd); /* not a proper input device, e.g. /dev/input/mice */ + continue; + } + if ((evbit & (1 << EV_KEY)) == 0) { + printf("[rcinput:%s] %s is bad; no EV_KEY support (0x%lx)\n", __func__, id.path.c_str(), evbit); + ::close(id.fd); + continue; + } + printf("[rcinput:%s] opened %s (fd %d) ev 0x%lx\n", __func__, id.path.c_str(), id.fd, evbit); + indev.push_back(id); + } + closedir(dir); + id.path = "/tmp/neutrino.input"; + if (! checkpath(id)) { + id.fd = ::open(id.path.c_str(), O_RDWR|O_NONBLOCK|O_CLOEXEC); + if (id.fd == -1) { + /* debug, because it only matters for HAVE_GENERIC_HARDWARE */ + d_printf("[rcinput:%s] open %s failed: %m\n", __func__, id.path.c_str()); + } else { + printf("[rcinput:%s] opened %s (fd %d)\n", __func__, id.path.c_str(), id.fd); + indev.push_back(id); } - if ((fd_rc[i] = ::open(RC_EVENT_DEVICE[i], O_RDWR|O_NONBLOCK|O_CLOEXEC)) == -1) - perror(RC_EVENT_DEVICE[i]); - printf("CRCInput::open: %s fd %d\n", RC_EVENT_DEVICE[i], fd_rc[i]); } //+++++++++++++++++++++++++++++++++++++++ @@ -224,12 +289,10 @@ void CRCInput::open(int dev) void CRCInput::close() { - for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { - if (fd_rc[i] != -1) { - ::close(fd_rc[i]); - fd_rc[i] = -1; - } - } + OpenThreads::ScopedLock m_lock(mutex); + for (unsigned int i = 0; i < indev.size(); i++) + ::close(indev[i].fd); + indev.clear(); #ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL if (saved_orig_termio) { @@ -251,9 +314,9 @@ void CRCInput::calculateMaxFd() { fd_max = fd_event; - for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) - if (fd_rc[i] > fd_max) - fd_max = fd_rc[i]; + for (unsigned int i = 0; i < indev.size(); i++) + if (indev[i].fd > fd_max) + fd_max = indev[i].fd; if(fd_pipe_high_priority[0] > fd_max) fd_max = fd_pipe_high_priority[0]; @@ -558,10 +621,8 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 * TODO: real hot-plugging, e.g. of keyboards and triggering this loop... * right now it is only run if some event is happening "by accident" */ if (!input_stopped) { - for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { - if (fd_rc[i] == -1) - open(i); - } + if (checkdev()) + open(true); } // wiederholung reinmachen - dass wirklich die ganze zeit bis timeout gewartet wird! @@ -595,10 +656,10 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 tvselect.tv_usec = targetTimeout%1000000; FD_ZERO(&rfds); - for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) + for (unsigned int i = 0; i < indev.size(); i++) { - if (fd_rc[i] != -1) - FD_SET(fd_rc[i], &rfds); + if (indev[i].fd != -1) + FD_SET(indev[i].fd, &rfds); } #ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL if (true) @@ -1234,19 +1295,19 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 } } - for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) { - if ((fd_rc[i] != -1) && (FD_ISSET(fd_rc[i], &rfds))) { + for (std::vector::iterator i = indev.begin(); i != indev.end(); ++i) { + if (((*i).fd != -1) && (FD_ISSET((*i).fd, &rfds))) { uint64_t now_pressed = 0; t_input_event ev; memset(&ev, 0, sizeof(ev)); /* we later check for ev.type = EV_SYN = 0x00, so set something invalid here... */ ev.type = EV_MAX; - int ret = read(fd_rc[i], &ev, sizeof(t_input_event)); + int ret = read((*i).fd, &ev, sizeof(t_input_event)); if (ret != sizeof(t_input_event)) { if (errno == ENODEV) { /* hot-unplugged? */ - ::close(fd_rc[i]); - fd_rc[i] = -1; + ::close((*i).fd); + indev.erase(i); } continue; } @@ -1436,11 +1497,11 @@ void CRCInput::clearRCMsg() { t_input_event ev; - for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) + for (unsigned int i = 0; i < indev.size(); i++) { - if (fd_rc[i] != -1) + if (indev[i].fd != -1) { - while (read(fd_rc[i], &ev, sizeof(t_input_event)) == sizeof(t_input_event)) + while (read(indev[i].fd, &ev, sizeof(t_input_event)) == sizeof(t_input_event)) ; } } @@ -1694,9 +1755,12 @@ void CRCInput::play_click() void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address) { int ioctl_ret = -1; - + if (indev.empty()) { + printf("[rcinput:%s] indev is empty!\n", __func__); + return; + } //fixme?: for now fd_rc[] is hardcoded to 0 since only fd_rc[0] is used at the moment - ioctl_ret = ::ioctl(fd_rc[0], IOC_IR_SET_PRI_PROTOCOL, ir_protocol); + ioctl_ret = ::ioctl(indev[0].fd, IOC_IR_SET_PRI_PROTOCOL, ir_protocol); if(ioctl_ret < 0) perror("IOC_IR_SET_PRI_PROTOCOL"); else @@ -1706,7 +1770,7 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address) if(ir_address > 0) { //fixme?: for now fd_rc[] is hardcoded to 0 since only fd_rc[0] is used at the moment - ioctl_ret = ::ioctl(fd_rc[0], IOC_IR_SET_PRI_ADDRESS, ir_address); + ioctl_ret = ::ioctl(indev[0].fd, IOC_IR_SET_PRI_ADDRESS, ir_address); if(ioctl_ret < 0) perror("IOC_IR_SET_PRI_ADDRESS"); else diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index 4bd580f3f..9a859b929 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -39,6 +39,9 @@ #include #include +#include +#include + #ifdef BOXMODEL_CS_HD2 #ifdef HAVE_COOLSTREAM_CS_IR_GENERIC_H #include @@ -138,6 +141,12 @@ class CRCInput bool correct_time; }; + struct in_dev + { + int fd; + std::string path; + }; + uint32_t timerid; std::vector timers; @@ -147,21 +156,19 @@ class CRCInput int fd_pipe_high_priority[2]; int fd_pipe_low_priority[2]; int fd_gamerc; -#ifdef HAVE_SPARK_HARDWARE -#define NUMBER_OF_EVENT_DEVICES 2 -#else -#define NUMBER_OF_EVENT_DEVICES 1 -#endif - int fd_rc[NUMBER_OF_EVENT_DEVICES]; + std::vector indev; int fd_keyb; int fd_event; int fd_max; int clickfd; __u16 rc_last_key; + OpenThreads::Mutex mutex; void set_dsp(); - void open(int dev = -1); + void open(bool recheck = false); + bool checkpath(in_dev id); + bool checkdev(); void close(); int translate(int code); void calculateMaxFd(void); @@ -280,7 +287,9 @@ class CRCInput inline int getFileHandle(void) /* used for plugins (i.e. games) only */ { - return fd_rc[0]; + if (indev.empty()) + return -1; + return indev[0].fd; } void stopInput(const bool ext = false); void restartInput(const bool ext = false); From 7345242772ed9efedaa56d9ca794a52bb6b3e167 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 22 Feb 2017 06:21:33 +0100 Subject: [PATCH 19/25] rcinput: Add exception handling for cs hd2 - Supplement to previous commit Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/1b79faff780befa63a04be86560e7183d7a663aa Author: Michael Liebmann Date: 2017-02-22 (Wed, 22 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 54 +++++++++++++++++++++++++++++++++++++++++- src/driver/rcinput.h | 6 +++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index bbcfbb2b7..250b9744f 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -178,6 +178,27 @@ bool CRCInput::checkdev() bool CRCInput::checkpath(in_dev id) { for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { +#ifdef BOXMODEL_CS_HD2 + if ((id.type == DT_LNK) || ((*it).type == DT_LNK)) { + std::string check1, check2; + if (id.type == DT_LNK) + check1 = readLink(id.path); + else + check1 = id.path; + + if ((*it).type == DT_LNK) + check2 = readLink((*it).path); + else + check2 = (*it).path; + + if ((!check1.empty()) && (!check2.empty()) && (check1 == check2)) { + printf("[rcinput:%s] skipping already opened %s => %s\n", __func__, id.path.c_str(), check1.c_str()); + return true; + } + else + return false; + } +#endif if ((*it).path == id.path) { printf("[rcinput:%s] skipping already opened %s\n", __func__, id.path.c_str()); return true; @@ -186,6 +207,25 @@ bool CRCInput::checkpath(in_dev id) return false; } +#ifdef BOXMODEL_CS_HD2 +bool CRCInput::checkLnkDev(std::string lnk) +{ + static struct stat info; + if (lstat(lnk.c_str(), &info) != -1) { + if (S_ISLNK(info.st_mode)) { + std::string tmp = readLink(lnk); + if (!tmp.empty()) { + if (lstat(tmp.c_str(), &info) != -1) { + if (S_ISCHR(info.st_mode)) + return true; + } + } + } + } + return false; +} +#endif + /* if recheck == true, only not already opened devices are opened, if not, close then (re)open all */ void CRCInput::open(bool recheck) { @@ -206,10 +246,22 @@ void CRCInput::open(bool recheck) while ((dentry = readdir(dir)) != NULL) { - if (dentry->d_type != DT_CHR) { + if ((dentry->d_type != DT_CHR) +#ifdef BOXMODEL_CS_HD2 + && (dentry->d_type != DT_LNK) +#endif + + ) { d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name); continue; } +#ifdef BOXMODEL_CS_HD2 + if ((dentry->d_type == DT_LNK) && (!checkLnkDev("/dev/input/" + std::string(dentry->d_name)))) { + d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name); + continue; + } + id.type = dentry->d_type; +#endif d_printf("[rcinput:%s] considering '%s'\n", __func__, dentry->d_name); id.path = "/dev/input/" + std::string(dentry->d_name); if (checkpath(id)) diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index 9a859b929..502dc259f 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -145,6 +145,9 @@ class CRCInput { int fd; std::string path; +#ifdef BOXMODEL_CS_HD2 + int type; +#endif }; uint32_t timerid; @@ -169,6 +172,9 @@ class CRCInput void open(bool recheck = false); bool checkpath(in_dev id); bool checkdev(); +#ifdef BOXMODEL_CS_HD2 + bool checkLnkDev(std::string lnk); +#endif void close(); int translate(int code); void calculateMaxFd(void); From 475c8878f84457f0825eb9b4397a745fcff50b86 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 20 Feb 2017 20:20:54 +0100 Subject: [PATCH 20/25] rcinput: add setKeyRepeatDelay() function this allows to get rid of the broken getFileHandle function later Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0df5a8df7fd05e8fac7119e201587420c51ec887 Author: Stefan Seyfried Date: 2017-02-20 (Mon, 20 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 35 +++++++++++++++++++++++++++++++++++ src/driver/rcinput.h | 1 + 2 files changed, 36 insertions(+) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 250b9744f..51ea3a570 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -1801,6 +1801,41 @@ void CRCInput::play_click() { } +void CRCInput::setKeyRepeatDelay(unsigned int start_ms, unsigned int repeat_ms) +{ + for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { + int fd = (*it).fd; + std::string path = (*it).path; + if (path == "/tmp/neutrino.input") + continue; /* setting repeat rate does not work here */ +#ifdef HAVE_COOL_HARDWARE + /* this is ugly, but the driver does not support anything advanced... */ + if (path == "/dev/input/nevis_ir") { + d_printf("[rcinput:%s] %s(fd %d) using proprietary ioctl\n", __func__, path.c_str(), fd); + ioctl(fd, IOC_IR_SET_F_DELAY, start_ms); + ioctl(fd, IOC_IR_SET_X_DELAY, repeat_ms); + continue; + } +#endif + d_printf("[rcinput:%s] %s(fd %d) writing EV_REP (%d->%d)\n", + __func__, path.c_str(), fd, start_ms, repeat_ms); + /* if we have a good input device, we don't need the private ioctl above */ + struct input_event ie; + memset(&ie, 0, sizeof(ie)); + ie.type = EV_REP; + /* increase by 10 ms to trick the repeat checker code in the + * rcinput loop into accepting the key event... */ + ie.value = start_ms + 10; + ie.code = REP_DELAY; + if (write(fd, &ie, sizeof(ie)) == -1) + printf("[rcinput:%s] %s(fd %d) write %s: %m\n", __func__, path.c_str(), fd, "REP_DELAY"); + + ie.value = repeat_ms + 10; + ie.code = REP_PERIOD; + if (write(fd, &ie, sizeof(ie)) == -1) + printf("[rcinput:%s] %s(fd %d) write %s: %m\n", __func__, path.c_str(), fd, "REP_PERIOD"); + } +} #ifdef IOC_IR_SET_PRI_PROTOCOL // hint: ir_protocol_t and other useful things are defined in cs_ir_generic.h diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index 502dc259f..ce220bb43 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -341,6 +341,7 @@ class CRCInput void reset_dsp(int rate); void setLongPressAny(bool b) { longPressAny = b; }; + void setKeyRepeatDelay(unsigned int start_ms, unsigned int repeat_ms); }; From 8071a9d51b0d4d61328b991fdb9d56ea3b0d5bea Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 20 Feb 2017 20:22:32 +0100 Subject: [PATCH 21/25] rcinput: fix set_rc_hw() after dynamic devices patch ...this could use some tests... :-) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/41958cc0296b656673d5a61056333ed3e32488e0 Author: Stefan Seyfried Date: 2017-02-20 (Mon, 20 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 51ea3a570..1193e2f5b 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -1846,8 +1846,18 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address) printf("[rcinput:%s] indev is empty!\n", __func__); return; } - //fixme?: for now fd_rc[] is hardcoded to 0 since only fd_rc[0] is used at the moment - ioctl_ret = ::ioctl(indev[0].fd, IOC_IR_SET_PRI_PROTOCOL, ir_protocol); + int fd = -1; + for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { + if ((*it).path == "/dev/input/nevis_ir") { + fd = (*it).fd; + break; + } + } + if (fd == -1) { + printf("[rcinput:%s] no nevis_ir input device found??\n", __func__); + return; + } + ioctl_ret = ::ioctl(fd, IOC_IR_SET_PRI_PROTOCOL, ir_protocol); if(ioctl_ret < 0) perror("IOC_IR_SET_PRI_PROTOCOL"); else @@ -1857,7 +1867,7 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address) if(ir_address > 0) { //fixme?: for now fd_rc[] is hardcoded to 0 since only fd_rc[0] is used at the moment - ioctl_ret = ::ioctl(indev[0].fd, IOC_IR_SET_PRI_ADDRESS, ir_address); + ioctl_ret = ::ioctl(fd, IOC_IR_SET_PRI_ADDRESS, ir_address); if(ioctl_ret < 0) perror("IOC_IR_SET_PRI_ADDRESS"); else From bfcc110fd77b80e884da76146e9f5336ae601871 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 20 Feb 2017 20:25:57 +0100 Subject: [PATCH 22/25] keybind_setup: use rcinput->setKeyRepeatDelay() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/8b8b4ce0e26b06e2b98fa15d29fd6abd422c4de6 Author: Stefan Seyfried Date: 2017-02-20 (Mon, 20 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/keybind_setup.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index 4985536fa..1e835cc30 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -571,28 +571,7 @@ bool CKeybindSetup::changeNotify(const neutrino_locale_t OptionName, void * /* d g_RCInput->repeat_block = fdelay * 1000; g_RCInput->repeat_block_generic = xdelay * 1000; - - int fd = g_RCInput->getFileHandle(); -#ifdef HAVE_COOL_HARDWARE - ioctl(fd, IOC_IR_SET_F_DELAY, fdelay); - ioctl(fd, IOC_IR_SET_X_DELAY, xdelay); -#else - /* if we have a good input device, we don't need the private ioctl above */ - struct input_event ie; - memset(&ie, 0, sizeof(ie)); - ie.type = EV_REP; - /* increase by 10 ms to trick the repeat checker code in the - * rcinput loop into accepting the key event... */ - ie.value = fdelay + 10; - ie.code = REP_DELAY; - if (write(fd, &ie, sizeof(ie)) == -1) - perror("CKeySetupNotifier::changeNotify REP_DELAY"); - - ie.value = xdelay + 10; - ie.code = REP_PERIOD; - if (write(fd, &ie, sizeof(ie)) == -1) - perror("CKeySetupNotifier::changeNotify REP_PERIOD"); -#endif + g_RCInput->setKeyRepeatDelay(fdelay, xdelay); } return false; } From 3c678d45cf2b8bd11303203f8772c8e6123eff62 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 20 Feb 2017 20:26:39 +0100 Subject: [PATCH 23/25] rcinput: remove now unused (and broken) getFileHandle() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/dceb6989a8e81b8c93bd8cf29a872ae8cd173237 Author: Stefan Seyfried Date: 2017-02-20 (Mon, 20 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/rcinput.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index ce220bb43..848e54cf6 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -291,12 +291,6 @@ class CRCInput }; void set_rc_hw(void); - inline int getFileHandle(void) /* used for plugins (i.e. games) only */ - { - if (indev.empty()) - return -1; - return indev[0].fd; - } void stopInput(const bool ext = false); void restartInput(const bool ext = false); bool isLocked(void); From 85b82bd12f1d4c715c93a613f2b0287dc49a8879 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 20 Feb 2017 20:36:45 +0100 Subject: [PATCH 24/25] rcinput: remove unused/unimplemented click functions Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f45456d7a8b7a6f9b818e725856e272adec39eca Author: Stefan Seyfried Date: 2017-02-20 (Mon, 20 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/audioplay.cpp | 3 --- src/driver/rcinput.cpp | 26 -------------------------- src/driver/rcinput.h | 6 ------ src/gui/scan.cpp | 2 -- src/neutrino.cpp | 2 -- src/system/settings.h | 1 - 6 files changed, 40 deletions(-) diff --git a/src/driver/audioplay.cpp b/src/driver/audioplay.cpp index 956319297..494eb9baf 100644 --- a/src/driver/audioplay.cpp +++ b/src/driver/audioplay.cpp @@ -90,7 +90,6 @@ void* CAudioPlayer::PlayThread( void* /*dummy*/ ) { int soundfd = -1; set_threadname("audio:play"); - g_RCInput->close_click(); /* Decode stdin to stdout. */ CBaseDec::RetCode Status = CBaseDec::DecoderBase( &getInstance()->m_Audiofile, soundfd, @@ -109,8 +108,6 @@ void* CAudioPlayer::PlayThread( void* /*dummy*/ ) "unknown" ); } - g_RCInput->open_click(); - getInstance()->state = CBaseDec::STOP; pthread_exit(0); return NULL; diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 1193e2f5b..6161fb941 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -143,7 +143,6 @@ CRCInput::CRCInput() perror("[neutrino] listen failed...\n"); exit( -1 ); } - clickfd = -1; repeat_block = repeat_block_generic = 0; checkdev(); open(); @@ -335,7 +334,6 @@ void CRCInput::open(bool recheck) //+++++++++++++++++++++++++++++++++++++++ #endif /* KEYBOARD_INSTEAD_OF_REMOTE_CONTROL */ - open_click(); calculateMaxFd(); } @@ -396,7 +394,6 @@ CRCInput::~CRCInput() if(fd_event) ::close(fd_event); - close_click(); } /************************************************************************** @@ -1474,8 +1471,6 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 *msg = trkey; *data = 0; /* <- button pressed */ - if(g_settings.key_click) - play_click(); return; } } /*if keyok */ @@ -1780,27 +1775,6 @@ int CRCInput::translate(int code) return (int)RC_nokey; } -void CRCInput::close_click() -{ -} - -void CRCInput::open_click() -{ -} -#if 0 -//never used -void CRCInput::reset_dsp(int /*rate*/) -{ -} - -void CRCInput::set_dsp() -{ -} -#endif -void CRCInput::play_click() -{ -} - void CRCInput::setKeyRepeatDelay(unsigned int start_ms, unsigned int repeat_ms) { for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index 848e54cf6..37cfd4b8a 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -164,10 +164,8 @@ class CRCInput int fd_event; int fd_max; - int clickfd; __u16 rc_last_key; OpenThreads::Mutex mutex; - void set_dsp(); void open(bool recheck = false); bool checkpath(in_dev id); @@ -329,10 +327,6 @@ class CRCInput void clearRCMsg(); int messageLoop( bool anyKeyCancels = false, int timeout= -1 ); - void open_click(); - void close_click(); - void play_click(); - void reset_dsp(int rate); void setLongPressAny(bool b) { longPressAny = b; }; void setKeyRepeatDelay(unsigned int start_ms, unsigned int repeat_ms); diff --git a/src/gui/scan.cpp b/src/gui/scan.cpp index 5a6213853..d26ea9229 100644 --- a/src/gui/scan.cpp +++ b/src/gui/scan.cpp @@ -278,7 +278,6 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) success = false; if(!manual) { - g_RCInput->close_click(); if (my_system(NEUTRINO_SCAN_START_SCRIPT) != 0) perror(NEUTRINO_SCAN_START_SCRIPT " failed"); } @@ -344,7 +343,6 @@ int CScanTs::exec(CMenuTarget* /*parent*/, const std::string & actionKey) if(!manual) { if (my_system(NEUTRINO_SCAN_STOP_SCRIPT) != 0) perror(NEUTRINO_SCAN_STOP_SCRIPT " failed"); - g_RCInput->open_click(); } if(!test) { CComponentsHeaderLocalized header(x, y, width, hheight, success ? LOCALE_SCANTS_FINISHED : LOCALE_SCANTS_FAILED); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index a1ae72747..1844b0276 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -4386,7 +4386,6 @@ void CNeutrinoApp::loadKeys(const char * fname) /* options */ g_settings.menu_left_exit = tconfig.getInt32( "menu_left_exit", 0 ); - g_settings.key_click = tconfig.getInt32( "key_click", 1 ); g_settings.repeat_blocker = tconfig.getInt32("repeat_blocker", 150); g_settings.repeat_genericblocker = tconfig.getInt32("repeat_genericblocker", 100); g_settings.longkeypress_duration = tconfig.getInt32("longkeypress_duration", LONGKEYPRESS_OFF); @@ -4469,7 +4468,6 @@ void CNeutrinoApp::saveKeys(const char * fname) tconfig.setInt32( "key_pic_size_active", g_settings.key_pic_size_active ); tconfig.setInt32( "menu_left_exit", g_settings.menu_left_exit ); - tconfig.setInt32( "key_click", g_settings.key_click ); tconfig.setInt32( "repeat_blocker", g_settings.repeat_blocker ); tconfig.setInt32( "repeat_genericblocker", g_settings.repeat_genericblocker ); tconfig.setInt32( "longkeypress_duration", g_settings.longkeypress_duration ); diff --git a/src/system/settings.h b/src/system/settings.h index 2c91416f6..64b6423c4 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -504,7 +504,6 @@ struct SNeutrinoSettings int key_list_end; int key_power_off; int menu_left_exit; - int key_click; int timeshift_pause; int auto_timeshift; int temp_timeshift; From abe232fc6c5968859cf053013a6a80662b4cc006 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 22 Feb 2017 06:21:38 +0100 Subject: [PATCH 25/25] CRCInput::set_rc_hw: Fix device check for cs hd2 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5cac45ccb837955bd03b9b2cc41e415c983139d7 Author: Michael Liebmann Date: 2017-02-22 (Wed, 22 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/rcinput.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 6161fb941..b7974a09c 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -1822,7 +1822,11 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address) } int fd = -1; for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { - if ((*it).path == "/dev/input/nevis_ir") { + if (((*it).path == "/dev/input/nevis_ir") +#ifdef BOXMODEL_CS_HD2 + || ((*it).path == "/dev/input/input0") +#endif + ){ fd = (*it).fd; break; }