vigilem-evdev 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/ext/Rakefile +31 -0
- data/ext/rake_helper.rb +10 -0
- data/lib/vigilem/_evdev.rb +24 -0
- data/lib/vigilem/evdev.rb +14 -0
- data/lib/vigilem/evdev/at_exit.rb +8 -0
- data/lib/vigilem/evdev/context_filter.rb +92 -0
- data/lib/vigilem/evdev/demultiplexer.rb +26 -0
- data/lib/vigilem/evdev/device.rb +182 -0
- data/lib/vigilem/evdev/device_capabilities.rb +53 -0
- data/lib/vigilem/evdev/dom.rb +8 -0
- data/lib/vigilem/evdev/dom/adapter.rb +87 -0
- data/lib/vigilem/evdev/dom/code_values_tables.rb +172 -0
- data/lib/vigilem/evdev/dom/input_event_converter.rb +329 -0
- data/lib/vigilem/evdev/dom/input_event_utils.rb +48 -0
- data/lib/vigilem/evdev/dom/key_values_tables.rb +248 -0
- data/lib/vigilem/evdev/dom/kp_table.rb +52 -0
- data/lib/vigilem/evdev/focus_context_filter.rb +124 -0
- data/lib/vigilem/evdev/input_system_handler.rb +69 -0
- data/lib/vigilem/evdev/key_map_cache.rb +64 -0
- data/lib/vigilem/evdev/multiplexer.rb +73 -0
- data/lib/vigilem/evdev/system.rb +17 -0
- data/lib/vigilem/evdev/system/input.rb +1053 -0
- data/lib/vigilem/evdev/system/input/event.rb +4 -0
- data/lib/vigilem/evdev/system/input/input_event.rb +33 -0
- data/lib/vigilem/evdev/system/int.rb +9 -0
- data/lib/vigilem/evdev/system/ioctl.rb +143 -0
- data/lib/vigilem/evdev/system/keymap_loaders.rb +89 -0
- data/lib/vigilem/evdev/system/keymap_loaders/dumpkeys_loader.rb +98 -0
- data/lib/vigilem/evdev/system/keymap_loaders/kmap_loader.rb +74 -0
- data/lib/vigilem/evdev/system/posix_types.rb +5 -0
- data/lib/vigilem/evdev/system/time.rb +21 -0
- data/lib/vigilem/evdev/transfer_agent.rb +40 -0
- data/lib/vigilem/evdev/version.rb +5 -0
- data/lib/vigilem/evdev/vty_context_filter.rb +216 -0
- data/spec/after_each_example_group.rb +29 -0
- data/spec/delete_test_cache_after_group.rb +26 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/vigilem/_evdev_spec.rb +11 -0
- data/spec/vigilem/evdev/context_filter_spec.rb +114 -0
- data/spec/vigilem/evdev/demultiplexer_spec.rb +44 -0
- data/spec/vigilem/evdev/device_capabilities_spec.rb +0 -0
- data/spec/vigilem/evdev/device_spec.rb +97 -0
- data/spec/vigilem/evdev/dom/adapter_spec.rb +5 -0
- data/spec/vigilem/evdev/dom/input_event_converter_spec.rb +253 -0
- data/spec/vigilem/evdev/dom/input_event_utils_spec.rb +23 -0
- data/spec/vigilem/evdev/focus_context_filter_spec.rb +112 -0
- data/spec/vigilem/evdev/input_system_handler_spec.rb +146 -0
- data/spec/vigilem/evdev/key_map_cache_spec.rb +65 -0
- data/spec/vigilem/evdev/multiplexer_spec.rb +55 -0
- data/spec/vigilem/evdev/system/input/input_event_spec.rb +33 -0
- data/spec/vigilem/evdev/system/input_spec.rb +274 -0
- data/spec/vigilem/evdev/system/int_spec.rb +30 -0
- data/spec/vigilem/evdev/system/ioctl_spec.rb +206 -0
- data/spec/vigilem/evdev/system/keymap_loaders/dumpkeys_loader_spec.rb +5 -0
- data/spec/vigilem/evdev/system/keymap_loaders/kmap_loader_spec.rb +24 -0
- data/spec/vigilem/evdev/system/keymap_loaders_spec.rb +22 -0
- data/spec/vigilem/evdev/system/posix_types_spec.rb +15 -0
- data/spec/vigilem/evdev/system/time_spec.rb +18 -0
- data/spec/vigilem/evdev/transfer_agent_spec.rb +57 -0
- data/spec/vigilem/evdev/vty_context_filter_spec.rb +282 -0
- metadata +286 -0
@@ -0,0 +1,146 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'vigilem/evdev/input_system_handler'
|
4
|
+
|
5
|
+
require 'timeout'
|
6
|
+
|
7
|
+
# @todo allow(inst).to receive(:filtered?) { true }
|
8
|
+
describe Vigilem::Evdev::InputSystemHandler, :clean_up_test_cache do
|
9
|
+
|
10
|
+
after(:each) do
|
11
|
+
[(v = ::Vigilem)::Evdev::TransferAgent, v::Evdev::Demultiplexer,
|
12
|
+
described_class, v::Evdev::Multiplexer].each do |klass|
|
13
|
+
(klass.instance_variables).each {|ivar| klass.send(:remove_instance_variable, ivar) }
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:pipes1) { IO.pipe }
|
18
|
+
|
19
|
+
let(:pipes2) { IO.pipe }
|
20
|
+
|
21
|
+
let(:pipes3) { IO.pipe }
|
22
|
+
|
23
|
+
let(:input_event) { Vigilem::Evdev::System::Input::InputEvent }
|
24
|
+
|
25
|
+
let(:read_pipes) { [pipes1, pipes2, pipes3].map(&:first) }
|
26
|
+
|
27
|
+
let(:write_pipes) { [pipes1, pipes2, pipes3].map(&:last) }
|
28
|
+
|
29
|
+
describe '#initialize' do
|
30
|
+
it 'sets up the transfer_agent' do
|
31
|
+
sys = described_class.new([])
|
32
|
+
expect(sys.instance_variable_get(:@transfer_agent)).not_to be_nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'post init' do
|
37
|
+
|
38
|
+
subject do
|
39
|
+
inst = described_class.new(*read_pipes)
|
40
|
+
inst.context_filters.replace([])
|
41
|
+
inst
|
42
|
+
end
|
43
|
+
|
44
|
+
let(:written_events) { [input_event[[7, 8], 1, 30, 1], input_event[[12, 13], 1, 30, 0]].sort {|a, b| a.time.to_f <=> b.time.to_f} }
|
45
|
+
|
46
|
+
let(:one) { written_events[0] }
|
47
|
+
|
48
|
+
let(:one_bytes) { one.bytes }
|
49
|
+
|
50
|
+
let(:two) { written_events[1] }
|
51
|
+
|
52
|
+
let(:two_bytes) { two.bytes }
|
53
|
+
|
54
|
+
describe '#read_many_nonblock' do
|
55
|
+
|
56
|
+
it 'reads messages without blocking from the source' do
|
57
|
+
expect do
|
58
|
+
Timeout.timeout(5) do
|
59
|
+
subject.read_many_nonblock
|
60
|
+
end
|
61
|
+
end.not_to raise_error
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'defaults to one message' do
|
65
|
+
write_pipes[0] << one_bytes
|
66
|
+
write_pipes[2] << two_bytes
|
67
|
+
expect(subject.read_many_nonblock.map(&:bytes).join).to eql(one_bytes)
|
68
|
+
end
|
69
|
+
|
70
|
+
it %q<will read as many of the `max_number_of_events' as available> do
|
71
|
+
write_pipes[0] << one_bytes
|
72
|
+
write_pipes[2] << two_bytes
|
73
|
+
expect(subject.read_many_nonblock(4).map(&:bytes)).to eql([one_bytes, two_bytes])
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '#read_one_nonblock' do
|
79
|
+
it 'attempts to reads one message without blocking from the source' do
|
80
|
+
expect do
|
81
|
+
Timeout.timeout(7) do
|
82
|
+
subject.read_one_nonblock
|
83
|
+
end
|
84
|
+
end.not_to raise_error
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'reads one message' do
|
88
|
+
write_pipes[0] << one_bytes
|
89
|
+
write_pipes[2] << two_bytes
|
90
|
+
expect(subject.read_one_nonblock.bytes).to eql(one_bytes)
|
91
|
+
end
|
92
|
+
|
93
|
+
it %q<will read one of the available messages> do
|
94
|
+
write_pipes[0] << one_bytes
|
95
|
+
write_pipes[2] << two_bytes
|
96
|
+
expect(subject.read_one_nonblock.bytes).to eql(one_bytes)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe '#read_many' do
|
101
|
+
|
102
|
+
it 'reads messages blocking if source is empty' do
|
103
|
+
expect do
|
104
|
+
Timeout.timeout(3) do
|
105
|
+
subject.read_many
|
106
|
+
end
|
107
|
+
end.to raise_error(Timeout::Error)
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'defaults to one message' do
|
111
|
+
write_pipes[0] << one_bytes
|
112
|
+
write_pipes[2] << two_bytes
|
113
|
+
expect(Timeout.timeout(6) { subject.read_many.first.bytes }).to eql(one_bytes)
|
114
|
+
end
|
115
|
+
|
116
|
+
it %q<will read the number of messages equal to parameter passed in> do
|
117
|
+
write_pipes[0] << one_bytes
|
118
|
+
write_pipes[2] << two_bytes
|
119
|
+
expect(Timeout.timeout(6) { subject.read_many(2).map(&:bytes) }).to eql([one_bytes, two_bytes])
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe '#read_one' do
|
124
|
+
it 'reads a single message, blocking if source is empty' do
|
125
|
+
expect do
|
126
|
+
Timeout.timeout(6) do
|
127
|
+
subject.read_one
|
128
|
+
end
|
129
|
+
end.to raise_error(Timeout::Error)
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'defaults to one message' do
|
133
|
+
write_pipes[0] << one_bytes
|
134
|
+
write_pipes[2] << two_bytes
|
135
|
+
expect(Timeout.timeout(6) { subject.read_one.bytes }).to eql(one_bytes)
|
136
|
+
end
|
137
|
+
|
138
|
+
it %q<will read the number of messages equal to parameter passed in> do
|
139
|
+
write_pipes[0] << one_bytes
|
140
|
+
write_pipes[2] << two_bytes
|
141
|
+
expect(Timeout.timeout(6) { subject.read_one.bytes }).to eql(one_bytes)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'vigilem/evdev/key_map_cache'
|
4
|
+
|
5
|
+
describe Vigilem::Evdev::KeyMapCache do
|
6
|
+
|
7
|
+
context 'unaugmented filename' do
|
8
|
+
|
9
|
+
describe '::default_filename' do
|
10
|
+
it %q<returns the default filename> do
|
11
|
+
expect(described_class.default_filename).to eql('key_map_cache')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '::default_path' do
|
16
|
+
|
17
|
+
let(:filepath) { File.join(Bundler.root, 'data', described_class.default_filename) }
|
18
|
+
|
19
|
+
it %q<returns the default path> do
|
20
|
+
expect(described_class.default_path).to eql(filepath)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'augmented filename for test', :clean_up_test_cache do
|
26
|
+
|
27
|
+
let(:test_filename) { 'key_map_cache_test' }
|
28
|
+
|
29
|
+
let(:test_cache_path) { File.join(Bundler.root, 'data', test_filename) }
|
30
|
+
|
31
|
+
describe '::exists?' do
|
32
|
+
|
33
|
+
it %q<returns false when the file doesn't exist> do
|
34
|
+
expect(described_class.exists?).to eql(false)
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'testfile block' do
|
38
|
+
it %q<returns true when the file does exist> do
|
39
|
+
FileUtils.touch(test_cache_path)
|
40
|
+
expect(described_class.exists?).to eql(true)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
let(:key_map) { Vigilem::Support::KeyMap.new("keycode1"=>"Escape") }
|
47
|
+
|
48
|
+
describe '::dump' do
|
49
|
+
|
50
|
+
it 'marshals the key_map and stores it in the #default_path' do
|
51
|
+
described_class.dump(key_map, test_cache_path)
|
52
|
+
expect(File.binread(test_cache_path)).to eql(Marshal.dump(key_map))
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '::restore' do
|
57
|
+
|
58
|
+
it 'marshals the key_map and stores it in the #default_path' do
|
59
|
+
described_class.dump(key_map, test_cache_path)
|
60
|
+
expect(described_class.restore(test_cache_path)).to eql(key_map)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'vigilem/evdev/multiplexer'
|
2
|
+
|
3
|
+
describe Vigilem::Evdev::Multiplexer do
|
4
|
+
|
5
|
+
let(:input_event) { Vigilem::Evdev::System::Input::InputEvent }
|
6
|
+
|
7
|
+
let(:out) { [] }
|
8
|
+
|
9
|
+
let(:pipes1) { IO.pipe }
|
10
|
+
|
11
|
+
let(:pipes2) { IO.pipe }
|
12
|
+
|
13
|
+
let(:pipes3) { IO.pipe }
|
14
|
+
|
15
|
+
subject { described_class.acquire([pipes1, pipes2, pipes3].map(&:first)) }
|
16
|
+
|
17
|
+
describe '#sweep' do
|
18
|
+
it %q<checks the io's and returns sorted InputEvents> do
|
19
|
+
written_events = [input_event[[7, 8], 9, 10, 11], input_event[[12, 13], 14, 15, 16]]
|
20
|
+
pipes1.last << written_events[0].bytes
|
21
|
+
pipes2.last << written_events[1].bytes
|
22
|
+
expect(subject.sweep(1).map(&:bytes)).to eql(written_events.sort {|a,b| a.time.to_f <=> b.time.to_f }.map(&:bytes))
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '::acquire' do
|
27
|
+
|
28
|
+
let(:singleton_var_name) { :@multiplexer }
|
29
|
+
|
30
|
+
context 'none exists' do
|
31
|
+
before(:all) { described_class.send(:remove_instance_variable, :@multiplexer) }
|
32
|
+
|
33
|
+
it 'the class instance variable will be nil' do
|
34
|
+
expect(described_class.instance_variable_get(singleton_var_name)).to be_nil
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'creates a new one' do
|
38
|
+
expect(described_class.acquire()).to be_a described_class
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'the class instance variable will be set' do
|
42
|
+
expect(described_class.instance_variable_get(singleton_var_name)).not_to be_nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'one exists' do
|
47
|
+
|
48
|
+
it 'grabs the existing one' do
|
49
|
+
described_class.acquire
|
50
|
+
expect(described_class.acquire()).to eql(described_class.instance_variable_get(singleton_var_name))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'vigilem/evdev/system/input/input_event'
|
4
|
+
|
5
|
+
describe Vigilem::Evdev::System::Input do
|
6
|
+
describe described_class::InputEvent do
|
7
|
+
describe 'structure' do
|
8
|
+
it 'will respond_to #time' do
|
9
|
+
expect(subject).to respond_to(:time)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'will respond_to #type' do
|
13
|
+
expect(subject).to respond_to(:type)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'will respond_to #code' do
|
17
|
+
expect(subject).to respond_to(:code)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'will respond_to #value' do
|
21
|
+
expect(subject).to respond_to(:value)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '#time' do
|
27
|
+
it 'will return with a Timeval' do
|
28
|
+
expect(subject.time).to be_a Vigilem::Evdev::Time::Timeval
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,274 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'vigilem/evdev/system/input'
|
4
|
+
|
5
|
+
describe Vigilem::Evdev::System::Input do
|
6
|
+
|
7
|
+
class EVIOC
|
8
|
+
inline do |builder|
|
9
|
+
builder.include '<stdio.h>'
|
10
|
+
builder.include '<sys/ioctl.h>'
|
11
|
+
builder.include '<linux/input.h>'
|
12
|
+
builder.include '<fcntl.h>'
|
13
|
+
builder.include '<stddef.h>'
|
14
|
+
%w(EVIOCGVERSION EVIOCGID EVIOCGREP EVIOCSREP EVIOCGKEYCODE EVIOCGKEYCODE_V2
|
15
|
+
EVIOCSKEYCODE EVIOCSKEYCODE_V2
|
16
|
+
EVIOCSFF EVIOCRMFF EVIOCGEFFECTS EVIOCGRAB).map do |mac|
|
17
|
+
builder.c "
|
18
|
+
long #{mac.gsub(/EVIOC/, '').downcase}() {
|
19
|
+
return #{mac};
|
20
|
+
}
|
21
|
+
"
|
22
|
+
end
|
23
|
+
%w(EVIOCGNAME EVIOCGPHYS EVIOCGUNIQ EVIOCGPROP EVIOCGKEY EVIOCGLED
|
24
|
+
EVIOCGSND EVIOCGSW).map do |mac|
|
25
|
+
builder.c "
|
26
|
+
long #{mac.gsub(/EVIOC/, '').downcase}(int len) {
|
27
|
+
return #{mac}(len);
|
28
|
+
}
|
29
|
+
"
|
30
|
+
end
|
31
|
+
if $major >= 3 and $minor >= 4
|
32
|
+
builder.c "
|
33
|
+
long gmtslots(int len) {
|
34
|
+
return EVIOCGMTSLOTS(len);
|
35
|
+
}
|
36
|
+
"
|
37
|
+
builder.c "
|
38
|
+
long sclockid() {
|
39
|
+
return EVIOCSCLOCKID;
|
40
|
+
}
|
41
|
+
"
|
42
|
+
$gmtslots_sclockid = true
|
43
|
+
else
|
44
|
+
warn 'EVIOCGMTSLOTS and EVIOCSCLOCKID untestable'
|
45
|
+
$gmtslots_sclockid = false
|
46
|
+
end
|
47
|
+
|
48
|
+
if $major >= 3 and $minor >= 12
|
49
|
+
builder.c "
|
50
|
+
long _revoke() {
|
51
|
+
return EVIOCREVOKE;
|
52
|
+
}
|
53
|
+
"
|
54
|
+
$revoke = true
|
55
|
+
else
|
56
|
+
warn 'EVIOCREVOKE untestable'
|
57
|
+
$revoke = false
|
58
|
+
end
|
59
|
+
|
60
|
+
builder.c "
|
61
|
+
long gbit(int evtype, int len) {
|
62
|
+
return EVIOCGBIT(evtype, len);
|
63
|
+
}
|
64
|
+
"
|
65
|
+
builder.c "
|
66
|
+
long gabs(int abs) {
|
67
|
+
return EVIOCGABS(abs);
|
68
|
+
}
|
69
|
+
"
|
70
|
+
builder.c "
|
71
|
+
long sabs(int abs) {
|
72
|
+
return EVIOCSABS(abs);
|
73
|
+
}
|
74
|
+
"
|
75
|
+
|
76
|
+
builder.c '
|
77
|
+
long size_of_input_keymap_entry() {
|
78
|
+
return sizeof(struct input_keymap_entry);
|
79
|
+
}
|
80
|
+
'
|
81
|
+
|
82
|
+
builder.c '
|
83
|
+
long size_of_ff_effect() {
|
84
|
+
return sizeof(struct ff_effect);
|
85
|
+
}
|
86
|
+
'
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
let(:evioc) { EVIOC.new }
|
92
|
+
|
93
|
+
describe 'input_keymap_entry' do
|
94
|
+
it 'sizeof(input_keymap_entry) will eql it\'s linux counterpart' do
|
95
|
+
expect(Vigilem::Support::Sys.sizeof(described_class.input_keymap_entry)).to eql(evioc.size_of_input_keymap_entry)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe 'ff_effect' do
|
100
|
+
it 'sizeof(ff_effect) will eql it\'s linux counterpart' do
|
101
|
+
expect(described_class::FFEffect.size).to eql(evioc.size_of_ff_effect)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe '::EVIOCGVERSION' do
|
106
|
+
it 'will not be zero' do
|
107
|
+
expect(described_class.EVIOCGVERSION).not_to eql(0)
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'will equal the macro specified in input.h' do
|
111
|
+
expect(described_class.EVIOCGVERSION).to eql(evioc.gversion)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe '::EVIOCGID' do
|
116
|
+
it 'will equal the macro specified in input.h' do
|
117
|
+
expect(described_class.EVIOCGID).to eql(evioc.gid)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe '::EVIOCGREP' do
|
122
|
+
it 'will equal the macro specified in input.h' do
|
123
|
+
expect(described_class.EVIOCGREP).to eql(evioc.grep)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe '::EVIOCSREP' do
|
128
|
+
it 'will equal the macro specified in input.h' do
|
129
|
+
expect(described_class.EVIOCSREP).to eql(evioc.srep)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
if $gmtslots_sclockid
|
134
|
+
describe '::EVIOCGMTSLOTS' do
|
135
|
+
it 'will equal the macro specified in input.h' do
|
136
|
+
expect(described_class.EVIOCGMTSLOTS(3)).to eql(evioc.gmtslots(3))
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
describe '::EVIOCGKEYCODE' do
|
142
|
+
it 'will equal the macro specified in input.h' do
|
143
|
+
expect(described_class.EVIOCGKEYCODE).to eql(evioc.gkeycode)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
let(:ioc_r) { described_class::_IOC_READ }
|
148
|
+
|
149
|
+
describe '::EVIOCGKEYCODE_V2' do
|
150
|
+
it 'will equal the macro specified in input.h' do
|
151
|
+
expect(described_class.EVIOCGKEYCODE_V2).to eql(evioc.gkeycode_v2)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
describe '::EVIOCSKEYCODE' do
|
156
|
+
it 'will equal the macro specified in input.h' do
|
157
|
+
expect(described_class.EVIOCSKEYCODE).to eql(evioc.skeycode)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
describe '::EVIOCSKEYCODE_V2' do
|
162
|
+
it 'will equal the macro specified in input.h' do
|
163
|
+
expect(described_class.EVIOCSKEYCODE_V2).to eql(evioc.skeycode_v2)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
describe '::EVIOCGNAME' do
|
168
|
+
it 'will equal the macro specified in input.h' do
|
169
|
+
expect(described_class.EVIOCGNAME(255)).to eql(evioc.gname(255))
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe '::EVIOCGPHYS' do
|
174
|
+
it 'will equal the macro specified in input.h' do
|
175
|
+
expect(described_class.EVIOCGPHYS(255)).to eql(evioc.gphys(255))
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
describe '::EVIOCGUNIQ' do
|
180
|
+
it 'will equal the macro specified in input.h' do
|
181
|
+
expect(described_class.EVIOCGUNIQ(255)).to eql(evioc.guniq(255))
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
describe '::EVIOCGPROP' do
|
186
|
+
it 'will equal the macro specified in input.h' do
|
187
|
+
expect(described_class.EVIOCGPROP(255)).to eql(evioc.gprop(255))
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
describe '::EVIOCGKEY' do
|
192
|
+
it 'will equal the macro specified in input.h' do
|
193
|
+
expect(described_class.EVIOCGKEY(255)).to eql(evioc.gkey(255))
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
describe '::EVIOCGLED' do
|
198
|
+
it 'will equal the macro specified in input.h' do
|
199
|
+
expect(described_class.EVIOCGLED(255)).to eql(evioc.gled(255))
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
describe '::EVIOCGSND' do
|
204
|
+
it 'will equal the macro specified in input.h' do
|
205
|
+
expect(described_class.EVIOCGSND(255)).to eql(evioc.gsnd(255))
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
describe '::EVIOCGSW' do
|
210
|
+
it 'will equal the macro specified in input.h' do
|
211
|
+
expect(described_class::EVIOCGSW(255)).to eql(evioc.gsw(255))
|
212
|
+
end
|
213
|
+
end
|
214
|
+
=begin # @todo
|
215
|
+
describe '::EVIOCGBIT' do
|
216
|
+
it 'will equal the macro specified in input.h' do
|
217
|
+
expect(described_class::EVIOCGBIT(evtype, len)).to eql(evioc.gbit(evtype, len))
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
describe '::EVIOCGABS' do
|
222
|
+
it 'will equal the macro specified in input.h' do
|
223
|
+
expect(described_class::EVIOCGABS(abs)).to eql(evioc.gabs(abs))
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
describe '::EVIOCSABS' do
|
228
|
+
it 'will equal the macro specified in input.h' do
|
229
|
+
expect(described_class::EVIOCSABS(abs)).to eql(evioc.sabs(abs))
|
230
|
+
end
|
231
|
+
end
|
232
|
+
=end
|
233
|
+
describe '::EVIOCSFF' do
|
234
|
+
it 'will equal the macro specified in input.h' do
|
235
|
+
expect(described_class.EVIOCSFF).to eql(evioc.sff)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
describe '::EVIOCRMFF' do
|
240
|
+
it 'will equal the macro specified in input.h' do
|
241
|
+
expect(described_class.EVIOCRMFF()).to eql(evioc.rmff)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
describe '::EVIOCGEFFECTS' do
|
246
|
+
it 'will equal the macro specified in input.h' do
|
247
|
+
expect(described_class.EVIOCGEFFECTS()).to eql(evioc.geffects)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
describe '::EVIOCGRAB' do
|
252
|
+
it 'will equal the macro specified in input.h' do
|
253
|
+
expect(described_class.EVIOCGRAB()).to eql(evioc.grab)
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
# @todo switch to optinos flag >=3.4
|
258
|
+
if $revoke
|
259
|
+
describe '::EVIOCREVOKE', '>=v4.3' do
|
260
|
+
it 'will equal the macro specified in input.h' do
|
261
|
+
expect(described_class.EVIOCREVOKE()).to eql(evioc._revoke)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
if $gmtslots_sclockid
|
267
|
+
describe '::EVIOCSCLOCKID' do
|
268
|
+
it 'will equal the macro specified in input.h' do
|
269
|
+
expect(described_class.EVIOCSCLOCKID()).to eql(evioc.sclockid)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|