evdev.h 1.88 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/**
 * @file evdev.h
 * Mode Control Entity - evdev input device handling
 * <p>
 * Copyright (C) 2012-2019 Jolla Ltd.
 * <p>
 * @author Simo Piiroinen <simo.piiroinen@jollamobile.com>
 *
 * mce is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * version 2.1 as published by the Free Software Foundation.
 *
 * mce is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with mce.  If not, see <http://www.gnu.org/licenses/>.
 */
21 22 23 24 25 26 27 28 29 30

#ifndef EVDEV_H_
#define EVDEV_H_

#ifdef __cplusplus
extern "C" {
#elif 0
} /* fool JED indentation ... */
#endif

31 32 33 34 35 36 37 38 39
/** Assumed EV_MSC:MSC_GESTURE event values
 *
 * Actual gestures / values depend on hw and kernel driver - these are
 * meant to be used mainly to improve code readability.
 *
 * However GESTURE_DOUBLETAP is a special case as it is assumed by
 * mce to always mean doubletap.
 */
typedef enum {
40
    /* Values 0-15 reserved for touchscreen gestures */
41 42 43 44 45 46
    GESTURE_SWIPE_FROM_LEFT   = 0,
    GESTURE_SWIPE_FROM_RIGHT  = 1,
    GESTURE_SWIPE_FROM_TOP    = 2,
    GESTURE_SWIPE_FROM_BOTTOM = 3,
    GESTURE_DOUBLETAP         = 4, /* To conform with value used in
                                    * Nokia N9 kernel driver */
47 48
    GESTURE_FPWAKEUP          = 16,

49 50
    /* Modifiers */
    GESTURE_SYNTHESIZED       = (1<<8),
51 52
} gesture_t;

53 54 55
const char *evdev_get_event_code_name(int etype, int ecode);
const char *evdev_get_event_type_name(int etype);

56 57
int evdev_lookup_event_code(int etype, const char *ename);

58 59 60 61 62 63 64 65
int evdev_open_device(const char *path);
int evdev_identify_device(int fd);

#ifdef __cplusplus
};
#endif

#endif /* EVDEV_H_ */