Skip to content

Commit

Permalink
Add support for Pocketbook Color Lux (#732)
Browse files Browse the repository at this point in the history
deal with 24bit RGB framebuffer that are reported as 8bit
  • Loading branch information
thomasrebele authored and Frenzie committed Sep 30, 2018
1 parent 3de7d52 commit 0e7a6dc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ffi/framebuffer_linux.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ function framebuffer:init()
error("framebuffer model not supported");
end
-- Pocketbook Color Lux reports bits_per_pixel = 8, but actually uses an RGB24 framebuffer
if self.device:has3BytesWideFrameBuffer() then
vinfo.bits_per_pixel = 24
vinfo.xres = vinfo.xres / 3
end
self.data = C.mmap(nil,
self.fb_size,
bit.bor(C.PROT_READ, C.PROT_WRITE),
Expand All @@ -112,6 +118,8 @@ function framebuffer:init()
"can not mmap() framebuffer")
if vinfo.bits_per_pixel == 32 then
self.bb = BB.new(vinfo.xres, vinfo.yres, BB.TYPE_BBRGB32, self.data, finfo.line_length)
elseif vinfo.bits_per_pixel == 24 then
self.bb = BB.new(vinfo.xres, vinfo.yres, BB.TYPE_BBRGB24, self.data, finfo.line_length)
elseif vinfo.bits_per_pixel == 16 then
self.bb = BB.new(vinfo.xres, vinfo.yres, BB.TYPE_BBRGB16, self.data, finfo.line_length)
elseif vinfo.bits_per_pixel == 8 then
Expand Down
5 changes: 5 additions & 0 deletions ffi/framebuffer_mxcfb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ local function mxc_update(fb, update_ioctl, refarea, refresh_type, waveform_mode
return
end
-- Pocketbook Color Lux refreshes based on bytes (not based on pixel)
if fb.device:has3BytesWideFrameBuffer() then
w = w*3
end
-- NOTE: If we're trying to send a:
-- * true FULL update,
-- * GC16_FAST update (i.e., popping-up a menu),
Expand Down

0 comments on commit 0e7a6dc

Please sign in to comment.