diff --git a/frontend/device/kindle/device.lua b/frontend/device/kindle/device.lua index 387949bb4..59fe15d0c 100644 --- a/frontend/device/kindle/device.lua +++ b/frontend/device/kindle/device.lua @@ -1017,6 +1017,23 @@ local KindlePaperWhite5SE = Kindle:extend{ canDoSwipeAnimation = yes, } +local KindlePaperWhite6 = Kindle:extend{ + model = "KindlePaperWhite6", + isMTK = yes, + isTouchDevice = yes, + hasFrontlight = yes, + hasNaturalLight = yes, + -- NOTE: We *can* technically control both LEDs independently, + -- but the mix is device-specific, we don't have access to the LUT for the mix powerd is using, + -- and the widget is designed for the Kobo Aura One anyway, so, hahaha, nope. + hasNaturalLightMixer = yes, + display_dpi = 300, + -- NOTE: While hardware dithering (via MDP) should be a thing, it doesn't appear to do anything right now :/. + canHWDither = no, --- this is a guess i don't have a device to check + canDoSwipeAnimation = yes, + -- NOTE: Input device path is variable, see findInputDevices +} + local KindleBasic4 = Kindle:extend{ model = "KindleBasic4", isMTK = yes, @@ -1028,6 +1045,17 @@ local KindleBasic4 = Kindle:extend{ -- NOTE: Like the PW5, input device path is variable, see findInputDevices } +local KindleBasic5 = Kindle:extend{ + model = "KindleBasic5", + isMTK = yes, + isTouchDevice = yes, + hasFrontlight = yes, + display_dpi = 300, + canHWDither = no, --- this is a guess i don't have a device to check + canDoSwipeAnimation = yes, + -- NOTE: Like the PW5, input device path is variable, see findInputDevices +} + local KindleScribe = Kindle:extend{ model = "KindleScribe", isMTK = yes, @@ -1046,6 +1074,20 @@ local KindleScribe = Kindle:extend{ canDoSwipeAnimation = yes, } +local KindleColorSoft = Kindle:extend{ + model = "KindleColorSoft", + isMTK = yes, + isTouchDevice = yes, + hasFrontlight = yes, + hasNaturalLight = yes, + hasNaturalLightMixer = yes, + hasLightSensor = yes, + display_dpi = 300, + canHWDither = yes, + canDoSwipeAnimation = yes, + hasColorScreen = yes, +} + function Kindle2:init() self.screen = require("ffi/framebuffer_einkfb"):new{device = self, debug = logger.dbg} self.powerd = require("device/kindle/powerd"):new{ @@ -1581,6 +1623,23 @@ function KindlePaperWhite5:init() end KindlePaperWhite5SE.init = KindlePaperWhite5.init +function KindlePaperWhite6:init() + self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg} + self.powerd = require("device/kindle/powerd"):new{ + device = self, + fl_intensity_file = "/sys/class/backlight/fp9967-bl1/brightness", + warmth_intensity_file = "/sys/class/backlight/fp9967-bl0/brightness", --- guess based on colorsoft + batt_capacity_file = "/sys/class/power_supply/bd71827_bat/capacity", + is_charging_file = "/sys/class/power_supply/bd71827_bat/charging", + batt_status_file = "/sys/class/power_supply/bd71827_bat/status", + } + + -- Enable the so-called "fast" mode, so as to prevent the driver from silently promoting refreshes to REAGL. + self.screen:_MTK_ToggleFastMode(true) + + Kindle.init(self) +end + function KindleBasic4:init() self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg} self.powerd = require("device/kindle/powerd"):new{ @@ -1598,6 +1657,23 @@ function KindleBasic4:init() Kindle.init(self) end +function KindleBasic5:init() + self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg} + self.powerd = require("device/kindle/powerd"):new{ + device = self, + fl_intensity_file = "/sys/class/backlight/fp9967-bl1/brightness", + warmth_intensity_file = "/sys/class/backlight/fp9967-bl0/brightness", --- guess based on colorsoft + batt_capacity_file = "/sys/class/power_supply/bd71827_bat/capacity", + is_charging_file = "/sys/class/power_supply/bd71827_bat/charging", + batt_status_file = "/sys/class/power_supply/bd71827_bat/status", + } + + -- Enable the so-called "fast" mode, so as to prevent the driver from silently promoting refreshes to REAGL. + self.screen:_MTK_ToggleFastMode(true) + + Kindle.init(self) +end + function KindleScribe:init() -- temporarily wake up awesome if os.getenv("AWESOME_STOPPED") == "yes" then @@ -1660,6 +1736,25 @@ function KindleScribe:init() self.input.wacom_protocol = true end +function KindleColorSoft:init() + self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = logger.dbg} + self.powerd = require("device/kindle/powerd"):new{ + device = self, + fl_intensity_file = "/sys/class/backlight/fp9967-bl1/brightness", + warmth_intensity_file = "/sys/class/backlight/fp9967-bl0/brightness", + batt_capacity_file = "/sys/class/power_supply/bd71827_bat/capacity", + is_charging_file = "/sys/class/power_supply/bd71827_bat/charging", + batt_status_file = "/sys/class/power_supply/bd71827_bat/status", + hall_file = "/sys/devices/platform/eink_hall/hall_enable", + } + + -- Enable the so-called "fast" mode, so as to prevent the driver from silently promoting refreshes to REAGL. + self.screen:_MTK_ToggleFastMode(true) + + Kindle.init(self) +end + + function KindleTouch:exit() if self:isMTK() then -- Disable the so-called "fast" mode @@ -1705,8 +1800,11 @@ KindleBasic3.exit = KindleTouch.exit KindleOasis3.exit = KindleTouch.exit KindlePaperWhite5.exit = KindleTouch.exit KindlePaperWhite5SE.exit = KindleTouch.exit +KindlePaperWhite6.exit = KindleTouch.exit KindleBasic4.exit = KindleTouch.exit +KindleBasic5.exit = KindleTouch.exit KindleScribe.exit = KindleTouch.exit +KindleColorSoft.exit = KindleTouch.exit function Kindle3:exit() -- send double menu key press events to trigger screen refresh @@ -1764,6 +1862,9 @@ local pw5_set = Set { "1Q0", "1PX", "1VD", "21A", "2BJ", "2DK" } local pw5se_set = Set { "1LG", "219", "2BH" } local kt5_set = Set { "22D", "25T", "23A", "2AQ", "2AP", "1XH", "22C" } local ks_set = Set { "27J", "2BL", "263", "227", "2BM", "23L", "23M", "270" } +local kcs_set = Set { "3H2", "3H4", "3H6", "3H7", "3H9", "3JT", "3J6", "456", "34X", "3HB" } +local kt6_set = Set { "A89", "3L2", "3L3", "3L4", "3L5", "3L6", "3KM" } +local pw6_set = Set { "33W", "33X", "346", "349", "3H3", "3H5", "3H8", "3HA", "3J5", "3JS" } --- some of these are probably SE :/ if kindle_sn_lead == "B" or kindle_sn_lead == "9" then local kindle_devcode = string.sub(kindle_sn, 3, 4) @@ -1814,6 +1915,12 @@ else return KindleBasic4 elseif ks_set[kindle_devcode_v2] then return KindleScribe + elseif kcs_set[kindle_devcode_v2] then + return KindleColorSoft + elseif kt6_set[kindle_devcode_v2] then + return KindleBasic5 + elseif pw6_set[kindle_devcode_v2] then + return KindlePaperWhite6 end end