From a5cff2c42b580946e0e75b2cbfc86c4ea0a7cf2f Mon Sep 17 00:00:00 2001 From: chrox Date: Thu, 6 Nov 2014 15:02:06 +0800 Subject: [PATCH] add user defined event map This should fix #1016. Usage for #1016: Create a file named "custom.event.map.lua" in the koreader directory with the following content: return { [102] = "LPgFwd", } --- frontend/device/input.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontend/device/input.lua b/frontend/device/input.lua index fbf27b3cf..aaae4c135 100644 --- a/frontend/device/input.lua +++ b/frontend/device/input.lua @@ -126,6 +126,15 @@ function Input:init() self.event_map[10001] = "OutOfSS" -- go out of screen saver self.event_map[10020] = "Charging" self.event_map[10021] = "NotCharging" + + -- user custom event map + local ok, custom_event_map = pcall(dofile, "custom.event.map.lua") + if ok then + DEBUG("custom event map", custom_event_map) + for key, value in pairs(custom_event_map) do + self.event_map[key] = value + end + end end --[[