5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/fusuma/plugin/remap/ruinput_device_patched.rb', line 5
def set_all_events
raise "invalid method call: this uinput is already created" if @is_created
mouse_btns = [
Revdev::BTN_0,
Revdev::BTN_MISC,
Revdev::BTN_1,
Revdev::BTN_2,
Revdev::BTN_3,
Revdev::BTN_4,
Revdev::BTN_5,
Revdev::BTN_6,
Revdev::BTN_7,
Revdev::BTN_8,
Revdev::BTN_9,
Revdev::BTN_LEFT,
Revdev::BTN_MOUSE,
Revdev::BTN_MIDDLE,
Revdev::BTN_RIGHT
].freeze
keyboard_keys = Revdev.constants.select { |c| c.start_with? "KEY_" }.map { |c| Revdev.const_get(c) }.freeze
@file.ioctl UI_SET_EVBIT, Revdev::EV_KEY
(Revdev::KEY_RESERVED...Revdev::KEY_CNT).each do |n|
next unless keyboard_keys.include?(n) || mouse_btns.include?(n)
@file.ioctl UI_SET_KEYBIT, n
end
@file.ioctl UI_SET_EVBIT, Revdev::EV_REP
end
|