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).Argumentspacket
Data 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_idx
Digit (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_idx
andcontact_id
.contact_id
Pointer to contact ID of the touch-related event for the specifieddigit_idx
. This function updatescontact_id
upon its successful execution.arg
User information.
Returns0
if 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).Argumentspacket
Data 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_idx
Digit (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_idx
andcontact_id
.valid
Pointer to touch status (e.g.,1
= Down and0
= Up) of the touch-related event for the specifieddigit_idx
. This function updatesvalid
upon its successful execution.arg
User information.
Returns0
if 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).Argumentspacket
Data 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_idx
Digit (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_idx
andcontact_id
.x
Pointer to the x coordinate of the touch-related event for the specifieddigit_idx
. This function updatesx
upon its successful execution.y
Pointer to the y coordinate of the touch-related event for the specifieddigit_idx
. This function updatesy
upon its successful execution.arg
User information.
Returns0
if 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).Argumentspacket
Data 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_count
Pointer to the number of rouchpoints currently in contact with the screen. This function updatesdown_count
upon its successful execution.arg
User information.
Returns0
if 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).Argumentspacket
Data 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_idx
Digit (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_idx
andcontact_id
.touch_width
Pointer to the width of the touch-related event for the specifieddigit_idx
. This function updatestouch_width
upon its successful execution.arg
User information.
Returns0
if 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).Argumentspacket
Data 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_idx
Digit (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_idx
andcontact_id
.touch_height
Pointer to the height of the touch-related event for the specifieddigit_idx
. This function updatestouch_height
upon its successful execution.arg
User information.
Returns0
if 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
NULL
in your mtouch_driver_funcs_t assignment before you call mtouch_driver_attach().Argumentspacket
digit_idx
touch_orientation
arg
Returns0
if 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.
Argumentspacket
Data 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_idx
Digit (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_idx
andcontact_id
.touch_pressure
Pointer to the pressure, or signal strength for capacitive touchscreens, of the touch-related event for the specifieddigit_idx
. This function updates istouch_pressure
upon its successful execution.arg
User information.
Returns0
if 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.Argumentspacket
Data 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_id
Pointer to the unique sequence ID that Input Events library is requesting. This function updatesseq_id
upon its successful execution.arg
User information.
Returns0
if 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).Argumentspacket
Data 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_idx
Digit (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_type
Pointer to the contact type that Input Events library is requesting. Valid contact types are of type contact_type_e. This function updatescontact_type
upon its successful execution.arg
User information.
Returns0
if 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
NULL
in your mtouch_driver_funcs_t assignment when attaching your driver.Argumentspacket
digit_idx
select
arg
Returns0
if 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.
Argumentsdev
Handle to the device driver.min_event_interval
Minimum sampling period, in microseconds, of the touch controller. Two touch-related events will not be received in a time less than this interval.
Returns0
if 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.