Languages

Input.Event

Snippet to read Input.Event struct's from /dev/input/event* using IOChannel's

4
Your rating: None Average: 4 (2 votes)
/*
 * To compile: valac --pkg=linux --pkg=posix inputeventreader.vala
 *
 * Description:
 *   This example uses of the GLib's main loop and IOChannel's
 *   to listen for Input.Event's on one or more /dev/input/event*
 *   devices, and outputs the values to standard output.
 *
 * Copyright 2010, Robert Thomson.
 *
 * Released under the MIT License
 */
using Linux;
using Posix;
 
class InputEventReader {
 
    // Read a single input event from the channel, and print out the values.
    private static bool gio_in(IOChannel gio, IOCondition condition) {
        if((condition & IO
Syndicate content