procon_bypass_man 0.1.7 → 0.1.8

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: 59fe04b1f616674f3f4a500fbc0abf1dce166482b2e7c880e94d0247a7162877
4
- data.tar.gz: 55217706d204a06777fb9c9bfe87a64113dc2bdcfd0efa1079e79afc266690ce
3
+ metadata.gz: 3f5d2c0b9137168508351ca8a1492470cd1f03c31d7eb920010a32f08f92122e
4
+ data.tar.gz: c7f42dd711cb3d8932a8fd6d99ee0735084618411e6cd723eeee8860ca96cd8c
5
5
  SHA512:
6
- metadata.gz: 1c57e7ca180ec142258a4725197e928cf073358743c8e98a78cbd87c4419b05f47859d97428f86dabcaee68f7856596a697a9f211b1f928efd3bb88b9a840c2a
7
- data.tar.gz: fa60bd01934dc80f811bd8871ba256c2cc70fb6cc6cbaa33fd180922fdde5bc70476234d00ce28303acb37229cace8137de540e29483af9d7dce926cd7e75fc6
6
+ metadata.gz: 71a45ddf739c64355197e1a0610d2441eb6445eb6d77eef8fd9cf711265d0a9fc23dfcf2d75075115bf1e546141fec7eab0e20c6469feff6b7dea238d4916951
7
+ data.tar.gz: 1bb4bc56c9310d94d682454b33c3d28ebc0a45753ee292c98cdee47bc94b3400c50ddbbb9c1f08b17ade330829760b4dbc1eef85ea22faf1aa8f9271e1b53e0f
@@ -0,0 +1,33 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ [push]
12
+
13
+ jobs:
14
+ test:
15
+
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ matrix:
19
+ ruby-version: ['2.5', '2.7', '3.0']
20
+
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
+ # uses: ruby/setup-ruby@v1
27
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
28
+ with:
29
+ ruby-version: ${{ matrix.ruby-version }}
30
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
31
+ - name: Run tests
32
+ run: bundle exec rubocop
33
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [0.1.8] - 2021-09-19
2
+ - 使える場合、GC.auto_compactを有効にする
3
+
1
4
  ## [0.1.7] - 2021-09-11
2
5
  - Support pbmenv
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.7)
4
+ procon_bypass_man (0.1.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -52,6 +52,7 @@ PLATFORMS
52
52
  arm-linux
53
53
  arm64-darwin-20
54
54
  armv7l-linux
55
+ x86_64-linux
55
56
 
56
57
  DEPENDENCIES
57
58
  procon_bypass_man!
data/Rakefile CHANGED
@@ -1,4 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- task default: %i[]
4
+
5
+ begin
6
+ require 'rspec/core/rake_task'
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ task default: :spec
11
+ rescue LoadError
12
+ # no rspec available
13
+ end
@@ -41,5 +41,8 @@ execute "Initialize PBM" do
41
41
  SHELL
42
42
  end
43
43
 
44
- run_command 'systemctl disable triggerhappy'
45
- run_command 'systemctl disable bluetooth'
44
+ run_command 'sudo systemctl disable triggerhappy.socket'
45
+ run_command 'sudo systemctl disable triggerhappy.service'
46
+ run_command 'sudo systemctl disable bluetooth'
47
+ run_command 'sudo systemctl disable apt-daily-upgrade.timer'
48
+ run_command 'sudo systemctl disable apt-daily.timer'
@@ -10,4 +10,5 @@
10
10
  * sudo sh /usr/share/pbm/shared/add_procon_gadget.sh の実行に成功させる
11
11
  * /etc/rc.local に sh /usr/share/pbm/shared/add_procon_gadget.sh って書く
12
12
  * PCとRaspberry Pi4を接続し、プロコンとして認識していることを確認する
13
- * TOOD install pbmenv
13
+ * sudo gem i pbmenv
14
+ * sudo pbmenv install latest
@@ -37,16 +37,16 @@ class ProconBypassMan::DeviceConnector
37
37
  ["8005"],
38
38
  ["0010"],
39
39
  ], read_from: :switch)
40
- # 1
40
+ # 1. Sends current connection status, and if the Joy-Con are connected,
41
41
  s.add([["8001"]], read_from: :switch)
42
42
  s.add([/^8101/], read_from: :procon) # <<< 81010003176d96e7a5480000000, macaddressとコントローラー番号を返す
43
- # 2
43
+ # 2. Sends handshaking packets over UART to the Joy-Con or Pro Controller Broadcom chip. This command can only be called once per session.
44
44
  s.add([["8002"]], read_from: :switch)
45
45
  s.add([/^8102/], read_from: :procon)
46
46
  # 3
47
47
  s.add([/^0100/], read_from: :switch)
48
48
  s.add([/^21/], read_from: :procon)
49
- # 4
49
+ # 4. Forces the Joy-Con or Pro Controller to only talk over USB HID without any timeouts. This is required for the Pro Controller to not time out and revert to Bluetooth.
50
50
  s.add([["8004"]], read_from: :switch)
