Browse Source

- add graphlcd and libiconv targets; rework target to build stripped down iconv binary

master
vanhofen 5 years ago
parent
commit
55b0ca0357
  1. 5
      make/neutrino-plugins.mk
  2. 4
      make/neutrino.mk
  3. 1
      make/ni.mk
  4. 78
      make/target-libs.mk
  5. 427
      patches/graphlcd/graphlcd-vuplus.patch
  6. 1195
      patches/graphlcd/graphlcd.patch

5
make/neutrino-plugins.mk

@ -31,6 +31,11 @@ NP_DEPS += luacurl
NP_DEPS += luaposix
NP_DEPS += lua-feedparser
# build only stripped down iconv binary if not exists the full-blown version
ifeq ($(wildcard $(TARGET_DIR)/bin/iconv),)
NP_DEPS += iconv-bin
endif
NP_CONFIGURE_ADDITIONS = \
--disable-logoupdater \
--disable-logoview \

4
make/neutrino.mk

@ -24,6 +24,10 @@ N_DEPS += openthreads
N_DEPS += pugixml
N_DEPS += zlib
ifeq ($(BOXMODEL), $(filter $(BOXMODEL), vusolo4k vuduo4k vuultimo4k vuuno4kse))
N_DEPS += graphlcd
endif
ifeq ($(BOXTYPE)-$(HAS_LIBCS), coolstream-yes)
N_DEPS += libcoolstream
endif

1
make/ni.mk

@ -55,7 +55,6 @@ ni-image:
$(MAKE) wpa_supplicant
$(MAKE) mtd-utils
$(MAKE) wget
$(MAKE) iconv
$(MAKE) streamripper
ifeq ($(BOXSERIES), $(filter $(BOXSERIES), hd2 hd51 vusolo4k vuduo4k vuultimo4k vuzero4k vuuno4k vuuno4kse vuduo))
$(MAKE) less

78
make/target-libs.mk

