50
50
#include <sys/time.h>
51
51
#include <time.h>
52
52
#include <stdint.h>
53
+ #include <fcntl.h>
53
54
54
55
#if defined (__FreeBSD__ )
55
56
#include <dev/evdev/input.h>
@@ -388,6 +389,7 @@ xf86TslibUninit(__attribute__ ((unused)) InputDriverPtr drv,
388
389
free (priv -> samp_mt );
389
390
free (priv -> last_mt );
390
391
#endif
392
+ close (pInfo -> fd );
391
393
valuator_mask_free (& priv -> valuators );
392
394
xf86TslibControlProc (pInfo -> dev , DEVICE_OFF );
393
395
ts_close (priv -> ts );
@@ -463,8 +465,6 @@ static int xf86TslibInit(__attribute__ ((unused)) InputDriverPtr drv,
463
465
464
466
priv -> slots = 0 ;
465
467
466
- pInfo -> fd = ts_fd (priv -> ts );
467
-
468
468
ts_error_fn = errfn ;
469
469
470
470
/* process generic options */
@@ -475,6 +475,21 @@ static int xf86TslibInit(__attribute__ ((unused)) InputDriverPtr drv,
475
475
if (!priv -> valuators )
476
476
return BadValue ;
477
477
478
+ #ifdef TSLIB_VERSION_EVENTPATH
479
+ pInfo -> fd = open (ts_get_eventpath (priv -> ts ), O_RDONLY );
480
+ #else
481
+ if (!s ) {
482
+ xf86IDrvMsg (pInfo , X_ERROR , "Please provide Option path or Device" );
483
+ return BadValue ;
484
+ }
485
+
486
+ pInfo -> fd = open (s , O_RDONLY );
487
+ #endif
488
+ if (pInfo -> fd == -1 ) {
489
+ xf86IDrvMsg (pInfo , X_ERROR , "Couldn't open %s\n" , s );
490
+ return BadValue ;
491
+ }
492
+
478
493
if (ioctl (pInfo -> fd , EVIOCGBIT (EV_ABS , sizeof (absbit )), absbit ) < 0 ) {
479
494
xf86IDrvMsg (pInfo , X_ERROR , "ioctl EVIOCGBIT failed" );
480
495
return BadValue ;
0 commit comments