devicepkg-dev: fix call to dc (MR 4959)

The current invocation doesn't work:

  $ busybox dc "100" "5" / p
  dc: can't open '100': No such file or directory

Fix it so that it does:

  $ busybox dc -e "100 5 / p"
  20

One of the messages that is printed on failure was missing
the "WARNING:" prefix. Address that too.

Signed-off-by: Andrea Bolognani <eof@kiyuko.org>
This commit is contained in:
Andrea Bolognani
2024-03-23 11:46:12 +03:00
committed by Alexey Minnekhanov
parent 74cec4794b
commit 9200f8fe1a
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -50,14 +50,14 @@ echo_libinput_calibration()
# As the "dc" command from "bc" is incompatible to the one provided by busybox,
# this calls busybox explicitly.
# shellcheck disable=SC2154
x_offset=$(busybox dc "$3" "$deviceinfo_screen_width" / p)
x_offset=$(busybox dc -e "$3 $deviceinfo_screen_width / p")
# shellcheck disable=SC2154
y_offset=$(busybox dc "$6" "$deviceinfo_screen_height" / p)
y_offset=$(busybox dc -e "$6 $deviceinfo_screen_height / p")
# Check if we have got results from dc. If there was an error, dc should have
# printed an error message that hopefully gives the user a hint why it failed.
if [ -z "$x_offset" ] || [ -z "$y_offset" ]; then
echo "WARNING: Calculating the offsets for the calibration matrix for x11/libinput failed." >&2
echo "No calibration matrix for x11/libinput will be generated." >&2
echo "WARNING: No calibration matrix for x11/libinput will be generated." >&2
return
fi