# HG changeset patch # User Paul Boddie # Date 1609373494 -3600 # Node ID 4ec7afff2072717094696a79d428b9ed87cb8bb4 # Parent bdfa043cbc67d8c273f33d8bc1c2ba6872f90a27 Made all backlight control use interface descriptions and generated components. diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/Control --- a/pkg/devices/Control Wed Dec 30 22:51:48 2020 +0100 +++ b/pkg/devices/Control Thu Dec 31 01:11:34 2020 +0100 @@ -13,7 +13,6 @@ provides: devices-keypad-qi_lb60 provides: devices-pwm-jz4730 provides: devices-spi-jz4740 -provides: libdevice-backlight-client provides: libdevice-cpm-client provides: libdevice-cpm-server provides: libdevice-display-client diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/backlight/include/Makefile --- a/pkg/devices/backlight/include/Makefile Wed Dec 30 22:51:48 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -PKGDIR = ../.. -L4DIR ?= $(PKGDIR)/../.. - -include $(L4DIR)/mk/include.mk diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/backlight/include/backlight-client.h --- a/pkg/devices/backlight/include/backlight-client.h Wed Dec 30 22:51:48 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Backlight client to access backlight servers. - * - * 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 - -#ifdef __cplusplus - -#include -#include "backlight-ops.h" - -class Backlight_device_interface : public L4::Kobject_t -{ - L4_KOBJECT(Backlight_device_interface) - -public: - int disable() throw(); - int enable() throw(); - int set_brightness(int level) throw(); -}; - -#endif diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/backlight/include/backlight-ops.h --- a/pkg/devices/backlight/include/backlight-ops.h Wed Dec 30 22:51:48 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -/* - * Backlight server operations. - * - * 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 - -enum { Backlight_op_disable, Backlight_op_enable, Backlight_op_set_brightness }; diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/backlight/src/client/Makefile --- a/pkg/devices/backlight/src/client/Makefile Wed Dec 30 22:51:48 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -PKGDIR ?= ../../.. -L4DIR ?= $(PKGDIR)/../.. - -TARGET = libdevice_backlight_client.o.a libdevice_backlight_client.o.so -PC_FILENAME := libdevice-backlight-client - -SRC_CC := backlight-client.cc - -PRIVATE_INCDIR += $(PKGDIR)/backlight/include - -REQUIRES_LIBS := l4re_c l4re_c-util - -include $(L4DIR)/mk/lib.mk diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/backlight/src/client/backlight-client.cc --- a/pkg/devices/backlight/src/client/backlight-client.cc Wed Dec 30 22:51:48 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Backlight client to access backlight servers. - * - * 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 - -#include "backlight-client.h" - -int -Backlight_device_interface::disable() throw() -{ - L4::Ipc::Iostream s(l4_utcb()); - - return l4_error(s.call(cap(), Backlight_op_disable)); -} - -int -Backlight_device_interface::enable() throw() -{ - L4::Ipc::Iostream s(l4_utcb()); - - return l4_error(s.call(cap(), Backlight_op_enable)); -} - -int -Backlight_device_interface::set_brightness(int level) throw() -{ - L4::Ipc::Iostream s(l4_utcb()); - - s << level; - return l4_error(s.call(cap(), Backlight_op_set_brightness)); -} diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/backlight/src/pwm/Makefile --- a/pkg/devices/backlight/src/pwm/Makefile Wed Dec 30 22:51:48 2020 +0100 +++ b/pkg/devices/backlight/src/pwm/Makefile Thu Dec 31 01:11:34 2020 +0100 @@ -3,12 +3,43 @@ TARGET = dev_backlight_pwm MODE = shared -PC_FILENAME := devices-backlight-pwm +PC_FILENAME = devices-backlight-pwm + +# Locations for interface input and generated output. + +IDL_DIR = $(PKGDIR)/idl +IDL_MK_DIR = $(L4DIR)/idl4re/mk +IDL_BUILD_DIR = . +IDL_EXPORT_DIR = . -SRC_CC := backlight-pwm.cc +include $(IDL_MK_DIR)/idl.mk + +# Compound interface definitions. + +backlight_object_NAME = BacklightObject +backlight_object_INTERFACES = activation backlight + +COMP_INTERFACES_CC = backlight_object -PRIVATE_INCDIR += $(PKGDIR)/backlight/include +# Individual interfaces. + +SERVER_INTERFACES_CC = $(call common_interfaces,$(COMP_INTERFACES_CC)) + +# Generated and plain source files. + +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC) $(COMP_INTERFACES_CC)) -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-pwm-client +PLAIN_SRC_CC = backlight-pwm.cc + +# Normal definitions. + +SRC_CC = $(SERVER_INTERFACES_SRC_CC) $(PLAIN_SRC_CC) + +REQUIRES_LIBS = l4re_c l4re_c-util libdevice-pwm-client libipc + +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR) include $(L4DIR)/mk/prog.mk +include $(IDL_MK_DIR)/interface_rules.mk + +$(PLAIN_SRC_CC): $(SERVER_INTERFACES_SRC_CC) diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/backlight/src/pwm/backlight-pwm.cc --- a/pkg/devices/backlight/src/pwm/backlight-pwm.cc Wed Dec 30 22:51:48 2020 +0100 +++ b/pkg/devices/backlight/src/pwm/backlight-pwm.cc Thu Dec 31 01:11:34 2020 +0100 @@ -1,7 +1,7 @@ /* * Access a PWM server to update a display panel backlight. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2020 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 @@ -19,15 +19,15 @@ * Boston, MA 02110-1301, USA */ -#include #include -#include #include #include #include -#include "backlight-ops.h" + +#include +#include "backlight_object_server.h" /* PWM access abstractions. */ @@ -37,66 +37,41 @@ /* Backlight device. */ -class Backlight_device_server : public L4::Server_object_t +class server_BacklightObject : public BacklightObject { int _min, _max; public: - explicit Backlight_device_server(int min, int max) + explicit server_BacklightObject(int min, int max) : _min(min), _max(max) { } - /* Dispatch incoming requests. */ - - int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios) - { - l4_msgtag_t tag; - int arg; - - (void) obj; - ios >> tag; + /* Disable the backlight. */ - switch (tag.label()) - { - case Backlight_op_disable: - disable(); - return L4_EOK; - - case Backlight_op_enable: - enable(); - return L4_EOK; - - case Backlight_op_set_brightness: - ios >> arg; - set_brightness(arg); - return L4_EOK; - - default: - return -L4_EBADPROTO; - } + long disable() + { + pwm_device->disable(); + return L4_EOK; } - void disable() - { - pwm_device->disable(); - } + /* Enable the backlight. */ - void enable() + long enable() { pwm_device->enable(); + return L4_EOK; } /* Use the PWM device to update the backlight level. */ - void set_brightness(int level) + long set_brightness(int level) { pwm_device->set_duty(level); + return L4_EOK; } }; -static L4Re::Util::Registry_server<> server; - /* Arguments: */ @@ -118,11 +93,14 @@ min = atoi(argv[1]); max = atoi(argv[2]); - Backlight_device_server server_obj(min, max); - server.registry()->register_obj(&server_obj, "backlight"); + server_BacklightObject obj(min, max); + l4_cap_idx_t server; + + if (ipc_server_bind("backlight", (l4_umword_t) &obj, &server)) return 1; /* Enter the IPC server loop. */ - server.loop(); + ipc_server_loop(BacklightObject_expected_items, &obj, + (ipc_server_handler_type) handle_BacklightObject); return 0; } diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/backlight/src/spi-ili8960/backlight-spi-ili8960.cc --- a/pkg/devices/backlight/src/spi-ili8960/backlight-spi-ili8960.cc Wed Dec 30 22:51:48 2020 +0100 +++ b/pkg/devices/backlight/src/spi-ili8960/backlight-spi-ili8960.cc Thu Dec 31 01:11:34 2020 +0100 @@ -25,9 +25,6 @@ #include #include -#include - -#include #include diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/display/src/letux400/Makefile --- a/pkg/devices/display/src/letux400/Makefile Wed Dec 30 22:51:48 2020 +0100 +++ b/pkg/devices/display/src/letux400/Makefile Thu Dec 31 01:11:34 2020 +0100 @@ -3,12 +3,40 @@ TARGET = dev_display_letux400 MODE = shared -PC_FILENAME := devices-display-letux400 +PC_FILENAME = devices-display-letux400 + +# Locations for interface input and generated output. -SRC_CC := display-letux400.cc +IDL_DIR = $(PKGDIR)/idl +IDL_MK_DIR = $(L4DIR)/idl4re/mk +IDL_BUILD_DIR = . +IDL_EXPORT_DIR = . + +include $(IDL_MK_DIR)/idl.mk + +# Individual interfaces. + +CLIENT_INTERFACES_CC = activation -PRIVATE_INCDIR += $(PKGDIR)/display/include +SERVER_INTERFACES_CC = activation + +# Generated and plain source files. + +CLIENT_INTERFACES_SRC_CC = $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC)) + +SERVER_INTERFACES_SRC_CC = $(call interfaces_to_server_cc,$(SERVER_INTERFACES_CC)) -REQUIRES_LIBS := l4re_c l4re_c-util libdevice-backlight-client libdrivers-gpio libdevice-util +PLAIN_SRC_CC = display-letux400.cc + +# Normal definitions. + +SRC_CC = $(CLIENT_INTERFACES_SRC_CC) $(SERVER_INTERFACES_SRC_CC) $(PLAIN_SRC_CC) + +REQUIRES_LIBS = l4re_c l4re_c-util libdrivers-lcd-jz4740 libdrivers-gpio libdevice-util libipc + +PRIVATE_INCDIR = $(PKGDIR)/display/include $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR) include $(L4DIR)/mk/prog.mk +include $(IDL_MK_DIR)/interface_rules.mk + +$(PLAIN_SRC_CC): $(CLIENT_INTERFACES_SRC_CC) $(SERVER_INTERFACES_SRC_CC) diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/devices/display/src/letux400/display-letux400.cc --- a/pkg/devices/display/src/letux400/display-letux400.cc Wed Dec 30 22:51:48 2020 +0100 +++ b/pkg/devices/display/src/letux400/display-letux400.cc Thu Dec 31 01:11:34 2020 +0100 @@ -1,7 +1,7 @@ /* * Export Letux 400 display operations as a server. * - * Copyright (C) 2018 Paul Boddie + * Copyright (C) 2018, 2020 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 @@ -20,24 +20,21 @@ */ #include -#include #include -#include -#include -#include -#include +#include -#include "display-ops.h" +#include +#include "activation_client.h" +#include "activation_server.h" /* Virtual address for the GPIO register block. */ static l4_addr_t gpio_virt_base = 0, gpio_virt_base_end = 0; -/* GPIO and backlight device abstractions. */ +/* GPIO abstraction. */ static Gpio_jz4730_chip *gpio_port_b = 0, *gpio_port_c = 0; -static L4::Cap backlight_device; @@ -67,15 +64,18 @@ -/* Display device. */ +/* Display device only implementing the activation interface. */ -class Display_device_server : public L4::Server_object_t +class server_DisplayObject : public Activation { Pin_slice lcd_mask1 = {.offset=0, .mask=Jz4730_lcd_gpio_func1}; Pin_slice lcd_mask2 = {.offset=0, .mask=Jz4730_lcd_gpio_func2}; + Activation *_backlight; + public: - explicit Display_device_server() + explicit server_DisplayObject(Activation *backlight) + : _backlight(backlight) { /* Set functions for the LCD pins. */ @@ -88,49 +88,25 @@ gpio_port_c->setup(Jz4730_lcd_gpio_display_enable, Hw::Gpio_chip::Output, 0); } - /* Dispatch incoming requests. */ - - int dispatch(l4_umword_t obj, L4::Ipc::Iostream &ios) - { - l4_msgtag_t tag; - - (void) obj; - ios >> tag; - - switch (tag.label()) - { - case Display_op_disable: - disable(); - return L4_EOK; - - case Display_op_enable: - enable(); - return L4_EOK; - - default: - return -L4_EBADPROTO; - } - } - /* Switch the display off. */ - void disable(void) + long disable(void) { gpio_port_c->setup(Jz4730_lcd_gpio_display_enable, Hw::Gpio_chip::Output, 0); - backlight_device->disable(); + _backlight->disable(); + return L4_EOK; } /* Switch the display on. */ - void enable(void) + long enable(void) { gpio_port_c->setup(Jz4730_lcd_gpio_display_enable, Hw::Gpio_chip::Output, 1); - backlight_device->enable(); + _backlight->enable(); + return L4_EOK; } }; -static L4Re::Util::Registry_server<> server; - int main(void) @@ -147,16 +123,23 @@ /* Obtain a reference to the backlight device. */ - backlight_device = L4Re::Env::env()->get_cap("backlight"); - if (!backlight_device.is_valid()) return 1; + l4_cap_idx_t backlight = l4re_env_get_cap("backlight"); + if (!l4_is_valid_cap(backlight)) return 1; + + /* Use the activation interface with the backlight. */ + + client_Activation backlight_obj(backlight); /* Initialise and register a new server object. */ - Display_device_server server_obj; - server.registry()->register_obj(&server_obj, "display"); + server_DisplayObject obj(&backlight_obj); + l4_cap_idx_t server; + + if (ipc_server_bind("display", (l4_umword_t) &obj, &server)) return 1; /* Enter the IPC server loop. */ - server.loop(); + ipc_server_loop(Activation_expected_items, &obj, + (ipc_server_handler_type) handle_Activation); return 0; } diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/landfall-examples/letux400_backlight/Makefile --- a/pkg/landfall-examples/letux400_backlight/Makefile Wed Dec 30 22:51:48 2020 +0100 +++ b/pkg/landfall-examples/letux400_backlight/Makefile Thu Dec 31 01:11:34 2020 +0100 @@ -2,7 +2,35 @@ L4DIR ?= $(PKGDIR)/../.. TARGET = ex_letux400_backlight -SRC_CC = letux400_backlight.cc -REQUIRES_LIBS = l4re_c-util libdevice-backlight-client libdevice-input-keypad libdrivers-keypad-loader libdevice-util + +# Locations for interface input and generated output. + +IDL_DIR = $(L4DIR)/pkg/devices/idl +IDL_MK_DIR = $(L4DIR)/idl4re/mk +IDL_BUILD_DIR = . +IDL_EXPORT_DIR = . + +include $(IDL_MK_DIR)/idl.mk + +# Individual interfaces. + +CLIENT_INTERFACES_CC = backlight + +# Generated and plain source files. + +CLIENT_INTERFACES_SRC_CC = $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC)) + +PLAIN_SRC_CC = letux400_backlight.cc + +# Normal definitions. + +SRC_CC = $(CLIENT_INTERFACES_SRC_CC) $(PLAIN_SRC_CC) + +REQUIRES_LIBS = l4re_c-util libdevice-input-keypad libdrivers-keypad-loader libdevice-util libipc + +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR) include $(L4DIR)/mk/prog.mk +include $(IDL_MK_DIR)/interface_rules.mk + +$(PLAIN_SRC_CC): $(CLIENT_INTERFACES_SRC_CC) diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/landfall-examples/letux400_backlight/letux400_backlight.cc --- a/pkg/landfall-examples/letux400_backlight/letux400_backlight.cc Wed Dec 30 22:51:48 2020 +0100 +++ b/pkg/landfall-examples/letux400_backlight/letux400_backlight.cc Thu Dec 31 01:11:34 2020 +0100 @@ -1,7 +1,9 @@ /* * Access the keypad to modify the backlight on the Letux 400. * - * Copyright (C) 2018 Paul Boddie + * Fn+Volume Down/Up adjusts the brightness. + * + * Copyright (C) 2018, 2020 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 @@ -19,7 +21,6 @@ * Boston, MA 02110-1301, USA */ -#include #include #include @@ -31,6 +32,8 @@ #include +#include "backlight_client.h" + /* Backlight level. */ enum Letux400_backlight_levels @@ -46,9 +49,9 @@ static int modifier_set = 0; -/* Backlight device abstractions. */ +/* Backlight references. */ -static L4::Cap backlight_device; +Backlight *backlight_device; @@ -101,10 +104,15 @@ Keypad *keypad = (Keypad *) load_keypad(); Input_keypad_client client(keypad); - /* Obtain a reference to the PWM device. */ + /* Obtain a reference to the backlight device. */ + + l4_cap_idx_t backlight = l4re_env_get_cap("backlight"); + if (!l4_is_valid_cap(backlight)) return 1; - backlight_device = L4Re::Env::env()->get_cap("backlight"); - if (!backlight_device.is_valid()) return 1; + /* Use only the backlight interface with the backlight. */ + + client_Backlight backlight_obj(backlight); + backlight_device = &backlight_obj; client.attach(handler, 0); diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/landfall-examples/qi_lb60_backlight/Makefile --- a/pkg/landfall-examples/qi_lb60_backlight/Makefile Wed Dec 30 22:51:48 2020 +0100 +++ b/pkg/landfall-examples/qi_lb60_backlight/Makefile Thu Dec 31 01:11:34 2020 +0100 @@ -2,7 +2,35 @@ L4DIR ?= $(PKGDIR)/../.. TARGET = ex_qi_lb60_backlight -SRC_CC = qi_lb60_backlight.cc -REQUIRES_LIBS = l4re_c-util libdevice-backlight-client libdevice-input-keypad libdrivers-keypad-loader libdevice-util + +# Locations for interface input and generated output. + +IDL_DIR = $(L4DIR)/pkg/devices/idl +IDL_MK_DIR = $(L4DIR)/idl4re/mk +IDL_BUILD_DIR = . +IDL_EXPORT_DIR = . + +include $(IDL_MK_DIR)/idl.mk + +# Individual interfaces. + +CLIENT_INTERFACES_CC = activation backlight + +# Generated and plain source files. + +CLIENT_INTERFACES_SRC_CC = $(call interfaces_to_client_cc,$(CLIENT_INTERFACES_CC)) + +PLAIN_SRC_CC = qi_lb60_backlight.cc + +# Normal definitions. + +SRC_CC = $(CLIENT_INTERFACES_SRC_CC) $(PLAIN_SRC_CC) + +REQUIRES_LIBS = l4re_c-util libdevice-input-keypad libdrivers-keypad-loader libdevice-util libipc + +PRIVATE_INCDIR = $(IDL_BUILD_DIR) $(IDL_EXPORT_DIR) include $(L4DIR)/mk/prog.mk +include $(IDL_MK_DIR)/interface_rules.mk + +$(PLAIN_SRC_CC): $(CLIENT_INTERFACES_SRC_CC) diff -r bdfa043cbc67 -r 4ec7afff2072 pkg/landfall-examples/qi_lb60_backlight/qi_lb60_backlight.cc --- a/pkg/landfall-examples/qi_lb60_backlight/qi_lb60_backlight.cc Wed Dec 30 22:51:48 2020 +0100 +++ b/pkg/landfall-examples/qi_lb60_backlight/qi_lb60_backlight.cc Thu Dec 31 01:11:34 2020 +0100 @@ -1,7 +1,10 @@ /* * Access the keypad to modify the backlight on the Ben NanoNote. * - * Copyright (C) 2018 Paul Boddie + * Fn+Volume Down/Up adjusts the brightness. + * Red Arrow+Volume Down/Up disables/enables the backlight. + * + * Copyright (C) 2018, 2020 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 @@ -19,18 +22,19 @@ * Boston, MA 02110-1301, USA */ -#include #include #include -#include -#include +#include #include #include #include +#include "activation_client.h" +#include "backlight_client.h" + /* Backlight level. */ enum Qi_lb60_backlight_levels @@ -49,7 +53,8 @@ /* Backlight device abstractions. */ -static L4::Cap backlight_device; +static Activation *activation_device; +static Backlight *backlight_device; @@ -76,7 +81,7 @@ case L4RE_KEY_VOLUMEDOWN: if (enable_modifier_set) { - backlight_device->disable(); + activation_device->disable(); return; } else if (backlight_level < Qi_lb60_backlight_min_level + Qi_lb60_backlight_step) @@ -88,7 +93,7 @@ case L4RE_KEY_VOLUMEUP: if (enable_modifier_set) { - backlight_device->enable(); + activation_device->enable(); return; } else if (backlight_level > Qi_lb60_backlight_max_level - Qi_lb60_backlight_step) @@ -116,8 +121,17 @@ /* Obtain a reference to the backlight device. */ - backlight_device = L4Re::Env::env()->get_cap("backlight"); - if (!backlight_device.is_valid()) return 1; + l4_cap_idx_t backlight = l4re_env_get_cap("backlight"); + if (!l4_is_valid_cap(backlight)) return 1; + + /* NOTE: The component framework should permit the use of a compound client + object. */ + + client_Activation activation_obj(backlight); + activation_device = &activation_obj; + + client_Backlight backlight_obj(backlight); + backlight_device = &backlight_obj; client.attach(handler, 0);