uinput-device 0.2.0 → 0.3.0

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
2
  SHA1:
3
- metadata.gz: e2f68045a5faf497f1608f21b0878dd8f9bf151f
4
- data.tar.gz: 7e9221d8b6bf3066a6fc7a42ff0d0176d171595f
3
+ metadata.gz: 55ba55f9d8dff99f554fd0f1aa8bf9377e9fa77c
4
+ data.tar.gz: bc91b3afbd8329ddce18399cdd68b5963ae93e2a
5
5
  SHA512:
6
- metadata.gz: 3560fcba16b1e5dc8a2e7675b21a0e4a0e2ee397a2d3023142e7acc7823fc076fa886f4c5f32b902291ad51a991ad66b5bcf1ea98b2cae8abe47dbae043ce76e
7
- data.tar.gz: 956397f608409ec6979f450abdf242b3f0a835b34225a2e94a49e5ba526f01bda204724cb6277717f27dc4334261d7aa6c6541c67b3dff70436a849543034d54
6
+ metadata.gz: b2e8a73b728547ce8067c8ec62a918d97575363670739ce4f39a50573e43b36e41ad9126b93e9bd2af76e040a1e5f393ef28aba469a247885e6b3fbcab5d311d
7
+ data.tar.gz: fed2a9aa9a0e546f8fbe9726b0bdc4b9a3583811bab031f204adfe85f3ef0fb5cfc383d0eeed33239ad27271f039cc7e27da14eb2fd9a65c32ff00bcdbcf6a35
data/lib/uinput/device.rb CHANGED
@@ -6,6 +6,8 @@ require_relative "device/error"
6
6
 
7
7
  module Uinput
8
8
  class Device
9
+ SYS_INPUT_DIR = '/sys/devices/virtual/input/'
10
+
9
11
  def initialize(&block)
10
12
  @file = self.class::SystemInitializer.new(self, &block).create
11
13
  end
@@ -15,6 +17,25 @@ module Uinput
15
17
  @file = nil
16
18
  end
17
19
 
20
+ def sysname
21
+ @sysname ||= begin
22
+ name_len = 128
23
+ name_buffer = [' ' * name_len].pack("A#{name_len}")
24
+ @file.ioctl(Uinput.UI_GET_SYSNAME(name_len), name_buffer)
25
+ name_buffer.unpack("A#{name_len}").first
26
+ end
27
+ end
28
+
29
+ def sys_path
30
+ "#{SYS_INPUT_DIR}#{sysname}"
31
+ end
32
+
33
+ def dev_path
34
+ event_dir = Dir["#{sys_path}/event*"].first
35
+ event = File.basename(event_dir)
36
+ "/dev/input/#{event}"
37
+ end
38
+
18
39
  def active?
19
40
  not @file.nil?
20
41
  end
@@ -1,5 +1,5 @@
1
1
  module Uinput
2
2
  class Device
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uinput-device
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.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: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: uinput
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.4.8
94
+ rubygems_version: 2.4.5.1
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Generic ruby wrapper around uinput to create devices.