Skip to content

Commit

Permalink
Fix grabbing input device and fix brightness ( at least for the nia )
Browse files Browse the repository at this point in the history
  • Loading branch information
Szybet committed Oct 7, 2023
1 parent 665f98a commit ec015f7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion koreader/ffi/linux_input_h.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
local ffi = require("ffi")

-- I removed grabber

ffi.cdef[[
static const int EVIOCGRAB = 1074021776;
static const int EVIOCGREP = 2148025603;
static const int EVIOCSREP = 1074283779;
static const int EV_SYN = 0;
Expand Down
7 changes: 7 additions & 0 deletions koreader/frontend/device/kobo/device.lua
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@ local KoboLuna = Kobo:extend{
isMk7 = yes,
canToggleChargingLED = yes,
hasFrontlight = yes,
frontlight_settings = {
frontlight_white = "/sys/class/backlight/mxc_msp430.0/brightness",
frontlight_mixer = "/sys/class/backlight/lm3630a_led/color",
nl_min = 0,
nl_max = 100,
nl_inverted = false,
},
touch_phoenix_protocol = true,
display_dpi = 212,
hasReliableMxcWaitFor = no, -- Board is similar to the Libra 2, but it's such an unpopular device that reports are scarce.
Expand Down
4 changes: 1 addition & 3 deletions koreader/frontend/device/kobo/powerd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ function KoboPowerD:init()
if self.device:hasNaturalLightMixer() then
local kobolight = require("ffi/kobolight")
local ok, light = pcall(kobolight.open)
if ok then
self.device.frontlight_settings.frontlight_ioctl = light
end
end
self.fl = SysfsLight:new(self.device.frontlight_settings)
self.fl_warmth = 0
Expand Down Expand Up @@ -193,6 +190,7 @@ function KoboPowerD:init()
-- we jump through a couple of hoops in turnOnFrontlightHW to recover from the first quirky toggle...
end
end
self.fl = SysfsLight:new(self.device.frontlight_settings)
end

function KoboPowerD:saveSettings()
Expand Down
4 changes: 0 additions & 4 deletions koreader/frontend/device/sysfs_light.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ function SysfsLight:setNaturalBrightness(brightness, warmth)
if self.frontlight_mixer then
if set_brightness then
-- Prefer the ioctl, as it's much lower latency.
if self.frontlight_ioctl then
self.frontlight_ioctl:setBrightness(brightness)
else
ffiUtil.writeToSysfs(brightness, self.frontlight_white)
end
end
-- The mixer might be using inverted values... (cold is nl_max, warm is nl_min)
if set_warmth then
Expand Down
3 changes: 3 additions & 0 deletions koreader/koreader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export EXT_FONT_DIR="/system-lib/qt/lib/fonts/"

export LD_LIBRARY_PATH="/system-lib/lib/:/app-bin/koreader/libs/"

# Prevent grab
export KO_DONT_GRAB_INPUT="true"

# check whether PLATFORM & PRODUCT have a value assigned by rcS
if [ -z "${PRODUCT}" ]; then
# shellcheck disable=SC2046
Expand Down

0 comments on commit ec015f7

Please sign in to comment.