@ -1211,7 +1211,8 @@ ifeq ($(BOXSERIES), hd2)
GLIB2_DEPS += gettext
endif
GLIB2_CONF = $(if $(filter $(BOXSERIES), hd1), --enable-static --disable-shared)
GLIB2_CONF = $(if $(filter $(BOXSERIES), hd1),--enable-static --disable-shared)
GLIB2_CONF += $(if $(filter $(BOXSERIES), vusolo4k vuduo4k vuultimo4k vuuno4kse),--with-libiconv=gnu)
glib2: $(GLIB2_DEPS) $(ARCHIVE)/$(GLIB2_SOURCE) | $(TARGET_DIR)
$(REMOVE)/$(GLIB2_TMP)
@ -1328,7 +1329,7 @@ popt: $(ARCHIVE)/$(POPT_SOURCE) | $(TARGET_DIR)
# -----------------------------------------------------------------------------
LIBICONV_VER = 1.13.1
LIBICONV_VER = 1.15
LIBICONV_TMP = libiconv-$(LIBICONV_VER)
LIBICONV_SOURCE = libiconv-$(LIBICONV_VER).tar.gz
LIBICONV_URL = https://ftp.gnu.org/gnu/libiconv
@ -1336,15 +1337,46 @@ LIBICONV_URL = https://ftp.gnu.org/gnu/libiconv
$(ARCHIVE)/$(LIBICONV_SOURCE):
$(DOWNLOAD) $(LIBICONV_URL)/$(LIBICONV_SOURCE)
LIBICONV_PATCH = disable_transliterations.patch
LIBICONV_PATCH += strip_charsets.patch
# builds only stripped down iconv binary used for smarthomeinfo plugin
iconv: $(ARCHIVE)/$(LIBICONV_SOURCE) | $(TARGET_DIR)
libiconv: $(ARCHIVE)/$(LIBICONV_SOURCE) | $(TARGET_DIR)
$(REMOVE)/$(LIBICONV_TMP)
$(UNTAR)/$(LIBICONV_SOURCE)
$(CHDIR)/$(LIBICONV_TMP); \
$(call apply_patches, $(addprefix libiconv/,$(LIBICONV_PATCH))); \
sed -i -e '/preload/d' Makefile.in; \
$(CONFIGURE) CPPFLAGS="$(TARGET_CPPFLAGS) -fPIC" \
--target=$(TARGET) \
--prefix= \
--datarootdir=$(remove-datarootdir) \
--enable-static \
--disable-shared \
--enable-relocatable \
; \
$(MAKE); \
$(MAKE) install DESTDIR=$(TARGET_DIR)
$(REWRITE_LIBTOOL)/libcharset.la
$(REWRITE_LIBTOOL)/libiconv.la
$(REMOVE)/$(LIBICONV_TMP)
$(TOUCH)
# -----------------------------------------------------------------------------
LIBICONV-STRIPPED_VER = 1.13.1
LIBICONV-STRIPPED_TMP = libiconv-$(LIBICONV-STRIPPED_VER)
LIBICONV-STRIPPED_SOURCE = libiconv-$(LIBICONV-STRIPPED_VER).tar.gz
LIBICONV-STRIPPED_URL = https://ftp.gnu.org/gnu/libiconv
$(ARCHIVE)/$(LIBICONV-STRIPPED_SOURCE):
$(DOWNLOAD) $(LIBICONV-STRIPPED_URL)/$(LIBICONV-STRIPPED_SOURCE)
LIBICONV-STRIPPED_PATCH = disable_transliterations.patch
LIBICONV-STRIPPED_PATCH += strip_charsets.patch
# builds only stripped down iconv binary used by smarthomeinfo plugin
iconv-bin: $(ARCHIVE)/$(LIBICONV-STRIPPED_SOURCE) | $(TARGET_DIR)
$(REMOVE)/$(LIBICONV-STRIPPED_TMP)
$(UNTAR)/$(LIBICONV-STRIPPED_SOURCE)
$(CHDIR)/$(LIBICONV-STRIPPED_TMP); \
$(call apply_patches, $(addprefix libiconv/,$(LIBICONV-STRIPPED_PATCH))); \
sed -i -e '/preload/d' Makefile.in; \
$(CONFIGURE) \
--target=$(TARGET) \
--prefix= \
@ -1357,5 +1389,33 @@ iconv: $(ARCHIVE)/$(LIBICONV_SOURCE) | $(TARGET_DIR)
; \
$(MAKE); \
$(MAKE) install DESTDIR=$(TARGET_DIR)
$(REMOVE)/$(LIBICONV_TMP)
$(REMOVE)/$(LIBICONV-STRIPPED_TMP)
$(TOUCH)
# -----------------------------------------------------------------------------
GRAPHLCD_VER = git
GRAPHLCD_TMP = graphlcd-base.$(GRAPHLCD_VER)
GRAPHLCD_SOURCE = graphlcd-base.$(GRAPHLCD_VER)
GRAPHLCD_URL = git://projects.vdr-developer.org
GRAPHLCD_PATCH = graphlcd.patch
ifeq ($(BOXMODEL), $(filter $(BOXMODEL), vuduo4k vusolo4k vuultimo4k vuuno4kse))
GRAPHLCD_PATCH += graphlcd-vuplus.patch
endif
GRAPHLCD_DEPS = freetype libiconv libusb
graphlcd: $(GRAPHLCD_DEPS) | $(TARGET_DIR)
$(REMOVE)/$(GRAPHLCD_TMP)
$(GET-GIT-SOURCE) $(GRAPHLCD_URL)/$(GRAPHLCD_SOURCE) $(ARCHIVE)/$(GRAPHLCD_SOURCE)
$(CPDIR)/$(GRAPHLCD_TMP)
$(CHDIR)/$(GRAPHLCD_TMP); \
$(call apply_patches, $(addprefix $(@)/,$(GRAPHLCD_PATCH))); \
$(MAKE) -C glcdgraphics all TARGET=$(TARGET_CROSS) PREFIX= DESTDIR=$(TARGET_DIR); \
$(MAKE) -C glcddrivers all TARGET=$(TARGET_CROSS) PREFIX= DESTDIR=$(TARGET_DIR); \
$(MAKE) -C glcdgraphics install PREFIX= DESTDIR=$(TARGET_DIR); \
$(MAKE) -C glcddrivers install PREFIX= DESTDIR=$(TARGET_DIR); \
cp -a graphlcd.conf $(TARGET_DIR)/etc
$(REMOVE)/$(GRAPHLCD_TMP)
$(TOUCH)

