procon_bypass_man 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21149148015d5d8194ba9b0dc35fc1699ba1fe4eff6aaf1dd0956e0b35856e14
4
- data.tar.gz: 6af893ef0a8ff0fdad56b53d9bd117f6cbd39ec7bdb5c216d44cf2d773b9974f
3
+ metadata.gz: 59fe04b1f616674f3f4a500fbc0abf1dce166482b2e7c880e94d0247a7162877
4
+ data.tar.gz: 55217706d204a06777fb9c9bfe87a64113dc2bdcfd0efa1079e79afc266690ce
5
5
  SHA512:
6
- metadata.gz: 7185d5bf2246b3c1e2ae00eb08e170db017e78b7ed43fecde3757f2fc99bf1132f01b4e541ba669b9fc2ef39ee17e035368eabe7d4b973728c8ae49fd2873a0a
7
- data.tar.gz: 6c3152904d3f4af9e3e3e4f519d4fbe3391cf7d727c3ee42966d9492672bb9ead227ce451e8b97088d8b5e27176e9427939009ff59873fac507cbdabeb7fa61a
6
+ metadata.gz: 1c57e7ca180ec142258a4725197e928cf073358743c8e98a78cbd87c4419b05f47859d97428f86dabcaee68f7856596a697a9f211b1f928efd3bb88b9a840c2a
7
+ data.tar.gz: fa60bd01934dc80f811bd8871ba256c2cc70fb6cc6cbaa33fd180922fdde5bc70476234d00ce28303acb37229cace8137de540e29483af9d7dce926cd7e75fc6
data/.circleci/config.yml CHANGED
@@ -2,22 +2,46 @@ version: 2.1
2
2
  orbs:
3
3
  ruby: circleci/ruby@0.1.2
4
4
 
5
- jobs:
6
- build:
5
+ executors:
6
+ ruby:
7
+ parameters:
8
+ tag:
9
+ type: string
10
+ default: "latest"
7
11
  docker:
8
- - image: circleci/ruby:3.0.1
9
- executor: ruby/default
12
+ - image: ruby:<< parameters.tag >>
13
+ environment:
14
+ BUNDLE_PATH: vendor/bundle
15
+ BUNDLE_JOBS: 4
16
+ working_directory: ~/app
17
+
18
+ jobs:
19
+ rspec:
20
+ parameters:
21
+ version:
22
+ type: string
23
+ executor:
24
+ name: ruby
25
+ tag: << parameters.version >>
10
26
  steps:
11
27
  - 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: rubocop
20
- command: bundle exec rubocop
21
- - run:
22
- name: run test
23
- command: bundle exec rspec
28
+ - run: ruby --version
29
+ - run: bundle --version
30
+ - run: gem --version
31
+ - run: gem install bundler
32
+ - run: bundle install --jobs 4
33
+ - run: bundle exec rubocop
34
+ - run: bundle exec rspec
35
+
36
+ build_jobs: &build_jobs
37
+ - rspec:
38
+ matrix:
39
+ parameters:
40
+ version:
41
+ - "2.5"
42
+ - "2.7"
43
+ - "3.0"
44
+ workflows:
45
+ version: 2
46
+ build:
47
+ jobs: *build_jobs
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [0.1.7] - 2021-09-11
2
+ - Support pbmenv
3
+
1
4
  ## [0.1.6] - 2021-08-19
2
5
  - 設定ファイルを読み込むと内容のmd5を `pbm_root_dir/.setting_yaml_digest` へ出力するようにしました
