From b238e0307e98aea2d5a93d929d156754ef775f5a Mon Sep 17 00:00:00 2001 From: Janos Kovacs Date: Sun, 29 Dec 2013 18:02:56 +0200 Subject: [PATCH] config: work properly if the AMB plugin were not loaded or failed to initialize Change-Id: I42cb789b669e7ed6bfb08685782d66a181d35ab9 --- packaging.in/murphy.lua | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/packaging.in/murphy.lua b/packaging.in/murphy.lua index 17a70ff..d2892de 100644 --- a/packaging.in/murphy.lua +++ b/packaging.in/murphy.lua @@ -1,4 +1,5 @@ with_system_controller = true +with_amb = false verbose = 0 m = murphy.get() @@ -45,7 +46,13 @@ end -- load the AMB plugin if m:plugin_exists('amb') then - m:load_plugin('amb') + m:try_load_plugin('amb') + + if builtin.method.amb_initiate and + builtin.method.amb_update + then + with_amb = true + end else m:info("No amb plugin found...") end @@ -321,14 +328,16 @@ mdb.select { condition = "id = 0" } -sink.lua { - name = "night_mode", - inputs = { owner = mdb.select.select_night_mode }, - property = "NightMode", - type = "b", - initiate = builtin.method.amb_initiate, - update = builtin.method.amb_update -} +if with_amb then + sink.lua { + name = "night_mode", + inputs = { owner = mdb.select.select_night_mode }, + property = "NightMode", + type = "b", + initiate = builtin.method.amb_initiate, + update = builtin.method.amb_update + } +end -- Driving mode processing chain @@ -378,14 +387,16 @@ mdb.select { condition = "id = 0" } -sink.lua { - name = "driving_mode", - inputs = { owner = mdb.select.select_driving_mode }, - property = "DrivingMode", - type = "u", - initiate = builtin.method.amb_initiate, - update = builtin.method.amb_update -} +if with_amb then + sink.lua { + name = "driving_mode", + inputs = { owner = mdb.select.select_driving_mode }, + property = "DrivingMode", + type = "u", + initiate = builtin.method.amb_initiate, + update = builtin.method.amb_update + } +end -- turn signals (left, right) -- 2.7.4