From 659f1c3ab2fd33b74236f1ade39e31e3d3f49e26 Mon Sep 17 00:00:00 2001 From: TAGAWA Takao Date: Wed, 6 May 2020 20:31:16 +0900 Subject: [PATCH 1/4] Add hidapi library for other OS --- lib/hid_api.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/hid_api.rb b/lib/hid_api.rb index 5196746..c5f2ca8 100644 --- a/lib/hid_api.rb +++ b/lib/hid_api.rb @@ -4,8 +4,10 @@ module HidApi class HidError < StandardError; end + HIDAPI_LIBS = %w(hidapi hidapi-libusb hidapi-hidraw).freeze + extend FFI::Library - ffi_lib "hidapi" + ffi_lib HIDAPI_LIBS autoload :Deprecated, "hid_api/deprecated" autoload :Device, "hid_api/device" From 0c7aded9ec4731ec56bbfa38cb09cb981c904bc0 Mon Sep 17 00:00:00 2001 From: TAGAWA Takao Date: Wed, 6 May 2020 20:38:10 +0900 Subject: [PATCH 2/4] Add "For macOS" and "For Debian" to "Dependencies" of README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 986a097..e820d44 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,14 @@ This gem is my first attempt at writing any FFI code, and my first attempt to us The gem requires the hidapi library to be installed and available to Ruby. On Mac with homebrew installed, this can be done with the command: +### For macOS + $ brew install hidapi +### For Debian + + $ sudo apt install libhidapi-dev libhidapi-hidraw0 libhidapi-libusb0 + ## Installation Add this line to your application's Gemfile: From ef2dfb63954b5beb89789b9f1052d502fde7d578 Mon Sep 17 00:00:00 2001 From: TAGAWA Takao Date: Wed, 6 May 2020 20:46:02 +0900 Subject: [PATCH 3/4] Add before_install and install libhidapi libraries to .travis.yml --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 884ef18..e8380e0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ language: ruby rvm: - 2.1.5 +before_install: + - sudo apt-get -y install libhidapi-dev libhidapi-hidraw0 libhidapi-libusb0 From fa363607032f20fb8f4994f4e564c5d2f1276f55 Mon Sep 17 00:00:00 2001 From: TAGAWA Takao Date: Wed, 6 May 2020 20:55:08 +0900 Subject: [PATCH 4/4] Delete meaningless test --- spec/hid_api_spec.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/hid_api_spec.rb b/spec/hid_api_spec.rb index 580fdbf..dbe359d 100644 --- a/spec/hid_api_spec.rb +++ b/spec/hid_api_spec.rb @@ -4,8 +4,4 @@ it "has a version number" do expect(HidApi::VERSION).not_to be nil end - - it "does something useful" do - expect(false).to eq(true) - end end