51
51
  s.drain_all
52
52
  return [s.switch, s.procon]
@@ -1,4 +1,5 @@
1
1
  require_relative "io_monitor"
2
+ require_relative "uptime"
2
3
 
3
4
  class ProconBypassMan::Runner
4
5
  class InterruptForRestart < StandardError; end
@@ -134,8 +135,6 @@ class ProconBypassMan::Runner
134
135
  end
135
136
 
136
137
  def first_negotiation
137
- return if $will_terminate_token
138
-
139
138
  @gadget, @procon = ProconBypassMan::DeviceConnector.connect
140
139
  rescue ProconBypassMan::Timer::Timeout
141
140
  ::ProconBypassMan.logger.error "デバイスとの通信でタイムアウトが起きて接続ができませんでした。"
@@ -164,6 +163,7 @@ class ProconBypassMan::Runner
164
163
  root: #{ProconBypassMan.root}
165
164
  pid_path: #{ProconBypassMan.pid_path}
166
165
  setting_path: #{ProconBypassMan::Configuration.instance.setting_path}
166
+ uptime from boot: #{ProconBypassMan::Uptime.from_boot} sec
167
167
  ----
168
168
  EOF
169
169
  ProconBypassMan.logger.info(booted_message)
@@ -0,0 +1,13 @@
1
+ require "time"
2
+
3
+ module ProconBypassMan
4
+ class Uptime
5
+ def self.from_boot
6
+ boot_time = Time.parse(`uptime -s`.chomp).to_i
7
+ return Time.now.to_i - boot_time.to_i
8
+ rescue => e
9
+ ProconBypassMan.logger.error(e)
10
+ return "error!"
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProconBypassMan
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.8"
5
5
  end
@@ -14,6 +14,11 @@ require_relative "procon_bypass_man/procon"
14
14
  STDOUT.sync = true
15
15
  Thread.abort_on_exception = true
16
16
 
17
+ # new feature from ruby3.0's
18
+ if GC.respond_to?(:auto_compact)
19
+ GC.auto_compact = true
20
+ end
21
+
17
22
  module ProconBypassMan
18
23
  class ProConRejected < StandardError; end
19
24
  class CouldNotLoadConfigError < StandardError; end
@@ -3,13 +3,14 @@ https://github.com/splaplapla/pbmenv で使っているファイルです
3
3
 
4
4
  ## systemd
5
5
  * sudo ln -s /usr/share/pbm/current/systemd_units/pbm.service /etc/systemd/system/pbm.service
6
- * commnds
6
+ * commands
7
7
  * systemctl daemon-reload
8
8
  * systemctl enable pbm.service
9
9
  * systemctl disable pbm.service
10
10
  * systemctl start pbm.service
11
11
  * systemctl status pbm.service
12
12
  * systemctl restart pbm.service
13
+ * systemctl list-unit-files --type=service
13
14
 
14
15
  ### ログ
15
16
  * journalctl -xe -f
@@ -5,7 +5,7 @@ require 'bundler/inline'
5
5
  gemfile do
6
6
  source 'https://rubygems.org'
7
7
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
8
- gem 'procon_bypass_man', '0.1.7'
8
+ gem 'procon_bypass_man', '0.1.8'
9
9
  gem 'procon_bypass_man-splatoon2', github: 'splaplapla/procon_bypass_man-splatoon2', tag: "0.1.1"
10
10
  end
11
11
 
@@ -15,4 +15,4 @@ ProconBypassMan.tap do |pbm|
15
15
  pbm.logger.level = :debug
16
16
  end
17
17
 
18
- ProconBypassMan.run(setting_path: "./setting.yml")
18
+ ProconBypassMan.run(setting_path: "/usr/share/pbm/current/setting.yml")
@@ -5,7 +5,7 @@ After=network.target
5
5
  [Service]
6
6
  Type=simple
7
7
  WorkingDirectory=/usr/share/pbm/current
8
- ExecStart=/bin/bash -c "ruby /usr/share/pbm/current/app.rb"
8
+ ExecStart=/bin/bash -c "/home/pi/.rbenv/versions/3.0.1/bin/ruby /usr/share/pbm/current/app.rb"
9
9
  Restart=always
10
10
  Nice=-19
11
11
 
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.7
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-09-11 00:00:00.000000000 Z
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,6 +18,7 @@ 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"
23
24
  - ".rubocop.yml"
@@ -56,6 +57,7 @@ files:
56
57
  - lib/procon_bypass_man/procon/user_operation.rb
57
58
  - lib/procon_bypass_man/runner.rb
58
59
  - lib/procon_bypass_man/timer.rb
60
+ - lib/procon_bypass_man/uptime.rb
59
61
  - lib/procon_bypass_man/version.rb
60
62
  - procon_bypass_man.gemspec
61
63
  - project_template/README.md