mtouch_driver_funcs_t
Functions to be implemented by the mtouch driver
Synopsis:
#include <input/mtouch_driver.h>typedef struct mtouch_driver_funcs_t {
int (*get_contact_id)(void *packet, uint8_t digit_idx, uint32_t *contact_id, void *arg);
int (*is_contact_down)(void *packet, uint8_t digit_idx, int *valid, void *arg);
int (*get_coords)(void *packet, uint8_t digit_idx, int32_t *x, int32_t *y, void *arg);
int (*get_down_count)(void *packet, uint32_t *down_count, void *arg);
int (*get_touch_width)(void *packet, uint8_t digit_idx, uint32_t *touch_width, void *arg);
int (*get_touch_height)(void *packet, uint8_t digit_idx, uint32_t *touch_height, void *arg);
int (*get_touch_orientation)(void *packet, uint8_t digit_idx, uint32_t *touch_orientation, void *arg);
int (*get_touch_pressure)(void *packet, uint8_t digit_idx, uint32_t *touch_pressure, void *arg);
void (*get_seq_id)(void *packet, uint32_t *seq_id, void *arg);
int (*get_contact_type)(void *packet, uint8_t digit_idx, uint32_t *contact_type, void *arg);
int (*get_select)(void *packet, uint8_t digit_idx, uint32_t *select, void *arg);
int (*set_event_rate)(void *dev, uint32_t min_event_interval);
} mtouch_driver_funcs_t;Data:
- int (*get_contact_id)(void *packet, uint8_t digit_idx, uint32_t *contact_id, void *arg)
- Retrieve the contact ID for the specified digit from
packet.This callback function is called for each of the touchpoints. The maximum number of touchpoints is
max_touchpoints, as specified in mtouch_driver_params_t (mtouch_params.h).ArgumentspacketData packet that contains information on the touch-related event. This data packet is the same packet that was passed into mtouch_driver_process_packet(). This data can be used to retrieve information about all digits, regardless of whether or not they are touching.digit_idxDigit (finger) index that the Input Events library is requesting. It is a zero based index whose maximum is (max_touchpoints- 1). There is no requirement for any correlation betweendigit_idxandcontact_id.contact_idPointer to contact ID of the touch-related event for the specifieddigit_idx. This function updatescontact_idupon its successful execution.argUser information.
Returns0if successful; otherwise non-zero if an error occurred.
- int (*is_contact_down)(void *packet, uint8_t digit_idx, int *valid, void *arg)
- Retrieve the touch status for the specified digit from
packet.This callback function is called for each of the touchpoints. The maximum number of touchpoints is
max_touchpoints, as specified in mtouch_driver_params_t (mtouch_params.h).ArgumentspacketData packet that contains information on the touch-related event. This data packet is the same packet that was passed into mtouch_driver_process_packet(). This data can be used to retrieve information about all digits, regardless of whether or not they are touching.digit_idxDigit (finger) index that the Input Events library is requesting. It is a zero based index whose maximum is (max_touchpoints- 1). There is no requirement for any correlation betweendigit_idxandcontact_id.validPointer to touch status (e.g.,1= Down and0= Up) of the touch-related event for the specifieddigit_idx. This function updatesvalidupon its successful execution.argUser information.
Returns0if successful; otherwise non-zero if an error occurred.
- int (*get_coords)(void *packet, uint8_t digit_idx, int32_t *x, int32_t *y, void *arg)
- Retrieve the coordinates for the specified digit from
packet.This callback function is called for each of the touchpoints. The maximum number of touchpoints is
max_touchpoints, as specified in mtouch_driver_params_t (mtouch_params.h).ArgumentspacketData packet that contains information on the touch-related event. This data packet is the same packet that was passed into mtouch_driver_process_packet(). This data can be used to retrieve information about all digits, regardless of whether or not they are touching.digit_idxDigit (finger) index that the Input Events library is requesting. It is a zero based index whose maximum is (max_touchpoints- 1). There is no requirement for any correlation betweendigit_idxandcontact_id.xPointer to the x coordinate of the touch-related event for the specifieddigit_idx. This function updatesxupon its successful execution.yPointer to the y coordinate of the touch-related event for the specifieddigit_idx. This function updatesyupon its successful execution.argUser information.
Returns0if successful; otherwise non-zero if an error occurred.
- int (*get_down_count)(void *packet, uint32_t *down_count, void *arg)
- Retrieve the number of touchpoints currently in contact with the screen.
This callback function is called for each of the touchpoints. The maximum number of touchpoints is
max_touchpoints, as specified in mtouch_driver_params_t (mtouch_params.h).ArgumentspacketData packet that contains information on the touch-related event. This data packet is the same packet that was passed into mtouch_driver_process_packet(). This data can be used to retrieve information about all digits, regardless of whether or not they are touching.down_countPointer to the number of rouchpoints currently in contact with the screen. This function updatesdown_countupon its successful execution.argUser information.
Returns0if successful; otherwise non-zero if an error occurred.
- int (*get_touch_width)(void *packet, uint8_t digit_idx, uint32_t *touch_width, void *arg)
- Retrieve the width information for the specified digit from
packet.This callback function is called for each of the touchpoints. The maximum number of touchpoints is
max_touchpoints, as specified in mtouch_driver_params_t (mtouch_params.h).ArgumentspacketData packet that contains information on the touch-related event. This data packet is the same packet that was passed into mtouch_driver_process_packet(). This data can be used to retrieve information about all digits, regardless of whether or not they are touching.digit_idxDigit (finger) index that the Input Events library is requesting. It is a zero based index whose maximum is (max_touchpoints- 1). There is no requirement for any correlation betweendigit_idxandcontact_id.touch_widthPointer to the width of the touch-related event for the specifieddigit_idx. This function updatestouch_widthupon its successful execution.argUser information.
Returns0if successful; otherwise non-zero if an error occurred.
- int (*get_touch_height)(void *packet, uint8_t digit_idx, uint32_t *touch_height, void *arg)
- Retrieve the height information for the specified digit from
packet.This callback function is called for each of the touchpoints. The maximum number of touchpoints is
max_touchpoints, as specified in mtouch_driver_params_t (mtouch_params.h).ArgumentspacketData packet that contains information on the touch-related event. This data packet is the same packet that was passed into mtouch_driver_process_packet(). This data can be used to retrieve information about all digits, regardless of whether or not they are touching.digit_idxDigit (finger) index that the Input Events library is requesting. It is a zero based index whose maximum is (max_touchpoints- 1). There is no requirement for any correlation betweendigit_idxandcontact_id.touch_heightPointer to the height of the touch-related event for the specifieddigit_idx. This function updatestouch_heightupon its successful execution.argUser information.
Returns0if successful; otherwise non-zero if an error occurred.
- int (*get_touch_orientation)(void *packet, uint8_t digit_idx, uint32_t *touch_orientation, void *arg)
- Retrieve the orientation information for the specified digit from
packet.This callback function is not yet implemented by the Input Events library. For the time being, simply set this callback function to
NULLin your mtouch_driver_funcs_t assignment before you call mtouch_driver_attach().Argumentspacketdigit_idxtouch_orientationarg
Returns0if successful; otherwise non-zero if an error occurred.
- int (*get_touch_pressure)(void *packet, uint8_t digit_idx, uint32_t *touch_pressure, void *arg)
- Retrieve the touch pressure information for the specified digit from
packet.For capacitive touchscreens, this callback function retrieves the signal strength, not the pressure. The signal strength information is directly proportional to the width and height retrieved from the (*get_touch_width)() and (*get_touch_height)() callback functions.
ArgumentspacketData packet that contains information on the touch-related event. This data packet is the same packet that was passed into mtouch_driver_process_packet(). This data can be used to retrieve information about all digits, regardless of whether or not they are touching.digit_idxDigit (finger) index that the Input Events library is requesting. It is a zero based index whose maximum is (max_touchpoints- 1). There is no requirement for any correlation betweendigit_idxandcontact_id.touch_pressurePointer to the pressure, or signal strength for capacitive touchscreens, of the touch-related event for the specifieddigit_idx. This function updates istouch_pressureupon its successful execution.argUser information.
Returns0if successful; otherwise non-zero if an error occurred.
- void (*get_seq_id)(void *packet, uint32_t *seq_id, void *arg)
- Retrieve the unique sequence ID of a touch-related event from
packet.This callback function is called for each of the touchpoints. The maximum number of touchpoints is
max_touchpoints, as specified in mtouch_driver_params_t (mtouch_params.h). The sequence ID is used to track the touch-related event in the Input Events library. The sequence ID is commonly a value that is incremented continuously.ArgumentspacketData packet that contains information on the touch-related event. This data packet is the same packet that was passed into mtouch_driver_process_packet(). This data can be used to retrieve information about all digits, regardless of whether or not they are touching.seq_idPointer to the unique sequence ID that Input Events library is requesting. This function updatesseq_idupon its successful execution.argUser information.
Returns0if successful; otherwise non-zero if an error occurred.
- int (*get_contact_type)(void *packet, uint8_t digit_idx, uint32_t *contact_type, void *arg)
- Retrieve the contact type of a touch-related event from
packet.This callback function is called for each of the touchpoints. The maximum number of touchpoints is
max_touchpoints, as specified in mtouch_driver_params_t (mtouch_params.h).ArgumentspacketData packet that contains information on the touch-related event. This data packet is the same packet that was passed into mtouch_driver_process_packet(). This data can be used to retrieve information about all digits, regardless of whether or not they are touching.digit_idxDigit (finger) index that is related to the contact type that is being retrived. It is a zero based index whose maximum is(max_touchpoints- 1).contact_typePointer to the contact type that Input Events library is requesting. Valid contact types are of type contact_type_e. This function updatescontact_typeupon its successful execution.argUser information.
Returns0if successful; otherwise non-zero if an error occurred.
- int (*get_select)(void *packet, uint8_t digit_idx, uint32_t *select, void *arg)
- Retrieve the select buttons of a touch-related event from
packet.This callback function is not yet implemented by the Input Events library. For the time being, simply set this callback function to
NULLin your mtouch_driver_funcs_t assignment when attaching your driver.Argumentspacketdigit_idxselectarg
Returns0if successful; otherwise non-zero if an error occurred.
- int (*set_event_rate)(void *dev, uint32_t min_event_interval)
- Set the event rate on your multitouch device.
This function is called with the device mutex held.
ArgumentsdevHandle to the device driver.min_event_intervalMinimum sampling period, in microseconds, of the touch controller. Two touch-related events will not be received in a time less than this interval.
Returns0if successful; otherwise non-zero if an error occurred.
Library:
libinputeventsDescription:
These callback functions are called into by libinputevents to fetch the data required to transform the device (touch controller) data into mtouch events.
These functions must be implemented. Otherwise, the driver will not be able to connect to the Input Events framework.
