# HG changeset patch # User Paul Boddie # Date 1527886382 -7200 # Node ID 5c569c381a4ef054939bfa537e4938b59a5714f3 # Parent 3e5480ff13ca775d41b1b619f6c63f92359d7f03 Introduced keypad libraries that are loaded in a similar way to the panel libraries, permitting the input keypad server to be generic instead of having to exist in specific forms for different devices. Introduced a convenience "loader" library to obtain keypad object references from loaded libraries. diff -r 3e5480ff13ca -r 5c569c381a4e README.txt --- a/README.txt Fri Jun 01 22:47:51 2018 +0200 +++ b/README.txt Fri Jun 01 22:53:02 2018 +0200 @@ -208,6 +208,12 @@ fb-drv <- mips-jz4740-panel.txt Library details \-> ... Library with panel data +This method of obtaining a configured library name in order to load it +dynamically is effectively equivalent to having a symbolic link identifying +the library referencing the desired, specific library to be used. Since the +"rom" virtual filesystem does not appear to support symbolic links, this +method is used instead. + By providing well-defined interfacing mechanisms, the behaviour of driver code can be parameterised using external components, and a proliferation of specially-constructed device drivers is hopefully avoided. diff -r 3e5480ff13ca -r 5c569c381a4e conf/landfall-examples/input-keypad.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/conf/landfall-examples/input-keypad.txt Fri Jun 01 22:53:02 2018 +0200 @@ -0,0 +1,1 @@ +libkeypad_qi_lb60.so \ No newline at end of file diff -r 3e5480ff13ca -r 5c569c381a4e conf/landfall-examples/mips-letux400-input-event-client.cfg --- a/conf/landfall-examples/mips-letux400-input-event-client.cfg Fri Jun 01 22:47:51 2018 +0200 +++ b/conf/landfall-examples/mips-letux400-input-event-client.cfg Fri Jun 01 22:53:02 2018 +0200 @@ -132,7 +132,7 @@ ev = ev:svr(), }, }, - "rom/dev_input_keypad_letux400"); + "rom/dev_input_keypad"); -- Show key event values. diff -r 3e5480ff13ca -r 5c569c381a4e conf/landfall-examples/mips-letux400-input-event-client.list --- a/conf/landfall-examples/mips-letux400-input-event-client.list Fri Jun 01 22:47:51 2018 +0200 +++ b/conf/landfall-examples/mips-letux400-input-event-client.list Fri Jun 01 22:53:02 2018 +0200 @@ -18,7 +18,9 @@ module dev_display_letux400 module dev_cpm_jz4730 module dev_keypad_letux400 -module dev_input_keypad_letux400 +module dev_input_keypad module ex_input_event_client module libpanel_letux400.so module mips-jz4740-panel.txt +module libkeypad_letux400.so +module input-keypad.txt diff -r 3e5480ff13ca -r 5c569c381a4e conf/landfall-examples/mips-letux400-keypad-demo.cfg --- a/conf/landfall-examples/mips-letux400-keypad-demo.cfg Fri Jun 01 22:47:51 2018 +0200 +++ b/conf/landfall-examples/mips-letux400-keypad-demo.cfg Fri Jun 01 22:53:02 2018 +0200 @@ -152,7 +152,7 @@ ev = ev1:svr(), }, }, - "rom/dev_input_keypad_letux400"); + "rom/dev_input_keypad"); -- Show key event values. @@ -174,7 +174,7 @@ ev = ev2:svr(), }, }, - "rom/dev_input_keypad_letux400"); + "rom/dev_input_keypad"); -- Show key strings. diff -r 3e5480ff13ca -r 5c569c381a4e conf/landfall-examples/mips-letux400-keypad-demo.list --- a/conf/landfall-examples/mips-letux400-keypad-demo.list Fri Jun 01 22:47:51 2018 +0200 +++ b/conf/landfall-examples/mips-letux400-keypad-demo.list Fri Jun 01 22:53:02 2018 +0200 @@ -18,10 +18,12 @@ module dev_display_letux400 module dev_cpm_jz4730 module dev_keypad_letux400 -module dev_input_keypad_letux400 +module dev_input_keypad module ex_input_event_client module ex_keypad_ds_client module ex_letux400_backlight module ex_letux400_keypad_physical module libpanel_letux400.so module mips-jz4740-panel.txt +module libkeypad_letux400.so +module input-keypad.txt diff -r 3e5480ff13ca -r 5c569c381a4e conf/landfall-examples/mips-qi_lb60-input-event-client.cfg --- a/conf/landfall-examples/mips-qi_lb60-input-event-client.cfg Fri Jun 01 22:47:51 2018 +0200 +++ b/conf/landfall-examples/mips-qi_lb60-input-event-client.cfg Fri Jun 01 22:53:02 2018 +0200 @@ -130,7 +130,7 @@ ev = ev:svr(), }, }, - "rom/dev_input_keypad_qi_lb60"); + "rom/dev_input_keypad"); -- Show key event values. diff -r 3e5480ff13ca -r 5c569c381a4e conf/landfall-examples/mips-qi_lb60-input-event-client.list --- a/conf/landfall-examples/mips-qi_lb60-input-event-client.list Fri Jun 01 22:47:51 2018 +0200 +++ b/conf/landfall-examples/mips-qi_lb60-input-event-client.list Fri Jun 01 22:53:02 2018 +0200 @@ -18,7 +18,9 @@ module dev_display_qi_lb60 module dev_cpm_jz4740 module dev_keypad_qi_lb60 -module dev_input_keypad_qi_lb60 +module dev_input_keypad module ex_input_event_client module libpanel_qi_lb60.so module mips-jz4740-panel.txt +module libkeypad_qi_lb60.so +module input-keypad.txt diff -r 3e5480ff13ca -r 5c569c381a4e conf/landfall-examples/mips-qi_lb60-keypad-demo.cfg --- a/conf/landfall-examples/mips-qi_lb60-keypad-demo.cfg Fri Jun 01 22:47:51 2018 +0200 +++ b/conf/landfall-examples/mips-qi_lb60-keypad-demo.cfg Fri Jun 01 22:53:02 2018 +0200 @@ -150,7 +150,7 @@ ev = ev1:svr(), }, }, - "rom/dev_input_keypad_qi_lb60"); + "rom/dev_input_keypad"); -- Show key event values. @@ -172,7 +172,7 @@ ev = ev2:svr(), }, }, - "rom/dev_input_keypad_qi_lb60"); + "rom/dev_input_keypad"); -- Show key strings. diff -r 3e5480ff13ca -r 5c569c381a4e conf/landfall-examples/mips-qi_lb60-keypad-demo.list --- a/conf/landfall-examples/mips-qi_lb60-keypad-demo.list Fri Jun 01 22:47:51 2018 +0200 +++ b/conf/landfall-examples/mips-qi_lb60-keypad-demo.list Fri Jun 01 22:53:02 2018 +0200 @@ -18,10 +18,12 @@ module dev_display_qi_lb60 module dev_cpm_jz4740 module dev_keypad_qi_lb60 -module dev_input_keypad_qi_lb60 +module dev_input_keypad module ex_input_event_client module ex_keypad_ds_client module ex_qi_lb60_keypad_physical module ex_qi_lb60_backlight module libpanel_qi_lb60.so module mips-jz4740-panel.txt +module libkeypad_qi_lb60.so +module input-keypad.txt diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/Control --- a/pkg/devices/Control Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/Control Fri Jun 01 22:53:02 2018 +0200 @@ -6,8 +6,7 @@ provides: devices-display-letux400 provides: devices-display-qi_lb60 provides: devices-fb-jz4740 -provides: devices-input-keypad-letux400 -provides: devices-input-keypad-qi_lb60 +provides: devices-input-keypad-server provides: devices-keypad-letux400 provides: devices-keypad-qi_lb60 provides: devices-pwm-jz4730 @@ -24,7 +23,6 @@ provides: libdevice-input-event-client provides: libdevice-input-event-ops provides: libdevice-input-keypad -provides: libdevice-input-keypad-server provides: libdevice-keypad-client provides: libdevice-keypad-ops provides: libdevice-keypad-server @@ -37,8 +35,9 @@ provides: libdrivers-cpm provides: libdrivers-gpio provides: libdrivers-i2c -provides: libdrivers-keypad +provides: libdrivers-keypad-headers provides: libdrivers-keypad-letux400 +provides: libdrivers-keypad-loader provides: libdrivers-keypad-qi_lb60 provides: libdrivers-lcd-headers provides: libdrivers-lcd-jz4740 diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/input/include/input-event-server.h --- a/pkg/devices/input/include/input-event-server.h Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/input/include/input-event-server.h Fri Jun 01 22:53:02 2018 +0200 @@ -59,5 +59,3 @@ }; #endif - -int run(void); diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/input/src/Makefile --- a/pkg/devices/input/src/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/input/src/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -1,10 +1,8 @@ PKGDIR ?= ../.. L4DIR ?= $(PKGDIR)/../.. -TARGET := client keypad letux400 qi_lb60 server +TARGET := client keypad server include $(L4DIR)/mk/subdir.mk -letux400: server -qi_lb60: server server: keypad diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/input/src/client/Makefile --- a/pkg/devices/input/src/client/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/input/src/client/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -8,6 +8,6 @@ PRIVATE_INCDIR += $(PKGDIR)/input/include -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-util +REQUIRES_LIBS := l4re_c l4re_c-util libdrivers-keypad-headers libdevice-util include $(L4DIR)/mk/lib.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/input/src/keypad/Makefile --- a/pkg/devices/input/src/keypad/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/input/src/keypad/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -8,6 +8,6 @@ PRIVATE_INCDIR += $(PKGDIR)/input/include -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-keypad-client libdrivers-keypad +REQUIRES_LIBS := l4re_c l4re_c-util libdrivers-keypad-headers libdevice-keypad-client include $(L4DIR)/mk/lib.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/input/src/letux400/Makefile --- a/pkg/devices/input/src/letux400/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -PKGDIR ?= ../../.. -L4DIR ?= $(PKGDIR)/../.. - -TARGET = dev_input_keypad_letux400 -PC_FILENAME := devices-input-keypad-letux400 - -SRC_CC := input-keypad-letux400.cc - -PRIVATE_INCDIR += $(PKGDIR)/input/include - -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-input-keypad-server libdrivers-keypad-letux400 - -include $(L4DIR)/mk/prog.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/input/src/letux400/input-keypad-letux400.cc --- a/pkg/devices/input/src/letux400/input-keypad-letux400.cc Fri Jun 01 22:47:51 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * Export the keypad for the Letux 400 via the "ev" capability. - * - * Copyright (C) 2018 Paul Boddie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA - */ - -#include "input-event-server.h" - -/* Main program. */ - -int main() -{ - return run(); -} diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/input/src/qi_lb60/Makefile --- a/pkg/devices/input/src/qi_lb60/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -PKGDIR ?= ../../.. -L4DIR ?= $(PKGDIR)/../.. - -TARGET = dev_input_keypad_qi_lb60 -PC_FILENAME := devices-input-keypad-qi_lb60 - -SRC_CC := input-keypad-qi_lb60.cc - -PRIVATE_INCDIR += $(PKGDIR)/input/include - -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-input-keypad-server libdrivers-keypad-qi_lb60 - -include $(L4DIR)/mk/prog.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/input/src/qi_lb60/input-keypad-qi_lb60.cc --- a/pkg/devices/input/src/qi_lb60/input-keypad-qi_lb60.cc Fri Jun 01 22:47:51 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * Export the keypad for the Ben NanoNote via the "ev" capability. - * - * Copyright (C) 2018 Paul Boddie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA - */ - -#include "input-event-server.h" - -/* Main program. */ - -int main() -{ - return run(); -} diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/input/src/server/Makefile --- a/pkg/devices/input/src/server/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/input/src/server/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -1,13 +1,13 @@ PKGDIR ?= ../../.. L4DIR ?= $(PKGDIR)/../.. -TARGET = libdevice_input_keypad_server.o.a -PC_FILENAME := libdevice-input-keypad-server +TARGET = dev_input_keypad +PC_FILENAME := devices-input-keypad-server SRC_CC := input-keypad-server.cc PRIVATE_INCDIR += $(PKGDIR)/input/include -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-input-keypad libdevice-util +REQUIRES_LIBS := l4re_c l4re_c-util libdevice-input-keypad libdrivers-keypad-loader libdevice-util -include $(L4DIR)/mk/lib.mk +include $(L4DIR)/mk/prog.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/input/src/server/input-keypad-server.cc --- a/pkg/devices/input/src/server/input-keypad-server.cc Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/input/src/server/input-keypad-server.cc Fri Jun 01 22:53:02 2018 +0200 @@ -20,6 +20,7 @@ */ #include +#include #include "input-event-client.h" #include "input-event-server.h" #include "input-event-ops.h" @@ -38,6 +39,8 @@ #include #include +#include + /* Extract a fpage from the message buffers. Provide a Snd_fpage reference for modification. */ @@ -151,9 +154,11 @@ -int run(void) +int main(void) { - Keypad *keypad = Keypad::get_keypad(); + // Load the keypad details from the configured library. + + Keypad *keypad = load_keypad(); Input_keypad_client client(keypad); void *buffer; diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/include/Makefile --- a/pkg/devices/lib/keypad/include/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/lib/keypad/include/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -1,4 +1,6 @@ PKGDIR = ../../.. L4DIR ?= $(PKGDIR)/../.. +PC_FILENAME := libdrivers-keypad-headers + include $(L4DIR)/mk/include.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/include/keypad-common.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/lib/keypad/include/keypad-common.h Fri Jun 01 22:53:02 2018 +0200 @@ -0,0 +1,54 @@ +/* + * Common functions for keypad description access. These are provided in a + * header file for convenient incorporation into libraries without worrying + * about linkage, symbol visibility, and so on. + * + * Copyright (C) 2018 Paul Boddie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA + */ + +#pragma once + +#include "keypad.h" + +/* Obtain the common instance. */ + +void *keypad_get(void) +{ + return reinterpret_cast(Keypad::get_keypad()); +} + +/* Number of keypad columns. */ + +int keypad_columns(void *keypad) +{ + return static_cast(keypad)->columns(); +} + +/* Number of keypad rows, used by each value in the column array. */ + +int keypad_rows(void *keypad) +{ + return static_cast(keypad)->rows(); +} + +/* Keycode accessors. */ + +int keypad_code(void *keypad, int column, int row) +{ + return static_cast(keypad)->code(column, row); +} diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/include/keypad-loader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/lib/keypad/include/keypad-loader.h Fri Jun 01 22:53:02 2018 +0200 @@ -0,0 +1,26 @@ +/* + * Client access to keypad libraries. + * + * Copyright (C) 2018 Paul Boddie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA + */ + +#pragma once + +#include "keypad.h" + +Keypad *load_keypad(); diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/src/Makefile --- a/pkg/devices/lib/keypad/src/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/lib/keypad/src/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -1,6 +1,6 @@ PKGDIR ?= ../../.. L4DIR ?= $(PKGDIR)/../.. -TARGET := common letux400 qi_lb60 +TARGET := letux400 loader qi_lb60 include $(L4DIR)/mk/subdir.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/src/common/Makefile --- a/pkg/devices/lib/keypad/src/common/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -PKGDIR ?= ../../../.. -L4DIR ?= $(PKGDIR)/../.. - -TARGET = libkeypad.o.a -PC_FILENAME := libdrivers-keypad - -SRC_CC := keypad.cc - -PRIVATE_INCDIR += $(PKGDIR)/lib/keypad/include - -REQUIRES_LIBS := l4re_c l4re_c-util - -include $(L4DIR)/mk/lib.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/src/common/keypad.cc --- a/pkg/devices/lib/keypad/src/common/keypad.cc Fri Jun 01 22:47:51 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * General keypad mapping support. - * - * Copyright (C) 2018 Paul Boddie - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA - */ - -#include "keypad.h" - -/* Obtain the common instance. */ - -void *keypad_get(void) -{ - return reinterpret_cast(Keypad::get_keypad()); -} - -/* Number of keypad columns. */ - -int keypad_columns(void *keypad) -{ - return static_cast(keypad)->columns(); -} - -/* Number of keypad rows, used by each value in the column array. */ - -int keypad_rows(void *keypad) -{ - return static_cast(keypad)->rows(); -} - -/* Keycode accessors. */ - -int keypad_code(void *keypad, int column, int row) -{ - return static_cast(keypad)->code(column, row); -} diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/src/letux400/Makefile --- a/pkg/devices/lib/keypad/src/letux400/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/lib/keypad/src/letux400/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -1,13 +1,11 @@ PKGDIR ?= ../../../.. L4DIR ?= $(PKGDIR)/../.. -TARGET = libkeypad_letux400.o.a +TARGET = libkeypad_letux400.so PC_FILENAME := libdrivers-keypad-letux400 SRC_CC := keypad-letux400.cc PRIVATE_INCDIR += $(PKGDIR)/lib/keypad/include -REQUIRES_LIBS := l4re_c l4re_c-util - include $(L4DIR)/mk/lib.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/src/letux400/keypad-letux400.cc --- a/pkg/devices/lib/keypad/src/letux400/keypad-letux400.cc Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/lib/keypad/src/letux400/keypad-letux400.cc Fri Jun 01 22:53:02 2018 +0200 @@ -20,6 +20,7 @@ */ #include "keypad.h" +#include "keypad-common.h" #include enum Jz4730_keypad_gpio diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/src/loader/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/lib/keypad/src/loader/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -0,0 +1,12 @@ +PKGDIR ?= ../../../.. +L4DIR ?= $(PKGDIR)/../.. + +TARGET = libkeypad_loader.a +PC_FILENAME := libdrivers-keypad-loader + +SRC_CC := keypad-loader.cc +REQUIRES_LIBS := libdevice-util + +PRIVATE_INCDIR += $(PKGDIR)/lib/keypad/include + +include $(L4DIR)/mk/lib.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/src/loader/keypad-loader.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pkg/devices/lib/keypad/src/loader/keypad-loader.cc Fri Jun 01 22:53:02 2018 +0200 @@ -0,0 +1,38 @@ +/* + * Client functionality for keypad library access. + * + * Copyright (C) 2018 Paul Boddie + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA + */ + +#include +#include "keypad.h" +#include "keypad-loader.h" + +Keypad *load_keypad() +{ + // Load the keypad library using details in the specified file. + + void *(*keypad_get)(void); + + keypad_get = (void *(*)(void)) load_function("rom/input-keypad.txt", "keypad_get"); + if (!keypad_get) return 0; + + // Return the keypad details. + + return (Keypad *) keypad_get(); +} diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/src/qi_lb60/Makefile --- a/pkg/devices/lib/keypad/src/qi_lb60/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/lib/keypad/src/qi_lb60/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -1,13 +1,11 @@ PKGDIR ?= ../../../.. L4DIR ?= $(PKGDIR)/../.. -TARGET = libkeypad_qi_lb60.o.a +TARGET = libkeypad_qi_lb60.so PC_FILENAME := libdrivers-keypad-qi_lb60 SRC_CC := keypad-qi_lb60.cc PRIVATE_INCDIR += $(PKGDIR)/lib/keypad/include -REQUIRES_LIBS := l4re_c l4re_c-util - include $(L4DIR)/mk/lib.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/devices/lib/keypad/src/qi_lb60/keypad-qi_lb60.cc --- a/pkg/devices/lib/keypad/src/qi_lb60/keypad-qi_lb60.cc Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/devices/lib/keypad/src/qi_lb60/keypad-qi_lb60.cc Fri Jun 01 22:53:02 2018 +0200 @@ -20,6 +20,7 @@ */ #include "keypad.h" +#include "keypad-common.h" #include enum Jz4740_keypad_gpio diff -r 3e5480ff13ca -r 5c569c381a4e pkg/landfall-examples/letux400_backlight/Makefile --- a/pkg/landfall-examples/letux400_backlight/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/landfall-examples/letux400_backlight/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -3,6 +3,6 @@ TARGET = ex_letux400_backlight SRC_CC = letux400_backlight.cc -REQUIRES_LIBS = libio l4re_c-util libdevice-backlight-client libdevice-input-keypad libdrivers-keypad-letux400 +REQUIRES_LIBS = l4re_c-util libdevice-backlight-client libdevice-input-keypad libdrivers-keypad-loader libdevice-util include $(L4DIR)/mk/prog.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/landfall-examples/letux400_backlight/letux400_backlight.cc --- a/pkg/landfall-examples/letux400_backlight/letux400_backlight.cc Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/landfall-examples/letux400_backlight/letux400_backlight.cc Fri Jun 01 22:53:02 2018 +0200 @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -28,6 +29,8 @@ #include #include +#include + /* Backlight level. */ enum Letux400_backlight_levels @@ -93,7 +96,9 @@ int main(void) { - Keypad *keypad = Keypad::get_keypad(); + /* Load the keypad library using details from the configured library. */ + + Keypad *keypad = (Keypad *) load_keypad(); Input_keypad_client client(keypad); /* Obtain a reference to the PWM device. */ diff -r 3e5480ff13ca -r 5c569c381a4e pkg/landfall-examples/qi_lb60_backlight/Makefile --- a/pkg/landfall-examples/qi_lb60_backlight/Makefile Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/landfall-examples/qi_lb60_backlight/Makefile Fri Jun 01 22:53:02 2018 +0200 @@ -3,6 +3,6 @@ TARGET = ex_qi_lb60_backlight SRC_CC = qi_lb60_backlight.cc -REQUIRES_LIBS = libio l4re_c-util libdevice-backlight-client libdevice-input-keypad libdrivers-keypad-qi_lb60 +REQUIRES_LIBS = l4re_c-util libdevice-backlight-client libdevice-input-keypad libdrivers-keypad-loader libdevice-util include $(L4DIR)/mk/prog.mk diff -r 3e5480ff13ca -r 5c569c381a4e pkg/landfall-examples/qi_lb60_backlight/qi_lb60_backlight.cc --- a/pkg/landfall-examples/qi_lb60_backlight/qi_lb60_backlight.cc Fri Jun 01 22:47:51 2018 +0200 +++ b/pkg/landfall-examples/qi_lb60_backlight/qi_lb60_backlight.cc Fri Jun 01 22:53:02 2018 +0200 @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -28,6 +29,8 @@ #include #include +#include + /* Backlight level. */ enum Qi_lb60_backlight_levels @@ -106,7 +109,9 @@ int main(void) { - Keypad *keypad = Keypad::get_keypad(); + // Load the keypad details from the configured library. + + Keypad *keypad = (Keypad *) load_keypad(); Input_keypad_client client(keypad); /* Obtain a reference to the backlight device. */ diff -r 3e5480ff13ca -r 5c569c381a4e tools/checkconfig.sh --- a/tools/checkconfig.sh Fri Jun 01 22:47:51 2018 +0200 +++ b/tools/checkconfig.sh Fri Jun 01 22:53:02 2018 +0200 @@ -82,3 +82,15 @@ # Write it to the configuration file. echo -n "$PANELLIB" > "$PANELCONF" + +# Keypad configuration file in the target area. + +KEYPADCONF="$TARGETDIR/conf/landfall-examples/input-keypad.txt" + +# Determine the required value of the panel configuration. + +KEYPADLIB="rom/libkeypad_$PLATFORM.so" + +# Write it to the configuration file. + +echo -n "$KEYPADLIB" > "$KEYPADCONF"