最終更新:2013-11-19 (火) 17:10:14 (3802d)  

input_mt_report_slot_state
Top / input_mt_report_slot_state

report contact state

void input_mt_report_slot_state(struct input_dev *dev, unsigned int tool_type, bool active);
/**
 * input_mt_report_slot_state() - report contact state
 * @dev: input device with allocated MT slots
 * @tool_type: the tool type to use in this slot
 * @active: true if contact is active, false otherwise
 *
 * Reports a contact via ABS_MT_TRACKING_ID, and optionally
 * ABS_MT_TOOL_TYPE. If active is true and the slot is currently
 * inactive, or if the tool type is changed, a new tracking id is
 * assigned to the slot. The tool type is only reported if the
 * corresponding absbit field is set.
 */
void input_mt_report_slot_state(struct input_dev *dev,
                                unsigned int tool_type, bool active)
{
        struct input_mt *mt = dev->mt;
        struct input_mt_slot *slot;
        int id;

        if (!mt)
                return;

        slot = &mt->slots[mt->slot];
        slot->frame = mt->frame;

        if (!active) {
                input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
                return;
        }

        id = input_mt_get_value(slot, ABS_MT_TRACKING_ID);
        if (id < 0 || input_mt_get_value(slot, ABS_MT_TOOL_TYPE) != tool_type)
                id = input_mt_new_trkid(mt);

        input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, id);
        input_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, tool_type);
}
 

関連