omniGlass
Classes | Macros | Enumerations | Functions
platform_linux.c File Reference

linux-evdev implementation for the omniglass touchpad platform More...

#include <asm-generic/errno-base.h>
#include <linux/input-event-codes.h>
#include <omniGlass/constants.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include "platform.h"
#include <linux/input.h>
#include "libevdev/libevdev.h"
#include <dirent.h>

Classes

struct  platform
 

Macros

#define PLATFORM_CLASS_NAME_META   "platform_meta"
 
#define PLATFORM_CLASS_NAME_GLOBAL   "platform"
 
#define PLATFORM_DEFAULT_DEVICE_DIRECTORY   "/dev/input"
 

Enumerations

enum  omniglass_platform_status { OMNIGLASS_PLATFORM_NO_CONFIG = -2 , OMNIGLASS_PLATFORM_EVDEV_INIT_FAILED = -1 , OMNIGLASS_PLATFORM_EVDEV_INIT_SUCCESS = 0 }
 

Functions

void _push_new_touch_point (lua_State *vm, touch_point *point)
 
int platform_evdev_init (lua_State *vm)
 
int platform_parse_events (lua_State *vm)
 
int platform_get_last_report (lua_State *vm)
 
int platform_get_touchpad_boundaries (lua_State *vm)
 
omniglass_init_result platform_init (struct platform **handle, lua_State *vm)
 

Detailed Description

linux-evdev implementation for the omniglass touchpad platform

Function Documentation

◆ platform_evdev_init()

int platform_evdev_init ( lua_State *  vm)

(LUA-FACING) initialization function that detects a touchpad and sets up datastructures and functions needed by the lua VM.

start evdev

diagnostics: check if selected device does have touchpad-like event reporting

◆ platform_get_last_report()

int platform_get_last_report ( lua_State *  vm)

(LUA-FACING) push latest report from the platform into lua

◆ platform_get_touchpad_boundaries()

int platform_get_touchpad_boundaries ( lua_State *  vm)

(LUA-FACING) push coordinates of top-right corner into the virtual machine as a point

◆ platform_init()

omniglass_init_result platform_init ( struct platform **  handle,
lua_State *  vm 
)

this function pushes the entire platform internal API and state into a lua table

Parameters
handlea pointer to a pointer of a handle to create.
vman already-initialized lua state to be injected with the internal platform API

◆ platform_parse_events()

int platform_parse_events ( lua_State *  vm)

(LUA-FACING) this function is where the linux touchpad implementation gets its touch points from the evdev interface