[chore] device/input: migrate custom event map to settings dir (#3822)

This commit is contained in:
Frans de Jonge
2018-04-03 20:28:37 +02:00
committed by GitHub
parent 086ced07f9
commit b4002dc9ce

View File

@@ -2,10 +2,11 @@
An interface to get input events.
]]
local DataStorage = require("datastorage")
local DEBUG = require("dbg")
local Event = require("ui/event")
local Key = require("device/key")
local GestureDetector = require("device/gesturedetector")
local Key = require("device/key")
local TimeVal = require("ui/timeval")
local framebuffer = require("ffi/framebuffer")
local input = require("ffi/input")
@@ -150,7 +151,9 @@ function Input:init()
self.event_map[10021] = "NotCharging"
-- user custom event map
local ok, custom_event_map = pcall(dofile, "custom.event.map.lua")
local custom_event_map_location = string.format(
"%s/%s", DataStorage:getSettingsDir(), "event_map.lua")
local ok, custom_event_map = pcall(dofile, custom_event_map_location)
if ok then
for key, value in pairs(custom_event_map) do
self.event_map[key] = value