427
patches/graphlcd/graphlcd-vuplus.patch

@ -0,0 +1,427 @@
--- a/glcddrivers/Makefile
+++ b/glcddrivers/Makefile
@@ -63,6 +63,11 @@
LIBS += -lwiringPi
endif
+ifeq ($(HAVE_DRIVER_VUPLUS4K), 1)
+ DEFINES += -DHAVE_DRIVER_VUPLUS4K
+ OBJS += vuplus4k.o
+endif
+
### Implicit rules:
%.o: %.c
--- a/glcddrivers/drivers.c
+++ b/glcddrivers/drivers.c
@@ -50,6 +50,9 @@
#ifdef HAVE_DRIVER_ILI9341
#include "ili9341.h"
#endif
+#ifdef HAVE_DRIVER_VUPLUS4K
+#include "vuplus4k.h"
+#endif
namespace GLCD
{
@@ -93,6 +96,9 @@
#endif
#ifdef HAVE_DRIVER_ILI9341
{"ili9341", kDriverILI9341},
+#endif
+#ifdef HAVE_DRIVER_VUPLUS4K
+ {"vuplus4k", kDriverVUPLUS4K},
#endif
{"", kDriverUnknown}
};
@@ -180,6 +186,10 @@
case kDriverILI9341:
return new cDriverILI9341(config);
#endif
+#ifdef HAVE_DRIVER_VUPLUS4K
+ case kDriverVUPLUS4K:
+ return new cDriverVUPLUS4K(config);
+#endif
case kDriverUnknown:
default:
return NULL;
--- a/glcddrivers/drivers.h
+++ b/glcddrivers/drivers.h
@@ -58,6 +58,9 @@
#endif
kDriverUSBserLCD = 23,
kDriverST7565RReel = 24,
+#ifdef HAVE_DRIVER_VUPLUS4K
+ kDriverVUPLUS4K = 25,
+#endif
kDriverSerDisp = 100,
kDriverG15daemon = 200
};
--- /dev/null
+++ b/glcddrivers/vuplus4k.c
@@ -0,0 +1,264 @@
+/*
+ * GraphLCD driver library
+ *
+ * vuplus4k.c - VUPLUS4K OLED driver class
+ *
+ * This file is released under the GNU General Public License. Refer
+ * to the COPYING file distributed with this package.
+ *
+ * (c) redblue 2019
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <string.h>
+#include <stdint.h>
+#include <syslog.h>
+#include <cstring>
+#include <byteswap.h>
+
+#include "common.h"
+#include "config.h"
+#include "vuplus4k.h"
+
+namespace GLCD
+{
+
+cDriverVUPLUS4K::cDriverVUPLUS4K(cDriverConfig * config)
+: cDriver(config),
+ fd(-1)
+{
+}
+
+cDriverVUPLUS4K::~cDriverVUPLUS4K()
+{
+ DeInit();
+}
+
+int lcd_read_value(const char *filename)
+{
+ int value = 0;
+ FILE *fd = fopen(filename, "r");
+ if (fd) {
+ int tmp;
+ if (fscanf(fd, "%x", &tmp) == 1)
+ value = tmp;
+ fclose(fd);
+ }
+ return value;
+}
+
+int cDriverVUPLUS4K::Init()
+{
+ int x;
+
+ width = config->width;
+ if (width <= 0)
+ width = lcd_read_value(XRES);
+
+ height = config->height;
+ if (height <= 0)
+ height = lcd_read_value(YRES);
+
+ bpp = lcd_read_value(BPP);
+
+ switch (bpp)
+ {
+ case 8:
+ stride_bpp_value = 1;
+ break;
+ case 15:
+ case 16:
+ stride_bpp_value = 2;
+ break;
+ case 24:
+ case 32:
+ stride_bpp_value = 4;
+ break;
+ default:
+ stride_bpp_value = (bpp + 7) / 8;
+ }
+
+ stride = width * stride_bpp_value;
+
+ for (unsigned int i = 0; i < config->options.size(); i++)
+ {
+ if (config->options[i].name == "")
+ {
+ }
+ }
+
+ if (config->device == "")
+ {
+ fd = open("/dev/dbox/lcd0", O_RDWR);
+ if (fd == -1)
+ fd = open("/dev/lcd0", O_RDWR);
+ if (fd == -1)
+ fd = open("/dev/dbox/oled0", O_RDWR);
+ if (fd == -1)
+ fd = open("/dev/oled0", O_RDWR);
+ }
+ else
+ {
+ fd = open(config->device.c_str(), O_RDWR);
+ }
+
+ if (fd == -1) {
+ printf("cannot open lcd device\n");
+ return -1;
+ }
+
+ int tmp = LCD_MODE_BIN;
+ if (ioctl(fd, LCD_IOCTL_ASC_MODE, &tmp)) {
+ printf("failed to set lcd bin mode\n");
+ }
+
+ newLCD = new uint16_t[height * stride];
+ if (newLCD)
+ memset(newLCD, 0, height * stride);
+ oldLCD = new uint16_t[height * stride];
+ if (oldLCD)
+ memset(oldLCD, 0, height * stride);
+
+ syslog(LOG_INFO, "%s: current lcd is %dx%d, %dbpp, vuplus4k lcd device was opened successfully\n", config->name.c_str(), width, height, bpp);
+
+ *oldConfig = *config;
+
+ // clear display
+ Clear();
+ //Refresh(true);
+
+ syslog(LOG_INFO, "%s: VUPLUS4K initialized.\n", config->name.c_str());
+ return 0;
+}
+
+int cDriverVUPLUS4K::DeInit()
+{
+ if (newLCD)
+ {
+ delete[] newLCD;
+ newLCD = 0;
+ }
+ if (oldLCD)
+ {
+ delete[] oldLCD;
+ oldLCD = 0;
+ }
+ if (-1 != fd)
+ {
+ close(fd);
+ fd=-1;
+ }
+ return 0;
+}
+
+int cDriverVUPLUS4K::CheckSetup()
+{
+ if (config->width != oldConfig->width ||
+ config->height != oldConfig->height)
+ {
+ DeInit();
+ Init();
+ return 0;
+ }
+
+ if (config->upsideDown != oldConfig->upsideDown ||
+ config->invert != oldConfig->invert)
+ {
+ oldConfig->upsideDown = config->upsideDown;
+ oldConfig->invert = config->invert;
+ return 1;
+ }
+ return 0;
+}
+
+void cDriverVUPLUS4K::Clear()
+{
+ memset(newLCD, 0, width * height);
+}
+
+void cDriverVUPLUS4K::SetPixel(int x, int y, uint32_t data)
+{
+ if (x >= width || y >= height)
+ return;
+
+ if (config->upsideDown)
+ {
+ x = width - 1 - x;
+ y = height - 1 - y;
+ }
+
+ uint32_t red, green, blue;
+ blue = (data & 0x000000FF) >> 0;
+ green = (data & 0x0000FF00) >> 8;
+ red = (data & 0x00FF0000) >> 16;
+
+ unsigned char* row_pointers_bit_shift = (unsigned char*) &newLCD[0];
+ int row_pointers_2_ptr = (y * width + x) * stride_bpp_value;
+
+ if (config->invert) {
+ blue = 255 - blue;
+ green = 255 - green;
+ red = 255 - red;
+ }
+
+ row_pointers_bit_shift[row_pointers_2_ptr+0]=blue;
+ row_pointers_bit_shift[row_pointers_2_ptr+1]=green;
+ row_pointers_bit_shift[row_pointers_2_ptr+2]=red;
+ row_pointers_bit_shift[row_pointers_2_ptr+3]=0xff;
+}
+
+void cDriverVUPLUS4K::Refresh(bool refreshAll)
+{
+ int i;
+ char fileName[256];
+ char str[32];
+ FILE * fp;
+ unsigned char c;
+
+ if (CheckSetup() > 0)
+ refreshAll = true;
+
+ for (i = 0; i < height * stride; i++)
+ {
+ if (newLCD[i] != oldLCD[i])
+ {
+ refreshAll = true;
+ break;
+ }
+ }
+
+ if (refreshAll)
+ {
+ for (i = 0; i < height * stride; i++)
+ {
+ oldLCD[i] = newLCD[i];
+ }
+ unsigned char* row_pointers_bit_shift = (unsigned char*) &newLCD[0];
+ {
+ write(fd, row_pointers_bit_shift, height * stride);
+ }
+ }
+}
+
+void cDriverVUPLUS4K::SetBrightness(unsigned int brightness)
+{
+ int value = 0;
+ value = 255 * brightness / 100;
+
+ FILE *f = fopen("/proc/stb/lcd/oled_brightness", "w");
+ if (!f)
+ f = fopen("/proc/stb/fp/oled_brightness", "w");
+ if (f)
+ {
+ if (fprintf(f, "%d", value) == 0)
+ printf("write /proc/stb/lcd/oled_brightness failed!! (%m)\n");
+ fclose(f);
+ }
+}
+
+} // end of namespace
--- /dev/null
+++ b/glcddrivers/vuplus4k.h
@@ -0,0 +1,64 @@
+/*
+ * GraphLCD driver library
+ *
+ * vuplus4k.c - VUPLUS4K OLED driver class
+ *
+ * This file is released under the GNU General Public License. Refer
+ * to the COPYING file distributed with this package.
+ *
+ * (c) redblue
+ */
+
+
+#ifndef _GLCDDRIVERS_VUPLUS4K_H_
+#define _GLCDDRIVERS_VUPLUS4K_H_
+
+#include "driver.h"
+
+namespace GLCD
+{
+
+#define XRES "/proc/stb/lcd/xres"
+#define YRES "/proc/stb/lcd/yres"
+#define BPP "/proc/stb/lcd/bpp"
+
+#ifndef LCD_IOCTL_ASC_MODE
+#define LCDSET 0x1000
+#define LCD_IOCTL_ASC_MODE (21|LCDSET)
+#define LCD_MODE_ASC 0
+#define LCD_MODE_BIN 1
+#endif
+
+#define FP_IOCTL_LCD_DIMM 3
+
+class cDriverConfig;
+
+class cDriverVUPLUS4K : public cDriver
+{
+private:
+ int fd;
+ uint16_t * newLCD;
+ uint16_t * oldLCD;
+ int bpp;
+ int stride;
+ int stride_bpp_value;
+
+ int CheckSetup();
+
+public:
+ cDriverVUPLUS4K(cDriverConfig * config);
+ virtual ~cDriverVUPLUS4K();
+
+ virtual int Init();
+ virtual int DeInit();
+
+ virtual void Clear();
+ virtual void SetPixel(int x, int y, uint32_t data);
+ //virtual void Set8Pixels(int x, int y, unsigned char data);
+ virtual void Refresh(bool refreshAll = false);
+ virtual void SetBrightness(unsigned int percent);
+};
+
+} // end of namespace
+
+#endif
--- a/Make.config
+++ b/Make.config
@@ -83,3 +83,6 @@
#HAVE_DRIVER_SSD1306=1
#HAVE_DRIVER_ILI9341=1
+
+# uncomment this variable if you want to enable the experimental support for vuplus4k
+HAVE_DRIVER_VUPLUS4K=1
--- a/README
+++ b/README
@@ -28,6 +28,7 @@
futaba md166 driver by Andreas Brachold <vdr07 AT deltab de>
usbserlcd driver by Manuel Reimer <manuel.reimer AT gmx.de>
st7565r-reel driver by Georg Acher, BayCom GmbH based on simlcd.c by Carsten Siebholz, ported by Ufuk Altinkaynak
+ vuplus4k oled driver by redblue <redblue.pkt at orange pl>
Project's homepage: https://projects.vdr-developer.org/projects/graphlcd-base
GIT repo: https://projects.vdr-developer.org/git/graphlcd-base.git
--- a/graphlcd.conf
+++ b/graphlcd.conf
@@ -117,6 +117,12 @@
########################################################################
+[vuplus4k]
+# Driver setting for the OLED VUPLUS4K
+Driver=vuplus4k
+#Width=480
+#Height=320
+#
[ax206dpf]
# THIS IS AN EXPERIMENTAL DRIVER!
# You have to uncomment the variable HAVE_DRIVER_AX206DPF

1195
patches/graphlcd/graphlcd.patch

File diff suppressed because it is too large
Loading…
Cancel
Save