evdev 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -0
- data/README.md +9 -6
- data/evdev.gemspec +3 -11
- data/lib/evdev.rb +10 -5
- data/lib/evdev/version.rb +1 -1
- metadata +6 -77
- data/.rakeTasks +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e106675ef1b1fd34a173c2f99140c657ac6e2fbb
|
4
|
+
data.tar.gz: 270c7e4978fd27ee9c2b1d96a39f944a3fc69887
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07c93e2a472f8a5eb579ad3bb7360c588a94290e9a9642631afbaab20047c5709d7d058cb879e893a9fbb7b46dee229802e94aedde7a6e82b08203d313812048
|
7
|
+
data.tar.gz: 4c26f7f335ddcf908ad9ed667663c4bce3e14210e7682b7b4045831f1b1e92546441272464dca06d37dd26c83297f5d5bb88b4ab18d4a3d6a592c526df83f18b
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -38,7 +38,7 @@ keyboard.phys # => "usb-0000:00:1d.2-1/input0"
|
|
38
38
|
keyboard.uniq # => ""
|
39
39
|
keyboard.vendor_id # => 1133
|
40
40
|
keyboard.product_id # => 50473
|
41
|
-
keyboard.bustype # =>
|
41
|
+
keyboard.bustype # => 3 (LinuxInput::BUS_USB)
|
42
42
|
keyboard.version # => 273
|
43
43
|
keyboard.driver_version # => 65537
|
44
44
|
keyboard.has_property? :pointer # => false
|
@@ -60,21 +60,24 @@ the code and it derives the implied type from it internally.
|
|
60
60
|
keyboard.supports_event? :KEY_A # => true
|
61
61
|
keyboard.supports_event? :ABS_X # => false
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
key_handler = keyboard.on(:KEY_A, :KEY_S, :KEY_D, :KEY_F) do |state, key|
|
64
|
+
puts "#{%w(released pressed repeated)[state]} #{key}"
|
65
65
|
end
|
66
66
|
|
67
67
|
loop do
|
68
|
-
|
68
|
+
begin
|
69
69
|
keyboard.handle_event
|
70
|
-
|
70
|
+
rescue Evdev::AwaitEvent
|
71
|
+
Kernel.select([keyboard.event_channel])
|
72
|
+
retry
|
73
|
+
end
|
71
74
|
end
|
72
75
|
```
|
73
76
|
|
74
77
|
Removing the handler:
|
75
78
|
|
76
79
|
```ruby
|
77
|
-
|
80
|
+
key_handler.cancel
|
78
81
|
```
|
79
82
|
|
80
83
|
Evdev includes the [CallbacksAttachable](https://github.com/christopheraue/ruby-callbacks_attachable)
|
data/evdev.gemspec
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'evdev/version'
|
1
|
+
require_relative 'lib/evdev/version'
|
5
2
|
|
6
3
|
Gem::Specification.new do |spec|
|
7
4
|
spec.name = "evdev"
|
8
5
|
spec.version = Evdev::VERSION
|
9
6
|
spec.authors = ["Christopher Aue"]
|
10
|
-
spec.email = ["
|
7
|
+
spec.email = ["rubygems@christopheraue.net"]
|
11
8
|
|
12
9
|
spec.summary = %q{A ruby object wrapper around libevdev bindings.}
|
13
10
|
spec.homepage = "https://github.com/christopheraue/ruby-evdev"
|
@@ -18,10 +15,5 @@ Gem::Specification.new do |spec|
|
|
18
15
|
spec.require_paths = ["lib"]
|
19
16
|
|
20
17
|
spec.add_runtime_dependency "libevdev", "~> 1.0"
|
21
|
-
spec.add_runtime_dependency "callbacks_attachable", "~>
|
22
|
-
spec.add_development_dependency "bundler", "~> 1.8"
|
23
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
-
spec.add_development_dependency "rspec", "~> 3.2.0"
|
25
|
-
spec.add_development_dependency "rspec-its"
|
26
|
-
spec.add_development_dependency "rspec-mocks-matchers-send_message"
|
18
|
+
spec.add_runtime_dependency "callbacks_attachable", "~> 2.3"
|
27
19
|
end
|
data/lib/evdev.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
-
require "bundler/setup"
|
2
1
|
require "callbacks_attachable"
|
3
2
|
require "libevdev"
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
|
4
|
+
require_relative "evdev/version"
|
5
|
+
require_relative "evdev/converter"
|
6
|
+
require_relative "evdev/abs_axis"
|
7
7
|
|
8
8
|
class Evdev
|
9
9
|
include CallbacksAttachable
|
10
10
|
|
11
|
+
module AwaitEvent; end
|
12
|
+
|
11
13
|
class << self
|
12
14
|
def finalize(device)
|
13
15
|
proc { Libevdev.free(device) }
|
@@ -86,7 +88,10 @@ class Evdev
|
|
86
88
|
def handle_event(mode = :blocking)
|
87
89
|
event = LinuxInput::InputEvent.new
|
88
90
|
Libevdev.next_event(@device, Libevdev.const_get(:"READ_FLAG_#{mode.upcase}"), event.pointer)
|
89
|
-
|
91
|
+
event_name = Converter.int_to_name(event[:type], event[:code])
|
92
|
+
trigger(event_name, event[:value], event_name)
|
93
|
+
rescue Errno::EAGAIN => e
|
94
|
+
raise e.extend AwaitEvent
|
90
95
|
end
|
91
96
|
|
92
97
|
def events_pending?
|
data/lib/evdev/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evdev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christopher Aue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libevdev
|
@@ -30,93 +30,22 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.8'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.8'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 3.2.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 3.2.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec-its
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rspec-mocks-matchers-send_message
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
40
|
+
version: '2.3'
|
111
41
|
description:
|
112
42
|
email:
|
113
|
-
-
|
43
|
+
- rubygems@christopheraue.net
|
114
44
|
executables: []
|
115
45
|
extensions: []
|
116
46
|
extra_rdoc_files: []
|
117
47
|
files:
|
118
48
|
- ".gitignore"
|
119
|
-
- ".rakeTasks"
|
120
49
|
- ".rspec"
|
121
50
|
- ".travis.yml"
|
122
51
|
- Gemfile
|
@@ -148,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
77
|
version: '0'
|
149
78
|
requirements: []
|
150
79
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.
|
80
|
+
rubygems_version: 2.6.11
|
152
81
|
signing_key:
|
153
82
|
specification_version: 4
|
154
83
|
summary: A ruby object wrapper around libevdev bindings.
|
data/.rakeTasks
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
-
You are allowed to:
|
4
|
-
1. Remove rake task
|
5
|
-
2. Add existing rake tasks
|
6
|
-
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
-
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build evdev-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install evdev-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v0.1.0 and build and push evdev-0.1.0.gem to Rubygems" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|