0.0
No commit activity in last 3 years
No release in over 3 years
Generic ruby wrapper around uinput to create devices.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 10.0

Runtime

~> 1.1
 Project Readme

Uinput::Device

Generic ruby wrapper around uinput to create devices.

Installation

Add this line to your application's Gemfile:

gem 'uinput-device'

And then execute:

$ bundle

Or install it yourself as:

$ gem install uinput-device

Usage

require 'uinput/device'

Initializing a new virtual device having an A key:

device = Uinput::Device.new do
    self.name = "Our virtual device"
    self.type = LinuxInput::BUS_VIRTUAL
    self.add_key(:KEY_A)
    self.add_event(:EV_KEY)
    self.add_event(:EV_SYN)
end

Symbols like :KEY_A are mapped to constants in the LinuxInput namespace (see linux_input)

Typing an 'a' on our keyboard:

# key down
device.send_event(:EV_KEY, :KEY_A, 1)
device.send_event(:EV_SYN, :SYN_REPORT)

# key up
device.send_event(:EV_KEY, :KEY_A, 0)
device.send_event(:EV_SYN, :SYN_REPORT)

Destroying the device:

device.destroy