1.1 --- a/pkg/devices/backlight/src/pwm/backlight-pwm.cc Sat Jun 10 23:59:44 2023 +0200
1.2 +++ b/pkg/devices/backlight/src/pwm/backlight-pwm.cc Sun Jun 11 15:42:11 2023 +0200
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * Access a PWM server to update a display panel backlight.
1.6 *
1.7 - * Copyright (C) 2018, 2020 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2018, 2020, 2023 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -24,6 +24,7 @@
1.13 #include <stdlib.h>
1.14
1.15 #include <ipc/server.h>
1.16 +
1.17 #include "backlight_object_server.h"
1.18 #include "activation_client.h"
1.19 #include "pwm_client.h"
1.20 @@ -32,14 +33,14 @@
1.21
1.22 /* Backlight device. */
1.23
1.24 -class server_BacklightObject : public BacklightObject
1.25 +class BacklightObject_server : public BacklightObject
1.26 {
1.27 Activation *_activation;
1.28 PWM *_pwm;
1.29 int _min, _max;
1.30
1.31 public:
1.32 - explicit server_BacklightObject(Activation *activation, PWM *pwm,
1.33 + explicit BacklightObject_server(Activation *activation, PWM *pwm,
1.34 int min, int max)
1.35 : _activation(activation), _pwm(pwm), _min(min), _max(max)
1.36 {
1.37 @@ -84,7 +85,9 @@
1.38 /* Obtain a reference to the PWM device. */
1.39
1.40 l4_cap_idx_t pwm = l4re_env_get_cap("pwm");
1.41 - if (!l4_is_valid_cap(pwm)) return 1;
1.42 +
1.43 + if (!l4_is_valid_cap(pwm))
1.44 + return 1;
1.45
1.46 client_Activation activation_obj(pwm);
1.47 client_PWM pwm_obj(pwm);
1.48 @@ -94,14 +97,12 @@
1.49 min = atoi(argv[1]);
1.50 max = atoi(argv[2]);
1.51
1.52 - server_BacklightObject obj(&activation_obj, &pwm_obj, min, max);
1.53 - l4_cap_idx_t server;
1.54 + BacklightObject_server obj(&activation_obj, &pwm_obj, min, max);
1.55
1.56 - if (ipc_server_bind("backlight", (l4_umword_t) &obj, &server)) return 1;
1.57 + /* Bind and start the IPC server loop. */
1.58
1.59 - /* Enter the IPC server loop. */
1.60 + if (ipc_server_loop_for(BacklightObject, &obj, "backlight"))
1.61 + return 1;
1.62
1.63 - ipc_server_loop(BacklightObject_expected_items, &obj,
1.64 - (ipc_server_handler_type) handle_BacklightObject);
1.65 return 0;
1.66 }