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 +4 -4
- data/lib/uinput/device.rb +21 -0
- data/lib/uinput/device/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55ba55f9d8dff99f554fd0f1aa8bf9377e9fa77c
|
4
|
+
data.tar.gz: bc91b3afbd8329ddce18399cdd68b5963ae93e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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-
|
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.
|
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.
|