Class: Fusuma::Plugin::Inputs::Hidraw::DeviceFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/fusuma/plugin/inputs/hidraw/device.rb

Instance Method Summary collapse

Instance Method Details

#find(device_name_pattern) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fusuma/plugin/inputs/hidraw/device.rb', line 58

def find(device_name_pattern)
  device_name_pattern = Regexp.new(device_name_pattern) if device_name_pattern.is_a?(String)
  event_path = find_pointer_device_path(device_name_pattern)
  return nil unless event_path

  hidraw_path = find_hidraw_path(event_path)

  return Device.new(hidraw_path: hidraw_path) if hidraw_path

  nil
end