Giter Club home page Giter Club logo

procon_bypass_man's Introduction

ProconBypassMan

Ruby

  • Nintendo Switch Proコントローラーを連射機などにするRaspberry Pi上で動かすコンバータです
  • ドキュメントは getting_started.md にまとめています
  • https://pbm-cloud.jiikko.com を使うと、webだけで運用が可能です

スクリーンショット 2022-04-02 9 10 38

default.mov

必要なハードウェア

  • Nintendo Switch Proコントローラー
  • Switch本体とドック
  • Raspberry Pi4 (Raspberry Pi OS)
    • 他のシリーズは未確認です
  • データ通信が可能なUSBケーブル

必要なソフトウェア

  • ruby 3.0 以上

プラグイン

FAQ

  • どうやって動かすの?
    • このツールはRaspberry Pi4をUSBガジェットモードで起動して有線でプロコンとSwitchに接続して使います
  • どうやって使うの?
    • ケーブルでそれらを接続した状態で、Raspberry Pi4にsshして本プログラムを起動することで使用します
  • ラズベリーパイ4のセットアップ方法は?
  • レイヤーとは?
    • 自作キーボードみたいな感じでレイヤー毎に設定内容を記述して切り替えれます
    • レイヤーは4つあって、up, down, left, rightです。十字キーに対応しています
  • レイヤーを切り替える方法は?
    • 設定ファイルに記述している prefix_keys_for_changing_layerの後ろにあるキーを同時押しながら、十字キーのどれかを押すことで任意のレイヤーに切り替わります
  • このツールでできることは?
  • どうしてsudoが必要なの?
    • 操作するdeviceファイルの所有者がrootだからです
  • 市販されているサードパーティ製連射機との違いは?
    • サードパーティ製のコントローラーは、設定方法や形状が特殊で買い換えるたびに学習・設定コストが発生します。本ツールを使えば、設定内容はテキストで管理することができ、使い慣れたプロコンで同等のことができます
  • sshなしで運用は可能ですか?

仕様・制約

  • 日を跨ぐ24時ちょうどになった瞬間はLinuxのcronが起動などがするようで、この時間は数秒間バイパスが激しく遅延します
    • ログファイルのローテションが少なくとも走るはずなので、不要なデーモンを停止するなどで影響を小さくすることはできると思いますが、完全に抑制することは難しいと思います
  • コントローラーから読み取ってSwitchに書き込む時間は、少なくとも0.02秒はかかります
    • 遅延は動かしているRaspberry Piの負荷に依存します

開発を支援してくれる人を募集しています

  • https://jiikko.fanbox.cc/
  • procon_bypassの運営・開発・サーバー費用に充てさせていただきます。また、問い合わせに優先して対応します。

Links

License

The gem is available as open source under the terms of the MIT License.

procon_bypass_man's People

Contributors

jiikko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

procon_bypass_man's Issues

接続テストする機能が欲しい

  • ケーブルが繋がっていないとか
  • ラズパイがガジェットモードになっているけど、その先がつながっていない
  • ガジェットモードが有効になっていない
  • データ通信不可なケーブルを使っている(どうやって判定する?)

とか。

何が足りていないとかを教えてほしい

オートトリガーの実装

https://www.youtube.com/watch?v=ZZTd9_v1qw8 を実装したい。

やること

  • 構成は上記動作で説明している通り、ゲーム画面を継続的にキャプチャし続ける必要がある
    • 配線がごちゃっとしてしまうのは仕方ない
    • 画像のキャプチャと解析もラズパイ内でやりたいけど、リソース的に厳しいかもしれない
  • YOLOあたりを使って物体検知で自作モデルを作る必要がある
  • バイパスをしているプロセスの中で、画像判定の結果を受け取る必要があり、バイパス自体の性能を下げずによろしくする必要がある
    • 画像解析処理は、バイパスとは別のプロセスで動かすイメージで考えているので、画像解析処理はpythonで動いていてもいい

コントローラーを使っていない時にGCをする案

今は、GCの時間を極力減らすために https://github.com/splaplapla/blue_green_process を使っているんだけど、処理が複雑になりがち。
実際には、常にGCを回避する必要はなくて、手で操作中に限りGCを避ければ良いのではないか。コントローラを手で持っているかは、ジャイロセンサーの値を見ればわかるので、その時は、GCをオフにできるなら、blue_green_processを使う必要はなくなりそう。

ただ、bypass workerプロセス上のバイパス処理はすごい勢いでオブジェクトを生成するので、blue_green_processをやめるのは現実的ではないかもしれないけど、bypass masterプロセスのGCに関しては、上記で述べた方式を適用できると稀に発生する遅延を減らせそう。

Ctrl+Cを押したときに、プロセスが停止に時間がかかるようになっている

