Skip to content

Commit

Permalink
Merge pull request #47 from NiLuJe/pb-support
Browse files Browse the repository at this point in the history
PocketBook support
  • Loading branch information
NiLuJe authored Sep 19, 2020
2 parents 27fcd19 + deb3596 commit 956839a
Show file tree
Hide file tree
Showing 12 changed files with 902 additions and 49 deletions.
29 changes: 24 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,14 @@ ifndef CERVANTES
ifndef LEGACY
ifndef KINDLE
ifndef REMARKABLE
ifndef POCKETBOOK
KOBO=true
endif
endif
endif
endif
endif
endif

# Toggle Kindle support
ifdef KINDLE
Expand All @@ -260,6 +262,10 @@ endif
ifdef REMARKABLE
TARGET_CPPFLAGS+=-DFBINK_FOR_REMARKABLE
endif
# Toggle PocketBook support
ifdef POCKETBOOK
TARGET_CPPFLAGS+=-DFBINK_FOR_POCKETBOOK
endif

# And that should definitely be honored by everything, so, add it to EXTRA_CPPFLAGS
EXTRA_CPPFLAGS+=$(TARGET_CPPFLAGS)
Expand All @@ -284,8 +290,12 @@ ifdef FBINK_VERSION
ifdef REMARKABLE
LIB_CFLAGS+=-DFBINK_VERSION='"$(FBINK_VERSION) for reMarkable"'
else
# NOTE: Should never happen!
LIB_CFLAGS+=-DFBINK_VERSION='"$(FBINK_VERSION)"'
ifdef POCKETBOOK
LIB_CFLAGS+=-DFBINK_VERSION='"$(FBINK_VERSION) for PocketBook"'
else
# NOTE: Should never happen!
LIB_CFLAGS+=-DFBINK_VERSION='"$(FBINK_VERSION)"'
endif
endif
endif
endif
Expand Down Expand Up @@ -338,6 +348,12 @@ ifndef MINIMAL
#FEATURES_CPPFLAGS+=-DFBINK_QIS_NO_SIMD
endif

# We need libdl on PocketBook in order to dlopen InkView...
ifdef POCKETBOOK
LIBS+=-ldl
UTILS_LIBS+=-ldl
endif

