Permalink
Browse files

add hal output for evdev (not used by auto, not recommended)

only use on old systems lacking xorg.conf.d support but with a
recent evdev
  • Loading branch information...
tias committed Sep 12, 2010
1 parent 9b87089 commit ac29e2e67ee58cc2ef82d4ebeadc4048c3939d4a
Showing with 26 additions and 0 deletions.
  1. +26 −0 src/calibrator/calibratorEvdev.cpp
@@ -63,6 +63,7 @@ class CalibratorEvdev: public Calibrator
int xinput_do_set_prop(Display *display, Atom type, int format, int argc, char* argv[]);
protected:
bool output_xorgconfd(const XYinfo new_axys, int swap_xy, int new_swap_xy);
+ bool output_hal(const XYinfo new_axys, int swap_xy, int new_swap_xy);
bool output_xinput(const XYinfo new_axys, int swap_xy, int new_swap_xy);
};
@@ -231,6 +232,9 @@ bool CalibratorEvdev::finish_data(const XYinfo new_axys, int swap_xy)
case OUTYPE_XORGCONFD:
success &= output_xorgconfd(new_axys, swap_xy, new_swap_xy);
break;
+ case OUTYPE_HAL:
+ success &= output_hal(new_axys, swap_xy, new_swap_xy);
+ break;
case OUTYPE_XINPUT:
success &= output_xinput(new_axys, swap_xy, new_swap_xy);
break;
@@ -482,6 +486,28 @@ bool CalibratorEvdev::output_xorgconfd(const XYinfo new_axys, int swap_xy, int n
return true;
}
+bool CalibratorEvdev::output_hal(const XYinfo new_axys, int swap_xy, int new_swap_xy)
+{
+ const char* sysfs_name = get_sysfs_name();
+ bool not_sysfs_name = (sysfs_name == NULL);
+ if (not_sysfs_name)
+ sysfs_name = "!!Name_Of_TouchScreen!!";
+
+ // HAL policy output
+ printf(" copy the policy below into '/etc/hal/fdi/policy/touchscreen.fdi'\n\
+<match key=\"info.product\" contains=\"%s\">\n\
+ <merge key=\"input.x11_options.calibration\" type=\"string\">%d %d %d %d</merge>\n"
+ , sysfs_name, new_axys.x_min, new_axys.x_max, new_axys.y_min, new_axys.y_max);
+ if (swap_xy != 0)
+ printf(" <merge key=\"input.x11_options.swapaxes\" type=\"string\">%d</merge>\n", new_swap_xy);
+ printf("</match>\n");
+
+ if (not_sysfs_name)
+ printf("\nChange '%s' to your device's name in the config above.\n", sysfs_name);
+
+ return true;
+}
+
bool CalibratorEvdev::output_xinput(const XYinfo new_axys, int swap_xy, int new_swap_xy)
{
// create startup script

0 comments on commit ac29e2e

Please sign in to comment.