Module: Evdev::Converter

Defined in:
lib/evdev/converter.rb

Class Method Summary collapse

Class Method Details

.code_to_int(code) ⇒ Object



16
17
18
# File 'lib/evdev/converter.rb', line 16

def code_to_int(code)
  LinuxInput.const_get(code.upcase)
end

.code_to_type(code) ⇒ Object



4
5
6
# File 'lib/evdev/converter.rb', line 4

def code_to_type(code)
  :"EV_#{code.to_s.split('_').first}"
end

.int_to_name(type_int, code_int) ⇒ Object



20
21
22
23
24
# File 'lib/evdev/converter.rb', line 20

def int_to_name(type_int, code_int)
  @event_names ||= {}
  @event_names[type_int] ||= consts_starting_with("#{int_to_type(type_int)}_")
  @event_names[type_int][code_int]
end

.property_to_int(property) ⇒ Object



8
9
10
# File 'lib/evdev/converter.rb', line 8

def property_to_int(property)
  LinuxInput.const_get(:"INPUT_PROP_#{property.upcase}")
end

.type_to_int(type) ⇒ Object



12
13
14
# File 'lib/evdev/converter.rb', line 12

def type_to_int(type)
  LinuxInput.const_get(type.upcase)
end