Class: Fusuma::Plugin::Inputs::RemapTouchpadInput
- Inherits:
-
Input
- Object
- Input
- Fusuma::Plugin::Inputs::RemapTouchpadInput
- Includes:
- CustomProcess
- Defined in:
- lib/fusuma/plugin/inputs/remap_touchpad_input.rb
Overview
Get touchpad events from remapper
Defined Under Namespace
Classes: TouchpadSelector
Instance Attribute Summary collapse
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
Instance Method Summary collapse
- #config_param_types ⇒ Object
-
#initialize ⇒ RemapTouchpadInput
constructor
A new instance of RemapTouchpadInput.
- #io ⇒ Object
-
#read_from_io ⇒ Record
override Input#read_from_io.
Constructor Details
#initialize ⇒ RemapTouchpadInput
Returns a new instance of RemapTouchpadInput.
22 23 24 25 |
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 22 def initialize super setup_remapper end |
Instance Attribute Details
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
20 21 22 |
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 20 def pid @pid end |
Instance Method Details
#config_param_types ⇒ Object
14 15 16 17 18 |
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 14 def config_param_types { touchpad_name_patterns: [Array, String] } end |
#io ⇒ Object
27 28 29 |
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 27 def io @fusuma_reader end |
#read_from_io ⇒ Record
override Input#read_from_io
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/fusuma/plugin/inputs/remap_touchpad_input.rb', line 33 def read_from_io @unpacker ||= MessagePack::Unpacker.new(io) data = @unpacker.unpack raise "data is not Hash : #{data}" unless data.is_a? Hash gesture = "touch" finger = data["finger"] # @touch_state ||= {} # @mt_slot ||= 0 # @touch_state[@mt_slot] ||= { # MT_TRACKING_ID: nil, # X: nil, # Y: nil, # valid_touch_point: false # } # TODO: implement update touch_state status = if data["touch_state"].any? { |_, v| v["valid_touch_point"] } "begin" else "end" end Events::Records::GestureRecord.new(gesture: gesture, status: status, finger: finger, delta: nil) rescue EOFError => e MultiLogger.error "#{self.class.name}: #{e}" MultiLogger.error "Shutdown fusuma process..." Process.kill("TERM", Process.pid) end |