aboutsummaryrefslogblamecommitdiffstats
path: root/community/directfb/0007-tslib-Automatically-detect-touchscreens-using-ts_setup.patch
blob: d84cc93e06b84fb2c8bc66202c21db5255ff587d (plain) (tree)






























                                                                          
diff --git a/inputdrivers/tslib/tslib.c b/inputdrivers/tslib/tslib.c
index a06cd68c6..8d355a804 100644
--- a/inputdrivers/tslib/tslib.c
+++ b/inputdrivers/tslib/tslib.c
@@ -152,6 +152,7 @@ driver_get_available(void)
 {
      int   i;
      char *tsdev;
+     struct tsdev *ts;
 
      /* Use the devices specified in the configuration. */
      if (fusion_vector_has_elements( &dfb_config->tslib_devices )) {
@@ -168,10 +169,15 @@ driver_get_available(void)
           return num_devices;
      }
 
-     /* Check for environment variable. */
-     tsdev = getenv( "TSLIB_TSDEVICE" );
-     if (tsdev && check_device( tsdev ))
+     /* Ask tslib for a device (TSLIB_TSDEVICE is checked in ts_setup) */
+     ts = ts_setup( NULL, 0 );
+     if (ts) {
+          /* No need to check_device() - already done by tslib */
+          tsdev = ts_get_eventpath( ts );
+          D_INFO( "DirectFB/tslib: Found touchscreen: '%s'\n", tsdev );
           device_names[num_devices++] = D_STRDUP( tsdev );
+          ts_close( ts );
+     }
 
      /* Try to guess some (more) devices. */
      for (i = 0; i < MAX_TSLIB_DEVICES; i++) {