I, [2022-11-27T21:14:01.068472 #16149]  INFO -- : 16149でINTを受け取りました
I, [2022-11-27T21:14:01.068716 #15929]  INFO -- : 15929でINTを受け取りました
I, [2022-11-27T21:14:01.071340 #15929]  INFO -- : 処理を終了します
I, [2022-11-27T21:14:01.672371 #16149]  INFO -- : Thread1を終了します
D, [2022-11-27T21:14:05.218312 #16160] DEBUG -- : [BLUE_GREEN_PROCESS] green has become inactive(16160)
D, [2022-11-27T21:14:05.219294 #16149] DEBUG -- : direct_connect_switch_via_bluetooth!
D, [2022-11-27T21:14:05.269545 #16156] DEBUG -- : [BLUE_GREEN_PROCESS] blue will die(16156)
D, [2022-11-27T21:14:05.629721 #16160] DEBUG -- : [BLUE_GREEN_PROCESS] green will die(16160)

BLUE_GREEN_PROCESSのプロセスがスイッチするときまでブロックされている。

設定ファイルの再読み込みも同じく時間がかかってしまっている。

マクロを実行するとプロセスのメモリ使用率が増え続ける

それと、 D, [2023-07-22T23:02:40.786274 #14992] DEBUG -- : [Retryable] ProconBypassMan::Bypass::ProconToSwitch::CouldNotWriteToSwitchErrorが起きました。retryします。1 / 5 が起きやすい気がする。

なお、ProconBypassMan::Bypass::ProconToSwitch::CouldNotWriteToSwitchErrorの発生メカニズムは不明。


(ProconBypassMan::Bypass::ProconToSwitch::CouldNotWriteToSwitchErrorの発生頻度は、測定したい)

配布を簡単にしたい

現状は、rbenvを入れて、ruby実行ファイルを絶対パスで呼び出す、というのをドキュメントに書いている。

これに対する問題点は、rubyのバージョンがにロックインされてしまい、新しいrubyを入れるには別途手順が必要になる。めんどくさい。
また、rbenvのインストールをしたり、手順が煩雑。

appimageとかruby-packerを使って、rubyとgemをバンドルして配布するっていうことをしたい。

設定ファイルの再読み込みに失敗したらプロセスがハングしてしまう

[2022-02-05T12:49:48.825968 #1178] ERROR -- : 設定ファイルが不正です。再読み込みができませんでした

読み込みができなかったらreloadしないで接続を維持したい

Feb 06 18:08:25 raspberrypi2 bash[582]: Reloading config file
Feb 06 18:08:25 raspberrypi2 bash[582]: 設定ファイルが不正です。再読み込みができませんでした
Feb 06 18:08:26 raspberrypi2 bash[582]: バイパス処理を再開します
Feb 06 18:08:26 raspberrypi2 bash[582]: #<Thread:0x02f25108 /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/commands/bypass_command.rb:57 run> terminated with exception (report_on_exception is true):
Feb 06 18:08:26 raspberrypi2 bash[582]: /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/procon/layer_changer.rb:27:in `change_layer?': prefix_keysが未設定です (RuntimeError)
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/procon.rb:43:in `apply!'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/processor.rb:13:in `process'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/bypass.rb:82:in `block in send_procon_to_gadget!'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/support/callbacks.rb:50:in `run_callbacks'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/bypass.rb:55:in `send_procon_to_gadget!'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/commands/bypass_command.rb:61:in `block (2 levels) in execute'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/commands/bypass_command.rb:59:in `loop'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/commands/bypass_command.rb:59:in `block in execute'
Feb 06 18:08:26 raspberrypi2 bash[582]: /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/procon/layer_changer.rb:27:in `change_layer?': prefix_keysが未設定です (RuntimeError)
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/procon.rb:43:in `apply!'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/processor.rb:13:in `process'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/bypass.rb:82:in `block in send_procon_to_gadget!'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/support/callbacks.rb:50:in `run_callbacks'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/bypass.rb:55:in `send_procon_to_gadget!'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/commands/bypass_command.rb:61:in `block (2 levels) in execute'
Feb 06 18:08:26 raspberrypi2 bash[582]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-27a088e74960/lib/procon_bypass_man/commands/bypass_command.rb:59:in `loop'
Feb 06 18:08:26 raspberrypi2 bash[58

You have already activated set 1.0.3, but your Gemfile requires set 1.0.4. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)

たまに発生する。もう1度同じコマンドを実行すると成功することがある。
inline bunderを使っているせいな気がする。

pi@raspberrypi2[/usr/share/pbm/current]$ sudo /home/pi/.rbenv/versions/3.1.2/bin/ruby app.rb
n/home/pi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:309:in `check_for_activated_spec!': You have already activated set 1.0.3, but your Gemfile requires set 1.0.4. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
        from /home/pi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:25:in `block in setup'
        from /home/pi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/spec_set.rb:136:in `each'
        from /home/pi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/spec_set.rb:136:in `each'
        from /home/pi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:24:in `map'
        from /home/pi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:24:in `setup'
        from /home/pi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/inline.rb:71:in `block in gemfile'
        from /home/pi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary'
        from /home/pi/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/inline.rb:55:in `gemfile'
        from app.rb:12:in `<main>'

inline bundlerに依存gemを全て列挙すれば抑制できそうだが、、、。

  gemfile do
    source 'https://rubygems.org'
    git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
    gem 'procon_bypass_man', '0.3.10'
...

使用するrubyにインストールしているgemに複数のバージョンがあると掲題のエラーが起きてしまうっぽい。

pi@raspberrypi2[/usr/share/pbm/current]$ gem list set

*** LOCAL GEMS ***

set (1.0.4, 1.0.3, default: 1.0.2)

所感

  • bundlerのバグっぽい気もする
  • Gemfile, Gemfile.lockを添付すると起動は早くなるし、掲題のエラーは起きなはずだけど、セットアップに必要なファイルは少ない方がクールだと思うのでinline bundlerを使っている
    • inline bundlerやめるか?

debian12(bookworm)を使っていると起動時の接続に失敗しがち

pi@raspberrypi2:~ $ uname -a
Linux raspberrypi2 6.1.0-rpi7-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.63-1+rpt1 (2023-11-24) aarch64 GNU/Linux
pi@raspberrypi2:~ $ cat /etc/debian_version 
12.4
  • OSを起動した直後なら接続に成功する可能性が高い
    • 一度Ctrl+Cで落としてから再度実行すると/dev/hidg0への読み書きが失敗する(応答がない)
  • カーネルの問題?
  • #290 の影響かと思ってsudo ruby app.rbでも同じだった
  • ケーブルの抜き差しは関係ない
  • 2年前くらいに作った状態ではこういうことはなかったはず

接続に失敗してからSIGINTを送るとエラーになる

画面が賑やかなだけで特に問題は起きていない

接続の見込みがないのでsleepしまくります
^C/home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/shared_helpers.rb:158:in `block in trap': undefined method `call' for "DEFAULT":String (NoMethodError)
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/shared_helpers.rb:158:in `block in trap'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man.rb:133:in `sleep'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man.rb:133:in `eternal_sleep'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man.rb:97:in `rescue in rescue in run'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man.rb:91:in `rescue in run'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man.rb:64:in `run'
        from /usr/share/pbm/current/app.rb:26:in `<main>'
/home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man/commands/connect_device_command.rb:16:in `rescue in execute!': ProconBypassMan::EternalConnectionError (ProconBypassMan::EternalConnectionError)
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man/commands/connect_device_command.rb:5:in `execute!'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man.rb:72:in `run'
        from /usr/share/pbm/current/app.rb:26:in `<main>'
/home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man/support/safe_timeout.rb:11:in `throw_if_timeout!': ProconBypassMan::SafeTimeout::Timeout (ProconBypassMan::SafeTimeout::Timeout)
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man/device_connector.rb:62:in `block in drain_all'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man/device_connector.rb:58:in `each'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man/device_connector.rb:58:in `drain_all'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man/device_connector.rb:35:in `connect'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man/commands/connect_device_command.rb:6:in `execute!'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-a38cd9731fb8/lib/procon_bypass_man.rb:72:in `run'
        from /usr/share/pbm/current/app.rb:26:in `<main>'

open_macroで定義にないボタンが書かれている設定ファイルをライブリロードするとプロセスが消滅する

起動時もエラーになるかも。

  left_analog_stick_cap cap: 1100, if_pressed: [:zl, :a], force_neutral: :a
    open_macro :dacan, steps: [:pressing_r_for_0_3sec, :pressing_r_and_toggle_z], if_tilted_left_stick: true, if_pressed: [:zl]
Feb 24 21:13:40 raspberrypi2 bash[570]: #<Thread:0x05c17020 /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-e2eb116e74c8/lib/procon_bypass_man/commands/bypass_command.rb:69 run> terminated with exception (report_on_exception is true):
Feb 24 21:13:40 raspberrypi2 bash[570]: /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-e2eb116e74c8/lib/procon_bypass_man/procon/button.rb:7:in `initialize': zは定義にないボタンです (ProconBypassMan::Procon::Button::UnknownButtonFoundError)
Feb 24 21:13:40 raspberrypi2 bash[570]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-e2eb116e74c8/lib/procon_bypass_man/procon/press_button_aware.rb:11:in `new'
Feb 24 21:13:40 raspberrypi2 bash[570]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-e2eb116e74c8/lib/procon_bypass_man/procon/press_button_aware.rb:11:in `pressing_button?'
Feb 24 21:13:40 raspberrypi2 bash[570]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-e2eb116e74c8/lib/procon_bypass_man/domains/binary/processing_procon_binary.rb:39:in `write_as_press_button'
Feb 24 21:13:40 raspberrypi2 bash[570]:         from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-e2eb116e74c8/lib/procon_bypass_man/procon/user_operation.rb:42:in `block in press_button_only'

特定の起動オプションがあれば、不正状態であってもexitしないようにしたい

今は起動時に設定ファイルが不正だったときにexit 1してしまっており、設定ファイルが不正だったらsshして直接書き換えないと復旧できない。
pbm-cloudから、正しい設定ファイルを適用することで復旧できるようにしたい。

sshして手動でプログラムを起動している場合は、不正状態であれば即落ちした方がわかりやすそう。

バイパス処理は直列で行うが、マルチプロセスにしてみたい

パフォーマンスのグラフを見ているとGCによって刺さっているような気がするので、バイパス処理はプロセスのプールに投げて、プロセスがアイドル中にGCをしておけば、バイパス中のGCを避けることができるのではないか。

今はシングルプロセスでバイパスをし続けるので、GCが走ると遅延に直結している。

イメージは、 https://secon.dev/entry/20111006/1317893282/ そのまま。

この修正をする前にGCの回数もモニタリングしたい。

プロコンとSwitchの接続を確立後にCtrl+Cとかでプロセスを落としてから、再実行すると1回は必ず接続ができない

プロコン自体のセッションが切れていなくて接続を奪えなくてそういう状態になっている。
プロセスを終了時に、プロコンに接続終了を告げれると直りそう。

ラズパイとプロコンのケーブルを一度抜いてからリトライすると接続ができるようになる。


これが解決すると不慮の切断が起きた時に再接続がスムーズになる気がする。


切断すると、プロコンがデータを送り続けているので、このまま使って再接続できないだろうか?

起動中に電源を切るとbundlerでエラーになってしまう

gitで管理している内部のファイルが不正状態になっていてgitコマンドが失敗してしまっている。リカバリーしたい。

pi@ras1:/usr/share/pbm/current $ /home/pi/.rbenv/versions/3.0.1/bin/ruby app.rb
/home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/source/git/git_proxy.rb:175:in `git': Git error: command `git fetch --force --quiet --tags https://github.com/splaplapla/procon_bypass_man refs/heads/\\*:refs/heads/\\*` in directory /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/cache/bundler/git/procon_bypass_man-ae4c9016d76b667658c8ba66f3bbd2eebf2656af has failed. (Bundler::Source::Git::GitCommandError)

If this error persists you could try removing the cache directory '/home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/cache/bundler/git/procon_bypass_man-ae4c9016d76b667658c8ba66f3bbd2eebf2656af'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/source/git/git_proxy.rb:162:in `block in git_retry'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/retry.rb:40:in `run'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/retry.rb:30:in `attempt'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/source/git/git_proxy.rb:161:in `git_retry'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/source/git/git_proxy.rb:106:in `block in checkout'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/source/git/git_proxy.rb:218:in `with_path'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/source/git/git_proxy.rb:105:in `checkout'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/source/git.rb:310:in `fetch'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/source/git.rb:164:in `specs'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/definition.rb:783:in `block in converge_locked_specs'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/definition.rb:769:in `each'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/definition.rb:769:in `converge_locked_specs'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/definition.rb:271:in `resolve'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/definition.rb:185:in `specs'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/definition.rb:173:in `resolve_remotely!'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/installer.rb:291:in `resolve_if_needed'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/installer.rb:83:in `block in run'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/process_lock.rb:12:in `block in lock'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/process_lock.rb:9:in `open'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/process_lock.rb:9:in `lock'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/installer.rb:72:in `run'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/installer.rb:24:in `install'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/inline.rb:63:in `block (2 levels) in gemfile'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/settings.rb:115:in `temporary'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/inline.rb:62:in `block in gemfile'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/settings.rb:115:in `temporary'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/bundler/inline.rb:55:in `gemfile'
        from app.rb:5:in `<main>'

エラーメッセージからcache directoryを取得して削除するか。

プロセスの再読み込みをすると一部のThreadが残り続ける

pi@raspberrypi2[/usr/share/pbm/current]$ pstree `cat ./pbm_pid` -pt
ruby(23352)─┬─ruby(23429)─┬─bypass_command*(23434)─┬─{drb.rb:1259}(23438)
            │             │                        ├─{drb.rb:1555}(23435)
            │             │                        ├─{master_process*}(23437)
            │             │                        └─{remote_macro_r*}(23436)
            │             ├─bypass_command*(23439)─┬─{drb.rb:1259}(23444)
            │             │                        ├─{drb.rb:1555}(23441)
            │             │                        ├─{master_process*}(23443)
            │             │                        └─{remote_macro_r*}(23442)
            │             ├─{bypass_command*}(23432)
            │             ├─{bypass_command*}(23433)
            │             └─{drb.rb:1555}(23431)
            ├─{can_over_proce*}(23404)
            ├─{can_over_proce*}(23407)
            ├─{can_over_proce*}(23409)
            ├─{client.rb:9}(23403)
            ├─{drb.rb:1259}(23411)
            ├─{drb.rb:1555}(23402)
            ├─{drb.rb:1555}(23406)
            ├─{drb.rb:1555}(23408)
            ├─{drb.rb:1713}(23412)
            ├─{drb.rb:1713}(23413)
            ├─{drb.rb:1713}(23440)
            ├─{drb.rb:1713}(23445)
            ├─{forever.rb:26}(23401)
            ├─{scheduler.rb:58}(23410)
            └─{worker.rb:12}(23428)

👇 sudo kill -USR2 cat ./pbm_pidを実行した後

pi@raspberrypi2[/usr/share/pbm/current]$ pstree `cat ./pbm_pid` -pt
ruby(23352)─┬─ruby(23455)─┬─bypass_command*(23461)─┬─{drb.rb:1259}(23466)
            │             │                        ├─{drb.rb:1555}(23462)
            │             │                        ├─{master_process*}(23464)
            │             │                        └─{remote_macro_r*}(23463)
            │             ├─bypass_command*(23465)─┬─{drb.rb:1259}(23471)
            │             │                        ├─{drb.rb:1555}(23468)
            │             │                        ├─{master_process*}(23470)
            │             │                        └─{remote_macro_r*}(23469)
            │             ├─{bypass_command*}(23459)
            │             ├─{bypass_command*}(23460)
            │             └─{drb.rb:1555}(23458)
            ├─{can_over_proce*}(23404)
            ├─{can_over_proce*}(23407)
            ├─{can_over_proce*}(23409)
            ├─{client.rb:9}(23403)
            ├─{drb.rb:1259}(23411)
            ├─{drb.rb:1555}(23402)
            ├─{drb.rb:1555}(23406)
            ├─{drb.rb:1555}(23408)
            ├─{drb.rb:1713}(23412)
            ├─{drb.rb:1713}(23413)
            ├─{drb.rb:1713}(23440)
            ├─{drb.rb:1713}(23445)
            ├─{drb.rb:1713}(23467)
            ├─{drb.rb:1713}(23472)
            ├─{forever.rb:26}(23401)
            ├─{scheduler.rb:58}(23410)
            └─{worker.rb:12}(23428)

プロセスを停止時、drbのサービスに対して明示して終了する必要があるかも。

左スティックのニュートラルな座標を簡単に取得したい

プロコンの個体ごとにニュートラルな座標が微妙に違うので、設定ファイルにそれを記述する必要があるが、現状その座標を出力する方法がない。(output reportからパースして取得することができるが、めんどい。)

これは左スティックの感度調整の時だけ必要なので、常にログに出す必要はない。

選択肢

  • app.rbの設定に log_left_stick_ニュートラル_positionっていう設定を追加する
    • 取得し終わって、その設定項目をOFFにするのがめんどい
  • 何らかのシグナルを送信したら、pbm-cloudに送信するか or ファイルに書き出す
    • これがいいか

1分単位でstatsをサーバに送りたい

新しいバージョンの評価に使いたい

  • proconから毎秒何回取得できているか
  • 1回の取得に何秒かかっているか
  • ラズパイのロードアベレージ

rubyバージョンを各種でハードコードしている問題

rubyのバージョンは各種(ドキュメント、systemd定義ファイル, mitameスクリプト)で現在ハードコードしているので、最新のrubyバージョンを使おうとすると、各ファイルを変更・読み替える必要がある。

また、バージョンアップするとsystemd定義ファイルが3.0.1にハードコードされたバージョンに巻き戻ってしまい、とにかく面倒。

1: rubyバージョンをプロジェクトのどこかに記述して、それを各種から参照するようにする案

pbmをアップグレードしたときにrubyのバージョンアップも同時に走るようにすると、ビルド中に電源を切ってしまう可能性があり、ファイルシステム的な意味で悪いことが起きそう。
また、ビルド中に電源を切った後に起動後、新しいrubyはいつインストールする?pbm-cloudを使えばsshが不要と謳っているのに、手作業での復旧が必要そう。

この案でも実装はできるが、ユーザがインストールされていないrubyバージョンをインストールする必要があり、片手落ち感がある。

2: pbmenvでrubyバイナリを配る案

これが一番いい。rbenvのインストールも省けるし、ビルドの時間も無くなる。ドキュメントからrubyバージョンに関する記述を消せる。
実行環境はラズパイのみを想定しているので、そんなに難しくはないはずだけど、めんどくさそう。

プランB

setting.yamlに、app.rbで記述するようなことを記述できるようにしたい

app.rbには、あまり変更しないようなことを書いておくのだけど、#204 のようなオプショナルな項目を有効にしたい時にいちいちsshして編集するのがめんどい。また、有効にしたのに、pbmenvでアップグレードをするとデフォルト値に戻ってしまう。

setting.ymlは、pbm-cloudから編集できるので、setting.ymlにボタン設定以外のことも書けるようにしたい。

ラズパイのUSBポートにキーボードとかが刺さっていると、プロコンを使いたいのにデバイスファイルの選択を間違ってしまう可能性がある

ラズパイにUSBキーボードを挿した状態のデバイスファイル一覧

pi@ras1:~ $ ls /dev/hi*
/dev/hidg0  /dev/hidraw0  /dev/hidraw1  /dev/hidraw2  /dev/hidraw3

プロコンのみを挿した状態のデバイスファイル一覧

pi@ras1:~ $ ls /dev/hi*
/dev/hidg0  /dev/hidraw0

名前だけだとプロコンかは判断できていないのでいい感じにプロコンなのかの判定をする必要がある


プロコン以外のデバイスファイルを使ってしまうと、謎の出力をSwitchに送信するので時間が経つとSwitchから切断されてしまい、以下のエラーが出ている(たぶん)

スクリーンショット 2022-02-12 23 02 59

接続中にプロコンのケーブルを物理的抜くとエラーメッセージが止まらなくなる

D, [2022-05-13T23:08:42.388669 #1029] DEBUG -- : direct_connect_switch_via_bluetooth!
E, [2022-05-13T23:08:42.389380 #1029] ERROR -- : Proconが切断されました。終了処理を開始します2. <internal:io>:121:in `write_nonblock': No such device @ io_write_nonblock - /dev/hidraw0 (Errno::ENODEV)
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass.rb:101:in `direct_connect_switch_via_bluetooth'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:72:in `block (2 levels) in execute'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:69:in `loop'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:69:in `block in execute'

D, [2022-05-13T23:08:43.132746 #1029] DEBUG -- : direct_connect_switch_via_bluetooth!
E, [2022-05-13T23:08:43.133727 #1029] ERROR -- : Proconが切断されました。終了処理を開始します2. <internal:io>:121:in `write_nonblock': No such device @ io_write_nonblock - /dev/hidraw0 (Errno::ENODEV)
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass.rb:101:in `direct_connect_switch_via_bluetooth'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:72:in `block (2 levels) in execute'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:69:in `loop'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:69:in `block in execute'

D, [2022-05-13T23:08:43.877367 #1029] DEBUG -- : direct_connect_switch_via_bluetooth!
E, [2022-05-13T23:08:43.878191 #1029] ERROR -- : Proconが切断されました。終了処理を開始します2. <internal:io>:121:in `write_nonblock': No such device @ io_write_nonblock - /dev/hidraw0 (Errno::ENODEV)
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass.rb:101:in `direct_connect_switch_via_bluetooth'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:72:in `block (2 levels) in execute'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:69:in `loop'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:69:in `block in execute'

D, [2022-05-13T23:08:44.626490 #1029] DEBUG -- : direct_connect_switch_via_bluetooth!
E, [2022-05-13T23:08:44.627140 #1029] ERROR -- : Proconが切断されました。終了処理を開始します2. <internal:io>:121:in `write_nonblock': No such device @ io_write_nonblock - /dev/hidraw0 (Errno::ENODEV)
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass.rb:101:in `direct_connect_switch_via_bluetooth'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:72:in `block (2 levels) in execute'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:69:in `loop'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-6edf4cab64df/lib/procon_bypass_man/bypass/bypass_command.rb:69:in `block in execute'

接続完了後、2, 3時間に数秒間固まることがある

GUIを起動しているラズパイだと発生頻度が高いのかも。

接続が確立してからは雑にバイパスをしているだけなので、
https://github.com/Brikwerk/nxbt/blob/27451e61b4d83b38230d42c3aec9129e656a18ce/nxbt/controller/protocol.py の送信方法を参考にして安定させたい。

  • output report(runble data)を送信しなかったら起きないが、switchの何らかの状態だとoutput reportを送信しないと切断されてしまう
  • output reportの送信頻度を下げると発生頻度も下がる

PBM起動時にsudoをつけるのをやめたい

sudoをつけると何がいけないか

  • rbenvでインストールしたgemがrootでインストールされてしまう
  • 実行コマンドが長い
    • ex: sudo /home/pi/.rbenv/versions/3.1.2/bin/ruby app.rb

sudoを使わないことで ruby app.rb だけでよくなるし、バージョンの指定を .ruby-version で指定できるようになる。
また、副次的に脱inline bundlerもしやすくなる。


似たようなgemでpermissionを書き換えていたのでそれの真似をする。
https://github.com/AJFaraday/ruby-hid/blob/f55cb6f37efab5ef894bfa28c84537755a31d8bb/lib/ruby_hid/device.rb#L37-L40


  • 起動時のsudoが不要になる修正, sudoが使えない実行ユーザの場合、エラーにする
  • systemd経由で動くようにする
  • 既存の実行方法だと、gemがrootになっているので、エラーになるとか起きる気がする。マイグレーション的な処理が必要そう
    • whoamiでgemディレクトリの所有者を書き換える
    • #290
  • ドキュメントの修正をする
    • pbmenvも修正が必要?
    • 起動コマンドを同梱するすればいいのでは?

install_macro_pluginしていないマクロをlayer内で使うとNoMethodErrorが起きる

module TheMacro
  def self.steps
    [:pressing_thumbr_and_toggle_zr_for_2sec, :a]
  end
end
before do
  ProconBypassMan.buttons_setting_configure do
    prefix_keys_for_changing_layer [:zr]
    layer :up do
      disable_macro TheMacro
      open_macro TheMacro, steps: [:pressing_thumbr_and_toggle_zr_for_2sec, :a], if_pressed: [:y, :b]
    end
  end
end
  1) ProconBypassMan::Procon with macro disable_macro 条件なし 無効対象のマクロ名を指定するとき クラス y, bを押しているとき マクロが発動しないこと
     Failure/Error: steps = PRESETS[name] || plugins[name].call || raise("unknown macro")

     NoMethodError:
       undefined method `call' for nil:NilClass
     # ./lib/procon_bypass_man/procon/macro_registry.rb:17:in `load'
     # ./lib/procon_bypass_man/procon.rb:64:in `block in apply!'
     # ./lib/procon_bypass_man/procon.rb:62:in `each'
     # ./lib/procon_bypass_man/procon.rb:62:in `apply!'
     # ./spec/lib/procon_bypass_man/procon_spec.rb:339:in `block (8 levels) in <top (required)>'

マクロを有効にできなかった的なことが標準エラーに警告として出てほしい

10回に1回くらいの頻度で接続に失敗することがある

再現頻度が低くてしんどい

I, [2022-05-16T21:40:42.826927 #1448]  INFO -- : proconのデバイスファイルは/dev/hidraw0を使います
D, [2022-05-16T21:40:42.853539 #1448] DEBUG -- : [SHELL] echo > /sys/kernel/config/usb_gadget/procon/UDC
D, [2022-05-16T21:40:42.882902 #1448] DEBUG -- : [SHELL] ls /sys/class/udc > /sys/kernel/config/usb_gadget/procon/UDC

I, [2022-05-16T21:40:44.911748 #1448]  INFO -- : OK(expected: ["0000"], got: ["0000"])
I, [2022-05-16T21:40:44.921054 #1448]  INFO -- : OK(expected: ["0000"], got: ["0000"])
I, [2022-05-16T21:40:44.929024 #1448]  INFO -- : OK(expected: ["8005"], got: ["8005"])
I, [2022-05-16T21:40:44.937019 #1448]  INFO -- : OK(expected: ["0000"], got: ["0000"])
I, [2022-05-16T21:40:44.945026 #1448]  INFO -- : OK(expected: ["8001"], got: ["8001"])
I, [2022-05-16T21:40:44.962077 #1448]  INFO -- : OK(expected: (?-mix:^8101), got: ["810100032dbd42e9b698000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"])
I, [2022-05-16T21:40:44.975633 #1448]  INFO -- : OK(expected: ["8002"], got: ["8002"])
I, [2022-05-16T21:40:44.994074 #1448]  INFO -- : OK(expected: (?-mix:^8102), got: ["81020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"])
I, [2022-05-16T21:40:44.999645 #1448]  INFO -- : OK(expected: (?-mix:^0100), got: ["01000000000000000000033000000000000000000000000000000000000000000000000000000000000000000000000000"])

I, [2022-05-16T21:40:45.170157 #1448]  INFO -- : (start special route)
E, [2022-05-16T21:40:49.172030 #1448] ERROR -- : timeoutになりました(execution expired)
E, [2022-05-16T21:40:49.172620 #1448] ERROR -- : read_from(switch): ["0000"]
PBMを起動しています
read_from(switch): ["0000"]
OK(expected: ["0000"], got: ["0000"])
read_from(switch): ["0000"]
OK(expected: ["0000"], got: ["0000"])
read_from(switch): ["8005"]
OK(expected: ["8005"], got: ["8005"])
read_from(switch): ["0000"]
OK(expected: ["0000"], got: ["0000"])
read_from(switch): ["8001"]
OK(expected: ["8001"], got: ["8001"])
read_from(procon): ["810100032dbd42e9b698000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"]
OK(expected: (?-mix:^8101), got: ["810100032dbd42e9b698000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"])
read_from(switch): ["8002"]
OK(expected: ["8002"], got: ["8002"])
read_from(procon): ["81020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"]
OK(expected: (?-mix:^8102), got: ["81020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"])
read_from(switch): ["01000000000000000000033000000000000000000000000000000000000000000000000000000000000000000000000000"]
OK(expected: (?-mix:^0100), got: ["01000000000000000000033000000000000000000000000000000000000000000000000000000000000000000000000000"])
read_from(procon): ["81010300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"]
/home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-049dec1d73e8/lib/procon_bypass_man/device_connection/executor.rb:168:in `read': execution expired (Timeout::Error)
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-049dec1d73e8/lib/procon_bypass_man/device_connection/executor.rb:168:in `block in blocking_read_with_timeout_from_procon'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/3.0.0/timeout.rb:112:in `timeout'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-049dec1d73e8/lib/procon_bypass_man/device_connection/executor.rb:167:in `blocking_read_with_timeout_from_procon'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-049dec1d73e8/lib/procon_bypass_man/device_connection/executor.rb:37:in `block in execute!'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-049dec1d73e8/lib/procon_bypass_man/device_connection/executor.rb:81:in `block in drain_all'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-049dec1d73e8/lib/procon_bypass_man/device_connection/executor.rb:68:in `each'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-049dec1d73e8/lib/procon_bypass_man/device_connection/executor.rb:68:in `drain_all'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-049dec1d73e8/lib/procon_bypass_man/device_connection/executor.rb:46:in `execute!'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-049dec1d73e8/lib/procon_bypass_man/device_connection/command.rb:5:in `execute!'
        from /home/pi/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/bundler/gems/procon_bypass_man-049dec1d73e8/lib/procon_bypass_man.rb:87:in `run'

正常な時のログ

I, [2022-05-18T00:36:11.771073 #8521]  INFO -- : OK(expected: ["0000"], got: ["0000"])
I, [2022-05-18T00:36:11.779502 #8521]  INFO -- : OK(expected: ["0000"], got: ["0000"])
I, [2022-05-18T00:36:11.786502 #8521]  INFO -- : OK(expected: ["8005"], got: ["8005"])
I, [2022-05-18T00:36:11.794569 #8521]  INFO -- : OK(expected: ["0000"], got: ["0000"])
I, [2022-05-18T00:36:11.803525 #8521]  INFO -- : OK(expected: ["8001"], got: ["8001"])
I, [2022-05-18T00:36:11.811952 #8521]  INFO -- : OK(expected: (?-mix:^8101), got: ["810100032dbd42e9b698000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"])
I, [2022-05-18T00:36:11.834523 #8521]  INFO -- : OK(expected: ["8002"], got: ["8002"])
I, [2022-05-18T00:36:11.851982 #8521]  INFO -- : OK(expected: (?-mix:^8102), got: ["81020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"])
I, [2022-05-18T00:36:11.858531 #8521]  INFO -- : OK(expected: (?-mix:^0100), got: ["01000000000000000000033000000000000000000000000000000000000000000000000000000000000000000000000000"])
I, [2022-05-18T00:36:12.028069 #8521]  INFO -- : (start special route)
I, [2022-05-18T00:36:12.211993 #8521]  INFO -- : <<< 810100032dbd42e9b698000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
I, [2022-05-18T00:36:12.212477 #8521]  INFO -- : >>> 8002
I, [2022-05-18T00:36:12.427993 #8521]  INFO -- : <<< 81020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
I, [2022-05-18T00:36:12.428436 #8521]  INFO -- : >>> 01000000000000000000033000000000000000000000000000000000000000000000000000000000000000000000000000
I, [2022-05-18T00:36:12.443987 #8521]  INFO -- : <<< 214981008000a0287896687109800300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
I, [2022-05-18T00:36:12.444438 #8521]  INFO -- : OK(expected: (?-mix:^21), got: ["214981008000a0287896687109800300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"])
I, [2022-05-18T00:36:12.450551 #8521]  INFO -- : OK(expected: ["8004"], got: ["8004"])
I, [2022-05-18T00:36:12.458560 #8521]  INFO -- : [pre_bypass] >>> 010b000000000000000048000000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.