procon_bypass_man 0.1.4 → 0.1.8
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 +40 -13
- data/.github/workflows/ruby.yml +33 -0
- data/.rubocop.yml +24 -0
- data/CHANGELOG.md +19 -1
- data/Gemfile +1 -0
- data/Gemfile.lock +25 -3
- data/README.md +12 -9
- data/Rakefile +10 -1
- data/docs/setup_raspi.md +12 -7
- data/docs/setup_raspi.mitamae.rb +48 -0
- data/docs/setup_raspi_by_mitamae.md +14 -0
- data/examples/practical/app.rb +2 -2
- data/lib/procon_bypass_man/configuration/layer.rb +30 -6
- 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/configuration.rb +10 -7
- data/lib/procon_bypass_man/device_connector.rb +336 -0
- data/lib/procon_bypass_man/procon/button_collection.rb +3 -2
- data/lib/procon_bypass_man/procon/pressed_button_helper.rb +1 -1
- data/lib/procon_bypass_man/procon.rb +9 -7
- data/lib/procon_bypass_man/runner.rb +16 -39
- data/lib/procon_bypass_man/timer.rb +14 -0
- data/lib/procon_bypass_man/uptime.rb +13 -0
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man.rb +19 -4
- data/procon_bypass_man.gemspec +1 -1
- data/project_template/README.md +17 -0
- data/project_template/app.rb +18 -0
- data/project_template/setting.yml +35 -0
- data/project_template/systemd_units/pbm.service +13 -0
- metadata +16 -8
- data/examples/pbm.service +0 -27
- data/examples/simple.rb +0 -13
- data/lib/procon_bypass_man/device_registry.rb +0 -42
@@ -0,0 +1,35 @@
|
|
1
|
+
version: 1.0
|
2
|
+
setting: |-
|
3
|
+
fast_return = ProconBypassMan::Splatoon2::Macro::FastReturn
|
4
|
+
guruguru = ProconBypassMan::Splatoon2::Mode::Guruguru
|
5
|
+
|
6
|
+
install_macro_plugin fast_return
|
7
|
+
install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToUpKey
|
8
|
+
install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToRightKey
|
9
|
+
install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToLeftKey
|
10
|
+
install_mode_plugin guruguru
|
11
|
+
|
12
|
+
prefix_keys_for_changing_layer [:zr, :zl, :l]
|
13
|
+
|
14
|
+
layer :up, mode: :manual do
|
15
|
+
# flip :zr, if_pressed: :zr, force_neutral: :zl
|
16
|
+
flip :zr, if_pressed: :zr, force_neutral: :zl
|
17
|
+
flip :zl, if_pressed: [:y, :b, :zl]
|
18
|
+
flip :a, if_pressed: [:a]
|
19
|
+
flip :down, if_pressed: :down
|
20
|
+
macro fast_return.name, if_pressed: [:y, :b, :down]
|
21
|
+
macro ProconBypassMan::Splatoon2::Macro::JumpToUpKey, if_pressed: [:y, :b, :up]
|
22
|
+
macro ProconBypassMan::Splatoon2::Macro::JumpToRightKey, if_pressed: [:y, :b, :right]
|
23
|
+
macro ProconBypassMan::Splatoon2::Macro::JumpToLeftKey, if_pressed: [:y, :b, :left]
|
24
|
+
remap :l, to: :zr
|
25
|
+
end
|
26
|
+
layer :right, mode: guruguru.name
|
27
|
+
layer :left do
|
28
|
+
# flip :zr, if_pressed: :zr, force_neutral: :zl
|
29
|
+
remap :l, to: :zr
|
30
|
+
end
|
31
|
+
layer :down do
|
32
|
+
# flip :zl
|
33
|
+
# flip :zr, if_pressed: :zr, force_neutral: :zl, flip_interval: "1F"
|
34
|
+
remap :l, to: :zr
|
35
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=PBM
|
3
|
+
After=network.target
|
4
|
+
|
5
|
+
[Service]
|
6
|
+
Type=simple
|
7
|
+
WorkingDirectory=/usr/share/pbm/current
|
8
|
+
ExecStart=/bin/bash -c "/home/pi/.rbenv/versions/3.0.1/bin/ruby /usr/share/pbm/current/app.rb"
|
9
|
+
Restart=always
|
10
|
+
Nice=-19
|
11
|
+
|
12
|
+
[Install]
|
13
|
+
WantedBy=multi-user.target
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: procon_bypass_man
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jiikko
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: extension for Nintendo Switch Pro Controller
|
14
14
|
email:
|
@@ -18,8 +18,10 @@ extensions: []
|
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
20
|
- ".circleci/config.yml"
|
21
|
+
- ".github/workflows/ruby.yml"
|
21
22
|
- ".gitignore"
|
22
23
|
- ".rspec"
|
24
|
+
- ".rubocop.yml"
|
23
25
|
- ".ruby-version"
|
24
26
|
- CHANGELOG.md
|
25
27
|
- Gemfile
|
@@ -31,17 +33,17 @@ files:
|
|
31
33
|
- bin/setup
|
32
34
|
- docs/how_to_connect_procon.md
|
33
35
|
- docs/setup_raspi.md
|
34
|
-
-
|
36
|
+
- docs/setup_raspi.mitamae.rb
|
37
|
+
- docs/setup_raspi_by_mitamae.md
|
35
38
|
- examples/practical/app.rb
|
36
39
|
- examples/practical/setting.yml
|
37
|
-
- examples/simple.rb
|
38
40
|
- lib/procon_bypass_man.rb
|
39
41
|
- lib/procon_bypass_man/bypass.rb
|
40
42
|
- lib/procon_bypass_man/configuration.rb
|
41
43
|
- lib/procon_bypass_man/configuration/layer.rb
|
42
44
|
- lib/procon_bypass_man/configuration/loader.rb
|
43
45
|
- lib/procon_bypass_man/configuration/validator.rb
|
44
|
-
- lib/procon_bypass_man/
|
46
|
+
- lib/procon_bypass_man/device_connector.rb
|
45
47
|
- lib/procon_bypass_man/io_monitor.rb
|
46
48
|
- lib/procon_bypass_man/processor.rb
|
47
49
|
- lib/procon_bypass_man/procon.rb
|
@@ -54,14 +56,20 @@ files:
|
|
54
56
|
- lib/procon_bypass_man/procon/pressed_button_helper.rb
|
55
57
|
- lib/procon_bypass_man/procon/user_operation.rb
|
56
58
|
- lib/procon_bypass_man/runner.rb
|
59
|
+
- lib/procon_bypass_man/timer.rb
|
60
|
+
- lib/procon_bypass_man/uptime.rb
|
57
61
|
- lib/procon_bypass_man/version.rb
|
58
62
|
- procon_bypass_man.gemspec
|
59
|
-
|
63
|
+
- project_template/README.md
|
64
|
+
- project_template/app.rb
|
65
|
+
- project_template/setting.yml
|
66
|
+
- project_template/systemd_units/pbm.service
|
67
|
+
homepage: https://github.com/splaplapla/procon_bypass_man
|
60
68
|
licenses:
|
61
69
|
- MIT
|
62
70
|
metadata:
|
63
|
-
homepage_uri: https://github.com/
|
64
|
-
source_code_uri: https://github.com/
|
71
|
+
homepage_uri: https://github.com/splaplapla/procon_bypass_man
|
72
|
+
source_code_uri: https://github.com/splaplapla/procon_bypass_man
|
65
73
|
post_install_message:
|
66
74
|
rdoc_options: []
|
67
75
|
require_paths:
|
data/examples/pbm.service
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# sudo ln -s /home/pi/src/procon_bypass_man/examples/pbm.service /etc/systemd/system/pbm.service
|
2
|
-
# Usage:
|
3
|
-
# systemctl daemon-reload
|
4
|
-
# systemctl enable pbm.service
|
5
|
-
# systemctl start pbm.service
|
6
|
-
# systemctl status pbm.service
|
7
|
-
# systemctl restart pbm.service
|
8
|
-
# Debug:
|
9
|
-
# journalctl -xe -f
|
10
|
-
# TODO:
|
11
|
-
# do not make PIDFILE
|
12
|
-
|
13
|
-
[Unit]
|
14
|
-
Description=PBM
|
15
|
-
# After=network-online.target
|
16
|
-
After=network.target
|
17
|
-
|
18
|
-
[Service]
|
19
|
-
Type=simple
|
20
|
-
# PIDFile=/home/pi/src/procon_bypass_man/pbm_pid
|
21
|
-
# WatchdogSec=60
|
22
|
-
WorkingDirectory=/home/pi/src/procon_bypass_man
|
23
|
-
ExecStart=/home/pi/.rbenv/versions/3.0.1/bin/ruby examples/practical/app.rb
|
24
|
-
Restart=always
|
25
|
-
|
26
|
-
[Install]
|
27
|
-
WantedBy=multi-user.target
|
data/examples/simple.rb
DELETED
@@ -1,42 +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
|
-
ProconBypassMan.logger.info("プロコンをラズベイに挿してください")
|
38
|
-
sleep(1)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|