procon_bypass_man 0.1.2 → 0.1.3
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 +20 -0
- data/CHANGELOG.md +10 -8
- data/Gemfile.lock +1 -1
- data/README.md +29 -110
- data/docs/setup_raspi.md +4 -1
- data/examples/pbm.service +27 -0
- data/examples/practical/app.rb +5 -1
- data/lib/procon_bypass_man.rb +17 -6
- data/lib/procon_bypass_man/device_registry.rb +1 -0
- data/lib/procon_bypass_man/io_monitor.rb +0 -8
- data/lib/procon_bypass_man/runner.rb +33 -14
- data/lib/procon_bypass_man/version.rb +1 -1
- data/procon_bypass_man.gemspec +1 -1
- metadata +6 -5
- data/CODE_OF_CONDUCT.md +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0ba281c9129f770b6cf905d9221bc39de1957f33d0091e2a5217c1fb4547be8
|
4
|
+
data.tar.gz: ca0fbffd26fb3a7ad928803ea912a1fe6412a4b8d10a65acefbc21d0fe2f0b49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0425a0610a7ec5d583724a167f45eaf8f352d552f4158901d02138dbfe89a5b66972f7767c72eab7ed30c6b199af25db10a1c9ef1fb826c188fc30255e81ea98
|
7
|
+
data.tar.gz: 271542b52dce9d7b0980fb5f97c4fbab80b8fa9f03fc726dbf5034899d8a4f7a7cbdc10456a6016bcc81c038d8f0f3463a732d4a4cf7f4940b2ab652d0125d58
|
@@ -0,0 +1,20 @@
|
|
1
|
+
version: 2.1
|
2
|
+
orbs:
|
3
|
+
ruby: circleci/ruby@0.1.2
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
docker:
|
8
|
+
- image: circleci/ruby:3.0.1
|
9
|
+
executor: ruby/default
|
10
|
+
steps:
|
11
|
+
- checkout
|
12
|
+
- run:
|
13
|
+
name: install bundler
|
14
|
+
command: gem install bundler:2.2.20
|
15
|
+
- run:
|
16
|
+
name: bundle install
|
17
|
+
command: bundle install --jobs 4
|
18
|
+
- run:
|
19
|
+
name: run test
|
20
|
+
command: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
## [0.1.
|
2
|
-
-
|
3
|
-
- 設定ファイルのライブリロードができるようになった
|
4
|
-
- 設定ファイルのバリデーションエラーとシンタックスエラーを投げるようになった
|
5
|
-
- key remap
|
6
|
-
- breking changes
|
7
|
-
- 設定情報をyamlで書くようになった
|
1
|
+
## [0.1.3] - 2021-07-03
|
2
|
+
- 接続のしやすさ向上
|
8
3
|
|
9
|
-
## [0.1.
|
4
|
+
## [0.1.2] - 2021-06-25
|
5
|
+
- 設定ファイルのライブリロードができるようになった
|
6
|
+
- tmp/pidにUSR2シグナルを送信すると設定を再読み込みする
|
7
|
+
- 設定ファイルのバリデーションエラーとシンタックスエラーを投げるようになった
|
8
|
+
- Support key remap
|
9
|
+
- 設定情報をyamlで書くようになった
|
10
|
+
|
11
|
+
## [0.1.1] - 2021-06-19
|
10
12
|
- プロコンの出力をLoggerに書き出す
|
11
13
|
- コマンドの標準出力にstatsを出す
|
12
14
|
- graceful shutdown
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,21 @@
|
|
1
1
|
# ProconBypassMan
|
2
|
-
*
|
2
|
+
* Switchに繋いだプロコンを連射機にしたり、キーのリマップをしたり、マクロを実行できるツールです
|
3
3
|
* 設定ファイルはrubyスクリプトで記述します
|
4
4
|
* 特定のタイトルに特化した振る舞いにしたい時は各プラグインを使ってください
|
5
5
|
|
6
|
+
![image](https://user-images.githubusercontent.com/1664497/123414210-942f6980-d5ee-11eb-8192-955bd9e37e0b.png)
|
7
|
+
|
8
|
+
```
|
9
|
+
@startuml
|
10
|
+
ProController --> (PBM): ZR押しっぱなし
|
11
|
+
Switch <-- (PBM): ZR連打
|
12
|
+
@enduml
|
13
|
+
```
|
14
|
+
|
6
15
|
## 使うハードウェア
|
7
16
|
* プロコン
|
8
17
|
* Switch本体とドック
|
9
|
-
* Raspberry Pi4
|
18
|
+
* Raspberry Pi4 Model B/4GB(Raspberry Pi OS (32-bit))
|
10
19
|
* 他のシリーズは未確認です
|
11
20
|
* データ通信が可能なUSBケーブル
|
12
21
|
|
@@ -15,101 +24,15 @@
|
|
15
24
|
* ruby-3.0.x
|
16
25
|
|
17
26
|
## Usage
|
18
|
-
*
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
# bundler inline
|
23
|
-
require 'bundler/inline'
|
24
|
-
|
25
|
-
gemfile do
|
26
|
-
gem 'procon_bypass_man', github: 'splaspla-hacker/procon_bypass_man', branch: "0.1.1"
|
27
|
-
end
|
28
|
-
|
29
|
-
ProconBypassMan.run(setting_path: "./setting.yml")
|
30
|
-
```
|
31
|
-
|
32
|
-
setting.yml
|
33
|
-
|
34
|
-
```yml
|
35
|
-
version: 1.0
|
36
|
-
setting: |-
|
37
|
-
prefix_keys_for_changing_layer [:zr, :r, :zl, :l]
|
38
|
-
layer :up do
|
39
|
-
flip :zr, if_pressed: :zr
|
40
|
-
flip :zl, if_pressed: [:y, :b, :zl]
|
41
|
-
flip :down, if_pressed: true
|
42
|
-
end
|
43
|
-
layer :right do
|
44
|
-
end
|
45
|
-
layer :left
|
46
|
-
layer :down do
|
47
|
-
flip :zl, if_pressed: true
|
48
|
-
remap :l, to: :zr
|
49
|
-
end
|
50
|
-
```
|
51
|
-
|
52
|
-
### プラグインを使った設定例
|
53
|
-
```ruby
|
54
|
-
#!/usr/bin/env ruby
|
55
|
-
|
56
|
-
require 'bundler/inline'
|
57
|
-
|
58
|
-
gemfile do
|
59
|
-
gem 'procon_bypass_man', github: 'splaspla-hacker/procon_bypass_man', branch: "0.1.1"
|
60
|
-
gem 'procon_bypass_man-splatoon2', github: 'splaspla-hacker/procon_bypass_man-splatoon2', branch: "0.1.0"
|
61
|
-
end
|
62
|
-
|
63
|
-
ProconBypassMan.run(setting_path: "./setting.yml")
|
64
|
-
```
|
65
|
-
setting.yml
|
66
|
-
|
67
|
-
```yml
|
68
|
-
version: 1.0
|
69
|
-
setting: |-
|
70
|
-
fast_return = ProconBypassMan::Splatoon2::Macro::FastReturn
|
71
|
-
guruguru = ProconBypassMan::Splatoon2::Mode::Guruguru
|
72
|
-
|
73
|
-
install_macro_plugin fast_return
|
74
|
-
install_mode_plugin guruguru
|
75
|
-
|
76
|
-
prefix_keys_for_changing_layer [:zr, :r, :zl, :l]
|
77
|
-
|
78
|
-
layer :up, mode: :manual do
|
79
|
-
flip :zr, if_pressed: :zr, force_neutral: :zl
|
80
|
-
flip :zl, if_pressed: [:y, :b, :zl]
|
81
|
-
flip :down, if_pressed: :down
|
82
|
-
macro fast_return.name, if_pressed: [:y, :b, :down]
|
83
|
-
end
|
84
|
-
layer :right, mode: guruguru.name
|
85
|
-
layer :left do
|
86
|
-
# no-op
|
87
|
-
end
|
88
|
-
layer :down do
|
89
|
-
flip :zl
|
90
|
-
end
|
91
|
-
```
|
92
|
-
|
93
|
-
* 設定ファイルの例
|
94
|
-
* https://github.com/jiikko/procon_bypass_man_sample
|
27
|
+
* USBガジェットモードで起動するRaspberry Pi4を用意する
|
28
|
+
* https://github.com/splaspla-hacker/procon_bypass_man/blob/master/docs/setup_raspi.md
|
29
|
+
* Raspberry Pi4で https://github.com/jiikko/procon_bypass_man_sample をclone して実行ファイルを動かす
|
30
|
+
* 実行ファイルと設定ファイルについては https://github.com/splaspla-hacker/procon_bypass_man/wiki に詳細を書いていますが、まず動かすためにはcloneしたほうが早いです
|
95
31
|
|
96
32
|
## Plugins
|
97
33
|
* https://github.com/splaspla-hacker/procon_bypass_man-splatoon2
|
98
34
|
|
99
|
-
## プラグインの作り方
|
100
|
-
https://github.com/splaspla-hacker/procon_bypass_man-splatoon2 を見てみてください
|
101
|
-
|
102
|
-
### モード
|
103
|
-
* name, binariesの持つオブジェクトを定義してください
|
104
|
-
* binariesには、Proconが出力するバイナリに対して16進数化した文字列を配列で定義してください
|
105
|
-
|
106
|
-
### マクロ
|
107
|
-
* name, stepsの持つメソッドをオブジェクトを定義してください
|
108
|
-
* stepsには、プロコンで入力ができるキーを配列で定義してください
|
109
|
-
* 現在はintervalは設定できません
|
110
|
-
|
111
35
|
## FAQ
|
112
|
-
### ソフトウェアについて
|
113
36
|
* どうやって動かすの?
|
114
37
|
* このツールはRaspberry Pi4をUSBガジェットモードで起動して有線でプロコンとSwitchに接続して使います
|
115
38
|
* どうやって使うの?
|
@@ -121,37 +44,33 @@ https://github.com/splaspla-hacker/procon_bypass_man-splatoon2 を見てみて
|
|
121
44
|
* マクロは特定のキーを順番に入れていく機能。キーの入力が終わったらマクロは終了する
|
122
45
|
* レイヤーとは?
|
123
46
|
* 自作キーボードみたいな感じでレイヤー毎に設定内容を記述して切り替えれる
|
47
|
+
* このツールでできることは?
|
48
|
+
* キーリマップ, 連射, マクロ, 特定の同じ操作の繰り返し(mode)
|
49
|
+
* リマップは1つのキーを別のキーに割り当てます
|
50
|
+
* 連射中には特定のキーの入力を無視したり、複数のキーをトリガーに連射することができます
|
51
|
+
* どうしてsudoが必要なの?
|
52
|
+
* 操作するdeviceファイルの所有者がrootだから
|
124
53
|
|
125
54
|
## TODO
|
126
|
-
* ログをfluentdへ送信
|
127
55
|
* 設定ファイルをwebから反映できる
|
128
|
-
* ケーブルの抜き差しなし再接続(厳しい)
|
129
|
-
* 接続確立後、プロセスを強制停止し、接続したままプロセスを再起動すると、USBの経由での接続ができなくなる
|
130
|
-
* ケーブルを抜いてからリトライすると改善する
|
131
|
-
* ケーブルで繋がっているけどswitchとプロコンがBluetoothで繋がっている状態かつ非充電状態だとバイパスができない、ということがわかった
|
132
|
-
* ラズパイとプロコン間でBluetooth接続できれば解決するかもしれない
|
133
|
-
* ジャイロの入力を取る方法がまだ発見できていないらしく厳しいことがわかった
|
134
|
-
* https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/issues/7
|
135
|
-
* それとSwitchOS 12からペアリングの仕様に変更があって類似ツールが動かなくっている
|
136
56
|
* ラズパイのプロビジョニングを楽にしたい
|
137
57
|
* レコーディング機能(プロコンの入力をマクロとして登録ができる)
|
138
|
-
* swtichとの接続完了はIOを見て判断する
|
139
58
|
* webページから設定ファイルを変更できるようにする(sshしたくない)
|
140
59
|
* webサーバのデーモンとPBMはプロセスを分ける(NOTE)
|
141
|
-
* プロセスを停止するときにtmp/pidを削除する
|
142
|
-
|
143
|
-
## Contributing
|
144
|
-
|
145
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/procon_bypass_man. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/procon_bypass_man/blob/master/CODE_OF_CONDUCT.md).
|
146
60
|
|
147
|
-
|
148
|
-
```
|
61
|
+
## 開発系
|
62
|
+
```ruby
|
149
63
|
ProconBypassMan.tap do |pbm|
|
150
|
-
pbm.logger =
|
64
|
+
pbm.logger = Logger.new("#{ProconBypassMan.root}/app.log", 5, 1024 * 1024 * 10)
|
151
65
|
pbm.logger.level = :debug
|
152
66
|
end
|
153
67
|
```
|
154
68
|
|
69
|
+
### プロコンとの接続を維持したまま、現在の設定ファイルをPBMに反映する
|
70
|
+
```shell
|
71
|
+
sudo kill -USR2 `cat ./pbm_pid`
|
72
|
+
```
|
73
|
+
|
155
74
|
## License
|
156
75
|
|
157
76
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/docs/setup_raspi.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Raspberry Pi4のセットアップ手順
|
2
|
-
* SD
|
2
|
+
* SDカードにRaspberry Pi OS (32-bit)を焼く
|
3
3
|
* SDカードをRaspberry Pi4本体に挿して起動する
|
4
4
|
* ラズパイGUI
|
5
5
|
* 無線LANに接続する
|
@@ -36,3 +36,6 @@
|
|
36
36
|
* cd ~ && mkdir -p src && cd ~/src && git clone https://github.com/jiikko/procon_bypass_man_sample && cd procon_bypass_man && sudo bundle install
|
37
37
|
|
38
38
|
おわり. 起動する時は都度sudo ruby app.rb を実行する
|
39
|
+
|
40
|
+
## 参考
|
41
|
+
* https://mtosak-tech.hatenablog.jp/entry/2020/08/22/114622
|
@@ -0,0 +1,27 @@
|
|
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/practical/app.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
# sudo ln -s /home/pi/src/procon_bypass_man/examples/practical/setting.yml /home/pi/src/procon_bypass_man/setting.yml
|
4
|
+
# cd src/procon_bypass_man
|
5
|
+
# sudo ruby examples/practical/app.rb
|
6
|
+
|
3
7
|
require 'bundler/inline'
|
4
8
|
|
5
9
|
gemfile do
|
@@ -9,7 +13,7 @@ gemfile do
|
|
9
13
|
end
|
10
14
|
|
11
15
|
ProconBypassMan.tap do |pbm|
|
12
|
-
pbm.logger = "
|
16
|
+
pbm.logger = Logger.new("#{ProconBypassMan.root}/app.log", 5, 1024 * 1024 * 10) # 5世代まで残して, 10MBでローテーション
|
13
17
|
pbm.logger.level = :debug
|
14
18
|
end
|
15
19
|
|
data/lib/procon_bypass_man.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "logger"
|
2
2
|
require 'yaml'
|
3
|
+
require "fileutils"
|
3
4
|
|
4
5
|
require_relative "procon_bypass_man/version"
|
5
6
|
require_relative "procon_bypass_man/device_registry"
|
@@ -16,7 +17,7 @@ Thread.abort_on_exception = true
|
|
16
17
|
module ProconBypassMan
|
17
18
|
class ProConRejected < StandardError; end
|
18
19
|
class CouldNotLoadConfigError < StandardError; end
|
19
|
-
class
|
20
|
+
class FirstConnectionError < StandardError; end
|
20
21
|
|
21
22
|
def self.configure(setting_path: nil, &block)
|
22
23
|
unless setting_path
|
@@ -32,20 +33,21 @@ module ProconBypassMan
|
|
32
33
|
|
33
34
|
def self.run(setting_path: nil, &block)
|
34
35
|
configure(setting_path: setting_path, &block)
|
36
|
+
at_exit { FileUtils.rm_rf(pid_path) }
|
37
|
+
File.write(pid_path, $$)
|
35
38
|
registry = ProconBypassMan::DeviceRegistry.new
|
36
39
|
Runner.new(gadget: registry.gadget, procon: registry.procon).run
|
37
40
|
rescue CouldNotLoadConfigError
|
38
41
|
ProconBypassMan.logger.error "設定ファイルが不正です。設定ファイルの読み込みに失敗しました"
|
39
42
|
puts "設定ファイルが不正です。設定ファイルの読み込みに失敗しました"
|
40
43
|
exit 1
|
41
|
-
rescue
|
42
|
-
|
43
|
-
puts "デバイスと接続中です"
|
44
|
+
rescue FirstConnectionError
|
45
|
+
puts "接続を確立できませんでした。やりなおします。"
|
44
46
|
retry
|
45
47
|
end
|
46
48
|
|
47
|
-
def self.logger=(
|
48
|
-
@@logger =
|
49
|
+
def self.logger=(logger)
|
50
|
+
@@logger = logger
|
49
51
|
end
|
50
52
|
|
51
53
|
def self.logger
|
@@ -56,6 +58,11 @@ module ProconBypassMan
|
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
61
|
+
DEFAULT_PID_PATH = File.expand_path('../pbm_pid', __dir__).freeze
|
62
|
+
def self.pid_path
|
63
|
+
@@pid_path ||= DEFAULT_PID_PATH
|
64
|
+
end
|
65
|
+
|
59
66
|
def self.reset!
|
60
67
|
ProconBypassMan::Procon::MacroRegistry.reset!
|
61
68
|
ProconBypassMan::Procon::ModeRegistry.reset!
|
@@ -63,4 +70,8 @@ module ProconBypassMan
|
|
63
70
|
ProconBypassMan::Configuration.instance.reset!
|
64
71
|
ProconBypassMan::IOMonitor.reset!
|
65
72
|
end
|
73
|
+
|
74
|
+
def self.root
|
75
|
+
File.expand_path('..', __dir__).freeze
|
76
|
+
end
|
66
77
|
end
|
@@ -10,7 +10,6 @@ module ProconBypassMan
|
|
10
10
|
|
11
11
|
# アクティブなバケットは1つだけ
|
12
12
|
def record(event_name)
|
13
|
-
return unless $is_stable
|
14
13
|
key = Time.now.strftime("%S").to_i
|
15
14
|
if table[key].nil?
|
16
15
|
self.previous_table = table.values.first
|
@@ -58,13 +57,6 @@ module ProconBypassMan
|
|
58
57
|
next
|
59
58
|
end
|
60
59
|
|
61
|
-
s_to_p = list.detect { |x| x.label == "switch -> procon" }
|
62
|
-
previous_table = s_to_p&.previous_table.dup
|
63
|
-
if previous_table && previous_table.dig(:eagain_wait_readable_on_read) && previous_table.dig(:eagain_wait_readable_on_read) > 300
|
64
|
-
# ProconBypassMan.logger.debug { "接続の確立ができません" }
|
65
|
-
# Process.kill("USR1", Process.ppid)
|
66
|
-
end
|
67
|
-
|
68
60
|
line = list.map { |counter|
|
69
61
|
"#{counter.label}(#{counter.formated_previous_table})"
|
70
62
|
}.join(", ")
|
@@ -2,7 +2,6 @@ require_relative "io_monitor"
|
|
2
2
|
|
3
3
|
class ProconBypassMan::Runner
|
4
4
|
class InterruptForRestart < StandardError; end
|
5
|
-
class InterruptForCouldNotConnect < StandardError; end
|
6
5
|
|
7
6
|
def initialize(gadget: , procon: )
|
8
7
|
@gadget = gadget
|
@@ -14,7 +13,7 @@ class ProconBypassMan::Runner
|
|
14
13
|
|
15
14
|
def run
|
16
15
|
first_negotiation
|
17
|
-
|
16
|
+
print_booted_message
|
18
17
|
|
19
18
|
self_read, self_write = IO.pipe
|
20
19
|
%w(TERM INT USR1 USR2).each do |sig|
|
@@ -27,9 +26,6 @@ class ProconBypassMan::Runner
|
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
30
|
-
FileUtils.mkdir_p "tmp"
|
31
|
-
File.write "tmp/pid", $$
|
32
|
-
|
33
29
|
loop do
|
34
30
|
$will_terminate_token = false
|
35
31
|
main_loop_pid = fork { main_loop }
|
@@ -39,11 +35,6 @@ class ProconBypassMan::Runner
|
|
39
35
|
signal = readable_io.first[0].gets.strip
|
40
36
|
handle_signal(signal)
|
41
37
|
end
|
42
|
-
rescue InterruptForCouldNotConnect
|
43
|
-
$will_terminate_token = true
|
44
|
-
Process.kill("TERM", main_loop_pid)
|
45
|
-
Process.wait
|
46
|
-
raise ProconBypassMan::CouldNotConnectDeviceError
|
47
38
|
rescue InterruptForRestart
|
48
39
|
$will_terminate_token = true
|
49
40
|
Process.kill("TERM", main_loop_pid)
|
@@ -72,10 +63,9 @@ class ProconBypassMan::Runner
|
|
72
63
|
def main_loop
|
73
64
|
# TODO 接続確立完了をswitchを読み取るようにして、この暫定で接続完了sleepを消す
|
74
65
|
Thread.new do
|
75
|
-
sleep(
|
66
|
+
sleep(5)
|
76
67
|
$will_interval_0_0_0_5 = 0.005
|
77
68
|
$will_interval_1_6 = 1.6
|
78
|
-
$is_stable = true
|
79
69
|
end
|
80
70
|
|
81
71
|
ProconBypassMan::IOMonitor.start!
|
@@ -155,17 +145,46 @@ class ProconBypassMan::Runner
|
|
155
145
|
rescue IO::EAGAINWaitReadable
|
156
146
|
end
|
157
147
|
end
|
148
|
+
|
149
|
+
# ...
|
150
|
+
# switch) 8001
|
151
|
+
# procon) 8101
|
152
|
+
# switch) 8002
|
153
|
+
# が返ってくるプロトコルがあって、これができていないならやり直す
|
154
|
+
loop do
|
155
|
+
begin
|
156
|
+
data = @procon.read_nonblock(128)
|
157
|
+
if data[0] == "\x81".b && data[1] == "\x01".b
|
158
|
+
ProconBypassMan.logger.debug { "接続を確認しました" }
|
159
|
+
@gadget.write_nonblock(data)
|
160
|
+
break
|
161
|
+
else
|
162
|
+
raise ::ProconBypassMan::FirstConnectionError
|
163
|
+
end
|
164
|
+
rescue IO::EAGAINWaitReadable
|
165
|
+
end
|
166
|
+
end
|
158
167
|
end
|
159
168
|
|
160
169
|
def handle_signal(sig)
|
161
170
|
ProconBypassMan.logger.info "#{$$}で#{sig}を受け取りました"
|
162
171
|
case sig
|
163
|
-
when 'USR1'
|
164
|
-
raise InterruptForCouldNotConnect
|
165
172
|
when 'USR2'
|
166
173
|
raise InterruptForRestart
|
167
174
|
when 'INT', 'TERM'
|
168
175
|
raise Interrupt
|
169
176
|
end
|
170
177
|
end
|
178
|
+
|
179
|
+
# @return [void]
|
180
|
+
def print_booted_message
|
181
|
+
booted_message = <<~EOF
|
182
|
+
ProconBypassMan: #{ProconBypassMan::VERSION}
|
183
|
+
pid_path: #{ProconBypassMan.pid_path}
|
184
|
+
pid: #{$$}
|
185
|
+
project_path: #{ProconBypassMan.root}
|
186
|
+
EOF
|
187
|
+
ProconBypassMan.logger.info(booted_message)
|
188
|
+
puts booted_message
|
189
|
+
end
|
171
190
|
end
|
data/procon_bypass_man.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["jiikko"]
|
9
9
|
spec.email = ["n905i.1214@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "
|
11
|
+
spec.summary = "extension for Nintendo Switch Pro Controller"
|
12
12
|
spec.description = spec.summary
|
13
13
|
spec.homepage = "https://github.com/splaspla-hacker/procon_bypass_man"
|
14
14
|
spec.license = "MIT"
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
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.3
|
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-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: extension for Nintendo Switch Pro Controller
|
14
14
|
email:
|
15
15
|
- n905i.1214@gmail.com
|
16
16
|
executables: []
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".circleci/config.yml"
|
20
21
|
- ".gitignore"
|
21
22
|
- ".rspec"
|
22
23
|
- ".ruby-version"
|
23
24
|
- CHANGELOG.md
|
24
|
-
- CODE_OF_CONDUCT.md
|
25
25
|
- Gemfile
|
26
26
|
- Gemfile.lock
|
27
27
|
- LICENSE.txt
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- bin/setup
|
32
32
|
- docs/how_to_connect_procon.md
|
33
33
|
- docs/setup_raspi.md
|
34
|
+
- examples/pbm.service
|
34
35
|
- examples/practical/app.rb
|
35
36
|
- examples/practical/setting.yml
|
36
37
|
- examples/simple.rb
|
@@ -78,5 +79,5 @@ requirements: []
|
|
78
79
|
rubygems_version: 3.2.15
|
79
80
|
signing_key:
|
80
81
|
specification_version: 4
|
81
|
-
summary:
|
82
|
+
summary: extension for Nintendo Switch Pro Controller
|
82
83
|
test_files: []
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,84 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
-
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
-
|
9
|
-
## Our Standards
|
10
|
-
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
-
|
13
|
-
* Demonstrating empathy and kindness toward other people
|
14
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
-
* Giving and gracefully accepting constructive feedback
|
16
|
-
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
-
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
-
|
19
|
-
Examples of unacceptable behavior include:
|
20
|
-
|
21
|
-
* The use of sexualized language or imagery, and sexual attention or
|
22
|
-
advances of any kind
|
23
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
-
* Public or private harassment
|
25
|
-
* Publishing others' private information, such as a physical or email
|
26
|
-
address, without their explicit permission
|
27
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
-
professional setting
|
29
|
-
|
30
|
-
## Enforcement Responsibilities
|
31
|
-
|
32
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
-
|
34
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
-
|
36
|
-
## Scope
|
37
|
-
|
38
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
-
|
40
|
-
## Enforcement
|
41
|
-
|
42
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at n905i.1214@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
-
|
44
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
-
|
46
|
-
## Enforcement Guidelines
|
47
|
-
|
48
|
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
-
|
50
|
-
### 1. Correction
|
51
|
-
|
52
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
-
|
54
|
-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
-
|
56
|
-
### 2. Warning
|
57
|
-
|
58
|
-
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
-
|
60
|
-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
-
|
62
|
-
### 3. Temporary Ban
|
63
|
-
|
64
|
-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
-
|
66
|
-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
-
|
68
|
-
### 4. Permanent Ban
|
69
|
-
|
70
|
-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
-
|
72
|
-
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
-
|
74
|
-
## Attribution
|
75
|
-
|
76
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
-
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
-
|
79
|
-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
-
|
81
|
-
[homepage]: https://www.contributor-covenant.org
|
82
|
-
|
83
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
-
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|