Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac compatibility? #2

Open
moretty opened this issue Sep 10, 2015 · 8 comments
Open

Mac compatibility? #2

moretty opened this issue Sep 10, 2015 · 8 comments

Comments

@moretty
Copy link

moretty commented Sep 10, 2015

Hi there! I want to know if there is a way to run this on a Mac? I saw that windows and linux versions uses different kind of usb connectors. Do you know how to do it in a Mac?

@Loghorn
Copy link
Owner

Loghorn commented Sep 11, 2015

I'm sorry but I don't have a Mac to test with, but since the library uses node-usb to communicate with the ANT device and node-usb should work on Mac, you shouldn't have any problem. If you have issues when installing node-usb, please refer to https://www.npmjs.com/package/usb for more details.
On the other hand, if you find and fix issues with this library on Mac, please submit a pull request and I will accept it :-)

@mattdsteele
Copy link
Contributor

I've been trying to get this working on a Mac and have been running into issues.

My device: Suunto Movestick (same vendor/product id as GarminStick2).

When I try to run this program:

var Ant = require('ant-plus');
var stick = new Ant.GarminStick2();
var sensor = new Ant.HeartRateSensor(stick);
if (!stick.open()) {
  console.log('stick not found');
}

I get this error: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access

It looks like it's related to this issue, I'm not sure how to resolve it though.

@Loghorn
Copy link
Owner

Loghorn commented Nov 16, 2015

Can you try to comment the line 298 of ant.ts (this.iface.claim();) and see if it fixes the issue on Mac? If it does I will make a permanent change.
Thank you

@mattdsteele
Copy link
Contributor

Didn't seem to help, I get a segfault. At debug level 4:

[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 3.131655] [0000050f] libusb: debug [libusb_get_device_list]
[ 3.131729] [0000050f] libusb: debug [discovered_devs_append] need to increase capacity
[ 3.131879] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132020] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132152] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132244] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132306] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132393] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132444] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132509] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132559] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132607] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132671] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132722] [0000050f] libusb: debug [libusb_get_device_descriptor]
[ 3.132963] [0000050f] libusb: debug [libusb_open] open 20.6
[ 3.133027] [0000050f] libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
[ 3.133152] [0000050f] libusb: debug [usbi_add_pollfd] add fd 19 events 1
[ 3.133175] [0000050f] libusb: debug [darwin_open] device open for access
[ 3.133219] [00003e0b] libusb: debug [handle_events] poll() returned 1
[ 3.133239] [00003e0b] libusb: debug [handle_events] caught a fish on the control pipe
[ 3.133262] [00003e0b] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 3.133270] [00003e0b] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 3.133276] [00003e0b] libusb: debug [handle_events] poll fds modified, reallocating
[ 3.133282] [00003e0b] libusb: debug [handle_events] poll() 3 fds with timeout in 60000ms
[ 3.135039] [0000050f] libusb: debug [ep_to_pipeRef] converting ep address 0x81 to pipeRef and interface
[ 3.135064] [0000050f] libusb: warning [ep_to_pipeRef] no pipeRef found with endpoint address 0x81.
[ 3.135072] [0000050f] libusb: error [submit_bulk_transfer] endpoint not found on any open interface
[ 3.135079] [0000050f] libusb: debug [ep_to_pipeRef] converting ep address 0x81 to pipeRef and interface
[ 3.135085] [0000050f] libusb: warning [ep_to_pipeRef] no pipeRef found with endpoint address 0x81.
[ 3.135091] [0000050f] libusb: error [submit_bulk_transfer] endpoint not found on any open interface
[ 3.135783] [0000050f] libusb: debug [libusb_cancel_transfer]
[ 3.135801] [0000050f] libusb: debug [ep_to_pipeRef] converting ep address 0x81 to pipeRef and interface
[ 3.135807] [0000050f] libusb: warning [ep_to_pipeRef] no pipeRef found with endpoint address 0x81.
[ 3.135811] [0000050f] libusb: error [darwin_abort_transfers] endpoint not found on any open interface
[ 3.135821] [0000050f] libusb: debug [libusb_cancel_transfer] cancel transfer failed error -5
[ 3.135843] [0000050f] libusb: debug [libusb_cancel_transfer]
[1]    10774 segmentation fault  node index.js

@Loghorn
Copy link
Owner

Loghorn commented Nov 17, 2015

It was a long shot, based on the fact the on the issue you mentioned someone proposed that solution...
I guess we'll have to wait for a fix in node-usb 😞

@designfrontier
Copy link
Contributor

I am using it on a Mac with the Garmin Ant+ stick. Works great. FWIW

@sauy7
Copy link

sauy7 commented Sep 9, 2016

FYI I am using it on a Mac with the Suuntu Movestick. I installed libusb using Homebrew. Works fine.

@cryptocyclist
Copy link
Contributor

cryptocyclist commented Dec 11, 2019

While this issue was raised a long time ago, I hit the same thing myself this evening:

$ node multi-scan.js
libusb: warning [darwin_open] USBDeviceOpen: another process has device opened for exclusive access
libusb: error [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access
libusb: error [darwin_claim_interface] USBInterfaceOpen: another process has device opened for exclusive access
Stick not found!

The issue for me was that Garmin Express actually had the USB stick open!

Found by running

$ lsof | fgrep -i usb
:
Garmin    18945  user  txt       REG                1,5        40112     234637686 /Applications/Garmin Express.app/Contents/Library/LoginItems/Garmin Express Service.app/Contents/MacOS/libusb-compat.dylib
Garmin    18945  user  txt       REG                1,5       130352     234637685 /Applications/Garmin Express.app/Contents/Library/LoginItems/Garmin Express Service.app/Contents/MacOS/libusb.dylib
Garmin    18945  user  txt       REG                1,5       180880      18867932 /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle/Contents/MacOS/IOUSBLib
:

and of course fixed by quitting Garmin Express from the menu bar (and not letting it run in background).

Then it all works. For example

$ node multi-scan.js
startup
id: 51347
HeartRateScannerState {
  DeviceID: 51347,
  BeatTime: 27559,
  BeatCount: 86,
  ComputedHeartRate: 59 }
id: 51347
HeartRateScannerState {
  DeviceID: 51347,
  BeatTime: 27559,
  BeatCount: 86,
  ComputedHeartRate: 59 }
id: 51347
HeartRateScannerState {
  DeviceID: 51347,
  BeatTime: 27559,
  BeatCount: 86,
  ComputedHeartRate: 59,
  PreviousBeat: 26514 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants