2 # Get running calibration data from lshal
3 # (needed to recalibrate it, most easily fetchable from lshal)
6 #FIND="hal-find-by-property"
7 CAPAB="hal-find-by-capability"
9 BINARY="xinput_calibrator"
11 if [ "$(which $CAPAB)" = "" ]; then
12 echo "Error: Can not find executable $CAPAB"
15 if [ "$(which $GET)" = "" ]; then
16 echo "Error: Can not find executable $GET"
21 #udis=$($FIND --key input.x11_driver --string evtouch)
22 udis=$($CAPAB --capability input)
24 if [ "$udis" = "" ]; then
25 echo "HAL Error: No input devices found (tested: info.capabilities 'input'))"
30 echo "Trying all available input devices:"
31 # possibly multiple screens, iterate over each possibility
35 name=$($GET --udi $udi --key info.product)
36 minx=$($GET --udi $udi --key input.x11_options.minx 2> /dev/null)
37 maxx=$($GET --udi $udi --key input.x11_options.maxx 2> /dev/null)
38 miny=$($GET --udi $udi --key input.x11_options.miny 2> /dev/null)
39 maxy=$($GET --udi $udi --key input.x11_options.maxy 2> /dev/null)
42 if [ "$minx" = "" ] || [ "$maxx" = "" ] ||
43 [ "$miny" = "" ] || [ "$maxy" = "" ]; then
44 if [ "$minx" = "" ] && [ "$maxx" = "" ] &&
45 [ "$miny" = "" ] && [ "$maxy" = "" ]; then
46 # no calibration data available
47 echo "\t'$name': no calibration data available"
49 # partial calibration data available ???
50 echo "Error: '$name', only partial calibration data available (MinX='$minx' MaxX='$maxx' MinY='$miny' MaxY='$maxy'). All 4 current calibration values are need to recalibrate the device !"
54 cmd="$BINARY --precalib $minx $maxx $miny $maxy"
55 echo "\t'$name': values found, calibrate by running:"
60 if [ $count -gt 1 ]; then
61 echo "Found multiple calibratable touchscreen devices, select one from above and execute the calibration program with the given parameters."
63 if [ $count -eq 0 ]; then
64 echo "Warning: No existing calibration data found, no parameters used."
68 if [ "$(which $BINARY)" = "" ]; then
69 echo "Error: can not find calibration program ($BINARY), please run it with the above parameters yourself."
71 echo "\nRunning calibration program..."