3
6
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- procon_bypass_man (0.1.6)
4
+ procon_bypass_man (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -17,7 +17,7 @@ GEM
17
17
  coderay (~> 1.1)
18
18
  method_source (~> 1.0)
19
19
  rainbow (3.0.0)
20
- rake (13.0.3)
20
+ rake (13.0.6)
21
21
  regexp_parser (2.1.1)
22
22
  rexml (3.2.5)
23
23
  rspec (3.10.0)
@@ -33,16 +33,16 @@ GEM
33
33
  diff-lcs (>= 1.2.0, < 2.0)
34
34
  rspec-support (~> 3.10.0)
35
35
  rspec-support (3.10.2)
36
- rubocop (1.18.4)
36
+ rubocop (1.20.0)
37
37
  parallel (~> 1.10)
38
38
  parser (>= 3.0.0.0)
39
39
  rainbow (>= 2.2.2, < 4.0)
40
40
  regexp_parser (>= 1.8, < 3.0)
41
41
  rexml
42
- rubocop-ast (>= 1.8.0, < 2.0)
42
+ rubocop-ast (>= 1.9.1, < 2.0)
43
43
  ruby-progressbar (~> 1.7)
44
44
  unicode-display_width (>= 1.4.0, < 3.0)
45
- rubocop-ast (1.8.0)
45
+ rubocop-ast (1.11.0)
46
46
  parser (>= 3.0.1.1)
47
47
  ruby-progressbar (1.11.0)
48
48
  timecop (0.9.4)
@@ -62,4 +62,4 @@ DEPENDENCIES
62
62
  timecop
63
63
 
64
64
  BUNDLED WITH
65
- 2.2.20
65
+ 2.2.15
data/README.md CHANGED
@@ -17,11 +17,11 @@ Switch <-- (PBM): ZR連打
17
17
  * Switch本体とドック
18
18
  * Raspberry Pi4 Model B/4GB(Raspberry Pi OS (32-bit))
19
19
  * 他のシリーズは未確認です
20
+ * zeroは非対応
20
21
  * データ通信が可能なUSBケーブル
21
22
 
22
23
  ## 使うソフトウェア
23
- * 必須
24
- * ruby-3.0.x
24
+ * ruby-3.0.x
25
25
 
26
26
  ## Usage
27
27
  * USBガジェットモードで起動するRaspberry Pi4を用意する
@@ -52,7 +52,6 @@ Switch <-- (PBM): ZR連打
52
52
  * 操作するdeviceファイルの所有者がrootだから
53
53
 
54
54
  ## TODO
55
- * ラズパイのプロビジョニングを楽にしたい
56
55
  * レコーディング機能(プロコンの入力をマクロとして登録ができる)
57
56
  * マクロにdelayを入れれるようにする
58
57
  * 設定ファイル マクロの引数に、ボタンを取れるようにする
@@ -71,6 +70,10 @@ end
71
70
  sudo kill -USR2 `cat ./pbm_pid`
72
71
  ```
73
72
 
73
+ ### リリース手順
74
+ * project_template/app.rb, lib/procon_bypass_man/version.rb のバージョンをあげる
75
+ * be rake release
76
+
74
77
  ## License
75
78
 
76
79
  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
@@ -13,7 +13,7 @@
13
13
  * /etc/dphys-swapfile を CONF_SWAPSIZE=1024 にする
14
14
  * sudo /etc/init.d/dphys-swapfile restart && swapon -s
15
15
  * tailscale をインストールする(optional)
16
- * sudo apt-get install vim rbenv
16
+ * sudo apt-get install vim rbenv git -y
17
17
  * rbenvでrubyを入れる
18
18
  * git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
19
19
  * rbenv install 3.0.1
@@ -22,20 +22,25 @@
22
22
  * sshkeyを作成する
23
23
  * github に鍵を登録する
24
24
  * ~/.ssh/authorized_keys に鍵を登録する
25
- * sudo pip3 install fluent-logger pytz
26
25
  * ガジェットモードで起動する
27
26
  * /boot/config.txtに、dtoverlay=dwc2を追記
28
-  * echo "dwc2" | sudo tee -a /etc/modules
29
-  * echo "libcomposite" | sudo tee -a /etc/modules
30
-  * sudo cat /etc/modules
27
+ * echo "dwc2" | sudo tee -a /etc/modules
28
+ * echo "libcomposite" | sudo tee -a /etc/modules
29
+ * sudo cat /etc/modules
31
30
  * cd ~ && wget https://gist.githubusercontent.com/jiikko/3f9fb3194c0cc7685e31fbfcb5b5f9ff/raw/23ddee29d94350be80b79d290ac3c8ce8400bd88/add_procon_gadget.sh
32
31
  * chmod 755 ~/add_procon_gadget.sh
33
32
  * sudo reboot
34
33
  * sudo sh ~/add_procon_gadget.sh の実行に成功させる
35
34
  * /etc/rc.local に sh /home/pi/add_procon_gadget.sh って書く
36
- * cd ~ && mkdir -p src && cd ~/src && git clone https://github.com/jiikko/procon_bypass_man_sample && cd procon_bypass_man && sudo bundle install
35
+ * cd ~ && mkdir -p src && cd ~/src && git clone https://github.com/jiikko/procon_bypass_man_sample && cd procon_bypass_man_sample
37
36
 
38
- おわり. 起動する時は都度sudo ruby app.rb を実行する
37
+ おわり. 起動する時は都度 sudo ruby app.rb を実行する
39
38
 
40
39
  ## 参考
41
40
  * https://mtosak-tech.hatenablog.jp/entry/2020/08/22/114622
41
+
42
+ # TIPS
43
+ * SDカードにイメージを焼くときは、ImagerのAdvanced Optionsを使うとセットアップが楽になる
44
+ * raspios_liteにした方が起動が早くなりそう
45
+ * https://qiita.com/Liesegang/items/dcdc669f80d1bf721c21
46
+ * http://ftp.jaist.ac.jp/pub/raspberrypi/raspios_lite_armhf
@@ -0,0 +1,45 @@
1
+ run_command "apt-get update"
2
+
3
+ package 'ruby' do
4
+ action :install
5
+ end
6
+
7
+ package 'vim' do
8
+ action :install
9
+ end
10
+
11
+ package 'git' do
12
+ action :install
13
+ end
14
+
15
+ gem_package 'bundler' do
16
+ action :install
17
+ end
18
+
19
+ # OTG
20
+ execute "append dtoverlay=dwc2 to /boot/config.txt" do
21
+ not_if "grep dtoverlay=dwc2 /boot/config.txt"
22
+ command "echo 'dtoverlay=dwc2' >> /boot/config.txt"
23
+ end
24
+
25
+ execute "append dwc2 to /etc/modules" do
26
+ not_if "grep dwc2 /etc/modules"
27
+ command "echo dwc2 >> /etc/modules"
28
+ end
29
+
30
+ execute "append libcomposite to /etc/modules" do
31
+ not_if "grep libcomposite /etc/modules"
32
+ command "echo libcomposite >> /etc/modules"
33
+ end
34
+
35
+ # PBM
36
+ execute "Initialize PBM" do
37
+ command <<~SHELL
38
+ sudo mkdir -p /usr/share/pbm/shared
39
+ wget https://gist.githubusercontent.com/jiikko/3f9fb3194c0cc7685e31fbfcb5b5f9ff/raw/23ddee29d94350be80b79d290ac3c8ce8400bd88/add_procon_gadget.sh -O /usr/share/pbm/shared/add_procon_gadget.sh
40
+ chmod +x /usr/share/pbm/shared/add_procon_gadget.sh
41
+ SHELL
42
+ end
43
+
44
+ run_command 'systemctl disable triggerhappy'
45
+ run_command 'systemctl disable bluetooth'
@@ -0,0 +1,13 @@
1
+ # Raspberry Pi4のセットアップ手順 With mitamae
2
+ * SDカードにRaspberry Pi OS lite (32-bit)を焼く
3
+ * sshをできる状態で焼いておく
4
+ * SDカードをRaspberry Pi4本体に挿して起動する
5
+ * sshする
6
+ * curl -L https://github.com/itamae-kitchen/mitamae/releases/latest/download/mitamae-armhf-linux.tar.gz | tar xvz
7
+ * wget https://raw.githubusercontent.com/splaplapla/procon_bypass_man/master/docs/setup_raspi.mitamae.rb -O setup_raspi.mitamae.rb
8
+ * sudo ./mitamae-armhf-linux local setup_raspi.mitamae.rb -l debug
9
+ * sudo reboot
10
+ * sudo sh /usr/share/pbm/shared/add_procon_gadget.sh の実行に成功させる
11
+ * /etc/rc.local に sh /usr/share/pbm/shared/add_procon_gadget.sh って書く
12
+ * PCとRaspberry Pi4を接続し、プロコンとして認識していることを確認する
13
+ * TOOD install pbmenv
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProconBypassMan
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
@@ -0,0 +1,16 @@
1
+ # Project Template
2
+ https://github.com/splaplapla/pbmenv で使っているファイルです
3
+
4
+ ## systemd
5
+ * sudo ln -s /usr/share/pbm/current/systemd_units/pbm.service /etc/systemd/system/pbm.service
6
+ * commnds
7
+ * systemctl daemon-reload
8
+ * systemctl enable pbm.service
9
+ * systemctl disable pbm.service
10
+ * systemctl start pbm.service
11
+ * systemctl status pbm.service
12
+ * systemctl restart pbm.service
13
+
14
+ ### ログ
15
+ * journalctl -xe -f
16
+
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/inline'
4
+
5
+ gemfile do
6
+ source 'https://rubygems.org'
7
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
8
+ gem 'procon_bypass_man', '0.1.7'
9
+ gem 'procon_bypass_man-splatoon2', github: 'splaplapla/procon_bypass_man-splatoon2', tag: "0.1.1"
10
+ end
11
+
12
+ ProconBypassMan.tap do |pbm|
13
+ pbm.root = File.expand_path(__dir__)
14
+ pbm.logger = Logger.new("#{ProconBypassMan.root}/app.log", 5, 1024 * 1024 * 10)
15
+ pbm.logger.level = :debug
16
+ end
17
+
18
+ ProconBypassMan.run(setting_path: "./setting.yml")
@@ -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 "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.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-18 00:00:00.000000000 Z
11
+ date: 2021-09-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: extension for Nintendo Switch Pro Controller
14
14
  email:
@@ -32,10 +32,10 @@ files:
32
32
  - bin/setup
33
33
  - docs/how_to_connect_procon.md
34
34
  - docs/setup_raspi.md
35
- - examples/pbm.service
35
+ - docs/setup_raspi.mitamae.rb
36
+ - docs/setup_raspi_by_mitamae.md
36
37
  - examples/practical/app.rb
37
38
  - examples/practical/setting.yml
38
- - examples/simple.rb
39
39
  - lib/procon_bypass_man.rb
40
40
  - lib/procon_bypass_man/bypass.rb
41
41
  - lib/procon_bypass_man/configuration.rb
@@ -58,6 +58,10 @@ files:
58
58
  - lib/procon_bypass_man/timer.rb
59
59
  - lib/procon_bypass_man/version.rb
60
60
  - procon_bypass_man.gemspec
61
+ - project_template/README.md
62
+ - project_template/app.rb
63
+ - project_template/setting.yml
64
+ - project_template/systemd_units/pbm.service
61
65
  homepage: https://github.com/splaplapla/procon_bypass_man
62
66
  licenses:
63
67
  - MIT
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,13 +0,0 @@
1
- ProconBypassMan.run do
2
- prefix_keys_for_changing_layer [:zr, :r, :zl, :l]
3
-
4
- layer :up, mode: :manual do
5
- flip :zr, if_pressed: :zr
6
- end
7
- layer :right
8
- layer :left
9
- layer :down do
10
- flip :zl
11
- end
12
- end
13
-