A generic touchscreen calibration program for X.Org
Revisão | ac29e2e67ee58cc2ef82d4ebeadc4048c3939d4a (tree) |
---|---|
Hora | 2010-09-13 00:25:18 |
Autor | Tias Guns <tias@ulys...> |
Commiter | Tias Guns |
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
@@ -63,6 +63,7 @@ public: | ||
63 | 63 | int xinput_do_set_prop(Display *display, Atom type, int format, int argc, char* argv[]); |
64 | 64 | protected: |
65 | 65 | bool output_xorgconfd(const XYinfo new_axys, int swap_xy, int new_swap_xy); |
66 | + bool output_hal(const XYinfo new_axys, int swap_xy, int new_swap_xy); | |
66 | 67 | bool output_xinput(const XYinfo new_axys, int swap_xy, int new_swap_xy); |
67 | 68 | }; |
68 | 69 |
@@ -231,6 +232,9 @@ bool CalibratorEvdev::finish_data(const XYinfo new_axys, int swap_xy) | ||
231 | 232 | case OUTYPE_XORGCONFD: |
232 | 233 | success &= output_xorgconfd(new_axys, swap_xy, new_swap_xy); |
233 | 234 | break; |
235 | + case OUTYPE_HAL: | |
236 | + success &= output_hal(new_axys, swap_xy, new_swap_xy); | |
237 | + break; | |
234 | 238 | case OUTYPE_XINPUT: |
235 | 239 | success &= output_xinput(new_axys, swap_xy, new_swap_xy); |
236 | 240 | break; |
@@ -482,6 +486,28 @@ bool CalibratorEvdev::output_xorgconfd(const XYinfo new_axys, int swap_xy, int n | ||
482 | 486 | return true; |
483 | 487 | } |
484 | 488 | |
489 | +bool CalibratorEvdev::output_hal(const XYinfo new_axys, int swap_xy, int new_swap_xy) | |
490 | +{ | |
491 | + const char* sysfs_name = get_sysfs_name(); | |
492 | + bool not_sysfs_name = (sysfs_name == NULL); | |
493 | + if (not_sysfs_name) | |
494 | + sysfs_name = "!!Name_Of_TouchScreen!!"; | |
495 | + | |
496 | + // HAL policy output | |
497 | + printf(" copy the policy below into '/etc/hal/fdi/policy/touchscreen.fdi'\n\ | |
498 | +<match key=\"info.product\" contains=\"%s\">\n\ | |
499 | + <merge key=\"input.x11_options.calibration\" type=\"string\">%d %d %d %d</merge>\n" | |
500 | + , sysfs_name, new_axys.x_min, new_axys.x_max, new_axys.y_min, new_axys.y_max); | |
501 | + if (swap_xy != 0) | |
502 | + printf(" <merge key=\"input.x11_options.swapaxes\" type=\"string\">%d</merge>\n", new_swap_xy); | |
503 | + printf("</match>\n"); | |
504 | + | |
505 | + if (not_sysfs_name) | |
506 | + printf("\nChange '%s' to your device's name in the config above.\n", sysfs_name); | |
507 | + | |
508 | + return true; | |
509 | +} | |
510 | + | |
485 | 511 | bool CalibratorEvdev::output_xinput(const XYinfo new_axys, int swap_xy, int new_swap_xy) |
486 | 512 | { |
487 | 513 | // create startup script |