/* Decode the four-byte gesture data and execute any callbacks.  */
static int decode_gesture(unsigned char *gesture)
/* Decode the four-byte gesture data and execute any callbacks.  */
static int decode_gesture(unsigned char *gesture)
{
    unsigned char tap, android_orient;
    android_orient = gesture[3] & 0xC0;
    tap = 0x3F & gesture[3];
    if (gesture[1] & INT_SRC_TAP) {
        unsigned char direction, count;
        direction = tap >> 3;
        count = (tap % 8) + 1;
        if (dmp.tap_cb)
            dmp.tap_cb(direction, count);
    }
    if (gesture[1] & INT_SRC_ANDROID_ORIENT) {
        if (dmp.android_orient_cb)
            dmp.android_orient_cb(android_orient >> 6);
    }
    return 0;
}