module Uinput

Constants

FILE_PATH

Public Class Methods

open_file(mode = Fcntl::O_RDWR) click to toggle source
# File lib/uinput.rb, line 12
def self.open_file(mode = Fcntl::O_RDWR)
  File.open(FILE_PATH, mode)
end
version() click to toggle source
# File lib/uinput.rb, line 16
def self.version
  @version ||= begin
    pack_size = case FFI.type_size(:uint)
      when 2 then 's'
      when 4 then 'L'
      when 8 then 'Q'
    end

    version = [0].pack pack_size
    open_file.ioctl UI_GET_VERSION, version
    version.unpack(pack_size).first
  end
end