Disconnect from the Input Events library

In addition to any device cleanup, you need to disconnect from the Input Events library so that any resources allocated by the framework to support your driver are released.

At any exit point of your driver, you need to call mtouch_driver_detach() to release resources.

For example, you will need to call mtouch_driver_detach() from your implmentation of mtouch_driver_fini().

void mtouch_driver_fini(void* dev)
{
	touch_dev_t *td = dev;

	pthread_cancel(td->tp_recv_thread);
	pthread_join(td->tp_recv_thread, NULL);

	if (td->inputevents_hdl) {
		mtouch_driver_detach(td->inputevents_hdl);
		td->inputevents_hdl = NULL;
	}

	free(td);
}