procon_bypass_man 0.1.2 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +23 -0
- data/.rubocop.yml +24 -0
- data/CHANGELOG.md +27 -8
- data/Gemfile +2 -0
- data/Gemfile.lock +24 -1
- data/README.md +34 -115
- data/docs/setup_raspi.md +4 -1
- data/examples/pbm.service +27 -0
- data/examples/practical/app.rb +8 -3
- data/examples/practical/setting.yml +1 -1
- data/lib/procon_bypass_man.rb +38 -10
- data/lib/procon_bypass_man/configuration.rb +10 -7
- data/lib/procon_bypass_man/configuration/layer.rb +39 -10
- data/lib/procon_bypass_man/configuration/loader.rb +17 -16
- data/lib/procon_bypass_man/configuration/validator.rb +70 -5
- data/lib/procon_bypass_man/device_connector.rb +336 -0
- data/lib/procon_bypass_man/io_monitor.rb +0 -8
- data/lib/procon_bypass_man/procon.rb +20 -11
- data/lib/procon_bypass_man/procon/button_collection.rb +3 -2
- data/lib/procon_bypass_man/procon/flip_cache.rb +22 -0
- data/lib/procon_bypass_man/procon/pressed_button_helper.rb +1 -1
- data/lib/procon_bypass_man/runner.rb +36 -35
- data/lib/procon_bypass_man/timer.rb +14 -0
- data/lib/procon_bypass_man/version.rb +1 -1
- data/procon_bypass_man.gemspec +2 -2
- metadata +13 -9
- data/CODE_OF_CONDUCT.md +0 -84
- data/lib/procon_bypass_man/device_registry.rb +0 -41
@@ -1,41 +0,0 @@
|
|
1
|
-
class ProconBypassMan::DeviceRegistry
|
2
|
-
PROCON_PATH = "/dev/hidraw0"
|
3
|
-
PROCON2_PATH = "/dev/hidraw1"
|
4
|
-
|
5
|
-
def gadget
|
6
|
-
@gadget
|
7
|
-
end
|
8
|
-
|
9
|
-
def procon
|
10
|
-
@procon
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
init_devices
|
15
|
-
end
|
16
|
-
|
17
|
-
# @return [void]
|
18
|
-
def init_devices
|
19
|
-
loop do
|
20
|
-
case
|
21
|
-
when File.exist?(PROCON_PATH)
|
22
|
-
system('echo > /sys/kernel/config/usb_gadget/procon/UDC')
|
23
|
-
system('ls /sys/class/udc > /sys/kernel/config/usb_gadget/procon/UDC')
|
24
|
-
sleep 0.5
|
25
|
-
@gadget = File.open('/dev/hidg0', "w+")
|
26
|
-
@procon = File.open(PROCON_PATH, "w+")
|
27
|
-
break
|
28
|
-
when File.exist?(PROCON2_PATH)
|
29
|
-
system('echo > /sys/kernel/config/usb_gadget/procon/UDC')
|
30
|
-
system('ls /sys/class/udc > /sys/kernel/config/usb_gadget/procon/UDC')
|
31
|
-
sleep 0.5
|
32
|
-
@gadget = File.open('/dev/hidg0', "w+")
|
33
|
-
@procon = File.open(PROCON2_PATH, "w+")
|
34
|
-
break
|
35
|
-
else
|
36
|
-
puts "プロコンをラズベイに挿してください"
|
37
|
-
sleep(1)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|