Re: [Cppcms-users] cppcms::service and system(..)
Brought to you by:
artyom-beilis
|
From: Christian G. <chr...@gm...> - 2012-09-22 20:17:12
|
2012/9/22 Christian Gmeiner <chr...@gm...>:
> Hi all,
>
>
> I have found some time and I am still working in this issue. The
> current state is the following:
>
> void Service::calibrate()
> {
> // valid session needed
> if (!session().is_set("user"))
> {
> BOOSTER_DEBUG("Service") << __func__ << ") not logged in";
> return;
> }
>
> // only local host is allowed to do this
> if (request().remote_addr() != "127.0.0.1")
> {
> BOOSTER_DEBUG("Service") << __func__ << ") only on local host
> - called from " << request().remote_addr();
> response().out() << "$.jGrowl(\"" << translate("Touch
> calibration only allowed on local host") << "\");" << "\n";
> return;
> }
>
> response().out() << "$.jGrowl(\"" << translate("Starting
> calibration") << "...\");" << "\n";
> BOOSTER_DEBUG("Service") << __func__ << ") doing action";
>
> system("/opt/scripts/set-backlight.sh 0");
> system("/opt/scripts/xcalibrate-touch.sh");
> system("/opt/scripts/set-backlight.sh 100");
>
> BOOSTER_DEBUG("Service") << __func__ << ") done";
> }
>
>
> system("/opt/scripts/set-backlight.sh 0"); call works as expected but
> the whole web apps hangs
> at the next call:
> system("/opt/scripts/xcalibrate-touch.sh");
>
>
> -----------------------------------------
> #!/bin/bash
> # Invokes touch screen calibrator (x11)
>
> export DISPLAY=:0.0
> BINARY=/opt/xinput_calibrator
>
> CALDATA=`$BINARY | grep 'Setting new calibration data:' | cut -d ":"
> -f 2 | tr -d ' ' | sed 's/,/ /g'`
>
> # if CALDATA is empty simply return
> if [ -z $CALDATA ]; then
> exit 0
> fi
>
> # at the moment we store our axis_calib data in
> # the ID-Register. in some rare cases the
> # ID-Register is not accessable and we need a
> # fallback place to store our data.
> if [ -e /proc/idreg/axis_calib ]; then
> echo $CALDATA > /proc/idreg/axis_calib
> else
> echo $CALDATA > /home/vis/.axis_calib
> fi
> -----------------------------------------
>
> xinput_calibrator can be found here https://github.com/tias/xinput_calibrator
>
>
> At the moment I am not sure whats wrong and how to debug it. maybe someone
> has an idea.
>
Here is the syslog output:
May 31 08:00:38 OT tssw: ajax_render: template: touch_display
chromeless: 1 (base.cpp:79)
May 31 08:00:38 OT tssw: i18n: current used locale en (base.cpp:88)
May 31 08:00:38 OT tssw: cppcms_http: GET /keyboard.png (http_api.cpp:251)
May 31 08:00:38 OT tssw: cppcms_http: GET /favicon.ico (http_api.cpp:251)
May 31 08:00:41 OT tssw: cppcms_http: POST /tssw/rpc (http_api.cpp:251)
May 31 08:00:41 OT tssw: cppcms: JSON-RPC Method call:calibrate
(rpc_json.cpp:162)
May 31 08:00:41 OT tssw: TsswService: calibrate) doing action (tssw.cpp:73)
---
Christian Gmeiner, MSc
|