libts / tslib

Touchscreen access library
GNU Lesser General Public License v2.1
596 stars 290 forks source link

Return the correct name during a device scan #222

Open kreijack opened 4 months ago

kreijack commented 4 months ago

In scan_device(), the returned device name was computed wrongly. It is opened a device, then if it was found as touchscreen it is computed the name again in a different way. It is better (and simpler) to return a strdup() of the last successfully opened device.

I suspect that in may setup I faced the bug because I have a number of entries > 9 and this create an arrangement of entries where

      snprintf(fname, sizeof(fname),
                         "%s/%s", DEV_INPUT_EVENT, namelist[i]->d_name);
      sprintf(filename, "%s/%s%d",
                         DEV_INPUT_EVENT, EVENT_DEV_NAME,
                         i);
    fname <> filename