##
# Now that we're done fiddling with flags, let's build stuff!
LIB_SRCS:=fbink.c cutef8/utf8.c cutef8/dfa.c
Expand Down Expand Up @@ -532,9 +548,9 @@ else
utils: | outdir
$(CC) $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(TOOLS_CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(SHARED_CFLAGS) $(LIB_CFLAGS) $(LTO_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -o$(OUT_DIR)/rota utils/rota.c
$(STRIP) --strip-unneeded $(OUT_DIR)/rota
$(CC) $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(TOOLS_CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(SHARED_CFLAGS) $(LIB_CFLAGS) $(LTO_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -o$(OUT_DIR)/fbdepth utils/fbdepth.c
$(CC) $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(TOOLS_CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(SHARED_CFLAGS) $(LIB_CFLAGS) $(LTO_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -o$(OUT_DIR)/fbdepth utils/fbdepth.c $(UTILS_LIBS)
$(STRIP) --strip-unneeded $(OUT_DIR)/fbdepth
$(CC) $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(DOOM_CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(SHARED_CFLAGS) $(LIB_CFLAGS) $(LTO_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -o$(OUT_DIR)/doom utils/doom.c -lrt
$(CC) $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(DOOM_CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) $(SHARED_CFLAGS) $(LIB_CFLAGS) $(LTO_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) -o$(OUT_DIR)/doom utils/doom.c -lrt $(UTILS_LIBS)
$(STRIP) --strip-unneeded $(OUT_DIR)/doom
endif

Expand Down Expand Up @@ -587,6 +603,9 @@ cervantes:
remarkable:
$(MAKE) strip REMARKABLE=true

pocketbook:
$(MAKE) strip POCKETBOOK=true

libunibreak.built:
mkdir -p LibUniBreakBuild
cd libunibreak && \
Expand Down Expand Up @@ -703,4 +722,4 @@ distclean: clean libunibreakclean
rm -rf LibUniBreakBuild
rm -rf libunibreak.built

.PHONY: default outdir all staticlib sharedlib static shared striplib striparchive stripbin strip debug static pic shared release kindle legacy cervantes linux armcheck kobo remarkable libunibreakclean utils alt dump clean distclean
.PHONY: default outdir all staticlib sharedlib static shared striplib striparchive stripbin strip debug static pic shared release kindle legacy cervantes linux armcheck kobo remarkable pocketbook libunibreakclean utils alt dump clean distclean
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This is intended to fill the void felt by Kobo developers and tinkerers when the
It's especially cruel when moving to a Kobo, after being used to the ubiquity of `eips` on Kindle...

In short, it prints messages or images on your screen, handling the low-level tinkering with both the Linux framebuffer interface, and the i.MX EPDC.
It's been tested on Kobo, Kindle, BQ Cervantes and reMarkable, but porting it to other Linux, i.MX eInk devices should be trivial (hell, even Sipix support shouldn't be too hard).
It's been tested on Kobo, Kindle, BQ Cervantes, reMarkable and PocketBook, but porting it to other Linux, i.MX eInk devices should be trivial (hell, even Sipix support shouldn't be too hard).

By default, text rendering relies on bundled fixed cell bitmap fonts ([see this post](https://www.mobileread.com/forums/showpost.php?p=3765426&postcount=31) for a small sampling),
but thanks to [@shermp](https://github.com/shermp)'s contributions ([#20](https://github.com/NiLuJe/FBInk/pull/20)), you can also rely on full-fledged TrueType/OpenType font rendering!
Expand Down Expand Up @@ -89,6 +89,7 @@ The choice of target platform is handled via a simple variable:
- Pass `KINDLE=1 LEGACY=1` to make for a FW 2.x Kindle build (`make legacy` does that on a stripped static build). This basically just disables CLOEXEC, which might not be supported on FW 2.x.
- Pass `CERVANTES=1` to make for a BQ/Cervantes build (`make cervantes` does that on a stripped static build).
- Pass `REMARKABLE=1` to make for a reMarkable build (`make remarkable` does that on a stripped static build).
- Pass `POCKETBOOK=1` to make for a PocketBook build (`make pocketbook` does that on a stripped static build).

The same logic is used to allow for a bit of tailoring:
- Pass `MINIMAL=1` to make for a build with limited functionality (only fixed cell font rendering, no image rendering, no extra fonts, no OpenType), which yields a much smaller application & library.
Expand Down
30 changes: 30 additions & 0 deletions eink/mxcfb-pocketbook-compat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2004-2013 Freescale Semiconductor, Inc. All Rights Reserved.
*/

/*
* The code contained herein is licensed under the GNU Lesser General
* Public License. You may obtain a copy of the GNU Lesser General
* Public License Version 2.1 or later at the following locations:
*
* http://www.opensource.org/licenses/lgpl-license.html
* http://www.gnu.org/copyleft/lgpl.html
*/

/*
* NOTE: Pulled from an EPDCv2 kernel, because we need those constants to build FBInk ;).
*/

#ifndef __ASM_ARCH_MXCFB_COMPAT_H__
#define __ASM_ARCH_MXCFB_COMPAT_H__

enum mxcfb_dithering_mode {
EPDC_FLAG_USE_DITHERING_PASSTHROUGH = 0x0,
EPDC_FLAG_USE_DITHERING_FLOYD_STEINBERG,
EPDC_FLAG_USE_DITHERING_ATKINSON,
EPDC_FLAG_USE_DITHERING_ORDERED,
EPDC_FLAG_USE_DITHERING_QUANT_ONLY,
PDC_FLAG_USE_DITHERING_MAX,
};

#endif // __ASM_ARCH_MXCFB_COMPAT_H__
Loading

0 comments on commit 956839a

Please sign in to comment.