cmaion/polar

Getting it to work in linux

Closed this issue · 2 comments

Dear cmaion,

I drive a linux.
I have run into a few programs that expect an obsolete usb library to be available recently. I wonder if something similar is happening with polar_watch_tools...

My udev should be good;
[ 9453.289854] usb 3-2: new full-speed USB device number 6 using xhci_hcd [ 9453.464388] usb 3-2: New USB device found, idVendor=0da4, idProduct=0008, bcdDevice= 1.00 [ 9453.464396] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 9453.464400] usb 3-2: Product: Polar V800 [ 9453.464403] usb 3-2: Manufacturer: Polar Electro Oy [ 9453.464406] usb 3-2: SerialNumber: XXXXXXX [ 9453.494267] hid-generic 000X:0XXX:00XX.00XX: hiddev0,hidraw4: USB HID v1.11 Device [Polar Electro Oy Polar V800] on usb-00XX:0X:00.X-X/input0

When I fire up $ ruby polar_ftp DIR / or $ ruby polar_ftp -d/dev/usb/hiddev0 DIR / or even $ ruby polar_ftp -d/dev/hidraw4, I get:
<internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in require': cannot load such file -- libusb (LoadError)
from internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:85:in require' from /home/XXX/Marxism/GPS/V800/polar_watch_tools-master/lib/polar_usb.rb:3:in <top (required)>'
from /home/XXX/Marxism/GPS/V800/polar_watch_tools-master/lib/polar_ftp.rb:3:in require_relative' from /home/XXX/Marxism/GPS/V800/polar_watch_tools-master/lib/polar_ftp.rb:3:in <top (required)>'
from internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb:85:in require' from <internal:/usr/lib/ruby/vendor_ruby/rubygems/core_ext/kernel_require.rb>:85:in require'
from polar_ftp:15:in <main>'

Which libusb is expected?
$ bundle install says "Using libusb 0.6.4 (x86_64-linux)", and my system has several (libusb-1.0-0-dev, libusb-dev, libusb-0.1-4, and libusb-1.0-0.

I suspect it does not use the system libusb at all.

Do you have any insights?
I am not a ruby programmer, so my ability to examine the code is limited. Might there be something wrong making it not catch the gem installed libusb?

Kind regards,
ZB

cmaion commented

Hi,

I would guess that the ruby executable you are using isn't the one for which gems have been installed, or bundle didn't install the gems where it could find them.
Not sure why, but you may want to check that gem list does indeed (or doesn't) list libusb.
If it doesn't, try installing it manually in your system gems with sudo gem install libusb.

Hello,
I installed all the gems listed in the gemfile manually and I get results. Indeed, it seems that bundle install does a user ruby install, and I was calling the system ruby.
Cheers for the pointer!
Best,
ZB