device_input 0.3.1.1 → 1.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7e80de2a9de59a0076e1cc095f3ac1fe89ed0b46
4
- data.tar.gz: bf28ea6f71a22ef4d66eb20bef8a7ffba58e179b
2
+ SHA256:
3
+ metadata.gz: 01a4b48883bd7c07006de058e16d3ff8ff1d9792b8905eb8abae64a82e577e5a
4
+ data.tar.gz: c61bb60b4f227a3718cf90c4704df38574a7a52797cd644549a15a0076b52175
5
5
  SHA512:
6
- metadata.gz: 06b933b69b255c4c23a26490c4a5de946bdf799f655674856ca312577d1e6971956fd0ade3038dbe08a7829c9d541cd1d26fa3bb3999c779d5877797360389f5
7
- data.tar.gz: 7b59c9f09b816737662610fd9869af77299d9616efb39677de43a78f3690557decad7ca755b0833e3a2c3fad58995da76b624e12b9d94c91586011e0115f9f33
6
+ metadata.gz: 6190ef1adafadaeadd24532e92ca1fa72bbdd72d00583165952b946538f55940cd211cf283171c7e467c705958038afba41c0c43224d0704e527d6ace4d8e89d
7
+ data.tar.gz: 9a3dcfacafc3487358f88f3796a477410225a4ebfa3e41df06b2afc3da48717e7f053b8ab51ec607f5644ca537b68a371179bade3588b2b3df441a780c7e7e30
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
- [![Build Status](https://travis-ci.org/rickhull/device_input.svg?branch=master)](https://travis-ci.org/rickhull/device_input)
1
+ [![CI Status](https://github.com/rickhull/device_input/actions/workflows/ci.yaml/badge.svg)](https://github.com/rickhull/device_input/actions/workflows/ci.yaml)
2
2
  [![Gem Version](https://badge.fury.io/rb/device_input.svg)](http://badge.fury.io/rb/device_input)
3
- [![Dependency Status](https://gemnasium.com/rickhull/device_input.svg)](https://gemnasium.com/rickhull/device_input)
4
- [![Security Status](https://hakiri.io/github/rickhull/device_input/master.svg)](https://hakiri.io/github/rickhull/device_input/master)
5
3
  [![Code Climate](https://codeclimate.com/github/rickhull/device_input/badges/gpa.svg)](https://codeclimate.com/github/rickhull/device_input)
6
4
 
7
5
  # Device Input
@@ -42,8 +40,7 @@ long time, it was pretty simple: events are 16 bytes:
42
40
 
43
41
  However, this is only true for 32-bit platforms. On 64-bit platforms, event
44
42
  timestamps became 16 bytes, increasing the size of events from 16 to 24 bytes.
45
- This is because a timestamp is defined (ultimately) as two `long`s, and as
46
- everyone knows, two longs don't make a light. No, wait -- it's that `long`s
43
+ This is because a timestamp is defined (ultimately) as two `long`s, which
47
44
  are bigger on 64-bit platforms. It's easy to remember:
48
45
 
49
46
  * 32-bit platform: 32-bit `long` (4 bytes)
@@ -69,7 +66,7 @@ executable code to assist in examining kernel input events.
69
66
 
70
67
  Install the gem:
71
68
  ```shell
72
- $ gem install device_input # sudo as necessary
69
+ $ gem install device_input
73
70
  ```
74
71
 
75
72
  Or, if using [Bundler](http://bundler.io/), add to your `Gemfile`:
@@ -167,7 +164,7 @@ An event has:
167
164
  * `#value`: Fixnum (signed) from `#data`
168
165
 
169
166
  You will probably want to write your own read loop for your own project.
170
- [`DeviceInput.read_loop`](lib/device_input.rb#L102) is very simple and can
167
+ [`DeviceInput.read_loop`](lib/device_input.rb#L98) is very simple and can
171
168
  easily be rewritten outside of this project's namespace and adapted for your
172
169
  needs.
173
170
 
@@ -178,10 +175,7 @@ needs.
178
175
  * https://www.kernel.org/doc/Documentation/input/input.txt
179
176
  * https://www.kernel.org/doc/Documentation/input/event-codes.txt
180
177
 
181
- These events are defined as C structs with a fixed size in bytes. See more
182
- about these structs towards the end of this document.
183
-
184
- ## Kernel structs
178
+ ### Kernel structs
185
179
 
186
180
  from https://www.kernel.org/doc/Documentation/input/input.txt
187
181
  ```
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1.1
1
+ 1.0.0.1
data/lib/device_input.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'device_input/labels'
2
- require 'device_input/compat'
2
+ require 'rbconfig/sizeof'
3
3
 
4
4
  module DeviceInput
5
5
  class Event
@@ -80,19 +80,14 @@ module DeviceInput
80
80
  end
81
81
 
82
82
  # display fields in hex
83
- def ruby23_hex
84
- # :nocov:
85
- require 'rbconfig/sizeof' # new in ruby 2.3
83
+ def hex
86
84
  DEFINITION.inject('') { |memo, (field, type)|
87
85
  int = @data.send(field)
88
86
  width = RbConfig::SIZEOF.fetch(type)
89
87
  # memo + ("%#0.#{width * 2}x" % int) + " "
90
88
  memo + ("%0.#{width * 2}x" % int) + " "
91
89
  }
92
- # :nocov:
93
90
  end
94
-
95
- alias_method :hex, RUBY23 ? :ruby23_hex : :to_s
96
91
  end
97
92
 
98
93
  def self.read_loop(io)
metadata CHANGED
@@ -1,47 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: device_input
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1.1
4
+ version: 1.0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Hull
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-02 00:00:00.000000000 Z
11
+ date: 2022-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: buildar
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: slop
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '4'
41
41
  description: |
42
42
  Pure ruby to read input events from the Linux kernel input device subsystem.
43
43
  No dependencies. Ruby 2+ required
44
- email:
44
+ email:
45
45
  executables:
46
46
  - evdump
47
47
  extensions: []
@@ -51,30 +51,28 @@ files:
51
51
  - VERSION
52
52
  - bin/evdump
53
53
  - lib/device_input.rb
54
- - lib/device_input/compat.rb
55
54
  - lib/device_input/labels.rb
56
55
  homepage: https://github.com/rickhull/device_input
57
56
  licenses:
58
57
  - GPL-3.0
59
58
  metadata: {}
60
- post_install_message:
59
+ post_install_message:
61
60
  rdoc_options: []
62
61
  require_paths:
63
62
  - lib
64
63
  required_ruby_version: !ruby/object:Gem::Requirement
65
64
  requirements:
66
- - - "~>"
65
+ - - ">="
67
66
  - !ruby/object:Gem::Version
68
- version: '2'
67
+ version: '2.3'
69
68
  required_rubygems_version: !ruby/object:Gem::Requirement
70
69
  requirements:
71
70
  - - ">="
72
71
  - !ruby/object:Gem::Version
73
72
  version: '0'
74
73
  requirements: []
75
- rubyforge_project:
76
- rubygems_version: 2.6.8
77
- signing_key:
74
+ rubygems_version: 3.2.26
75
+ signing_key:
78
76
  specification_version: 4
79
77
  summary: Read input events from e.g. /dev/input/event0
80
78
  test_files: []
@@ -1,24 +0,0 @@
1
- require 'device_input/labels'
2
-
3
- # :nocov:
4
- module DeviceInput
5
- if RbConfig::CONFIG.fetch("MAJOR").to_i < 2
6
- raise "unsupported ruby version #{RbConfig::CONFIG['RUBY_VERSION_NAME']}"
7
- else
8
- RUBY23 = RbConfig::CONFIG.fetch("MINOR").to_i >= 3
9
- end
10
-
11
- unless RUBY23
12
- class Event
13
- def CODES.dig(*args)
14
- memo = self
15
- args.each { |a|
16
- memo = memo[a] rescue nil
17
- break unless memo
18
- }
19
- memo
20
- end
21
- end
22
- end
23
- end
24
- # :nocov: