Узел usb, данные не получены

Я использую следующий код для получения данных от ключа ANT+. Я использовал другое программное обеспечение (Zwift, которое показывает, что ключ фактически получил данные) (с использованием OS X):

/* Require the config */
require('dotenv').config()
/* require the usb class */
var usb = require('usb');

/* find the device */
var device = usb.findByIds(process.env.VENDOR_ID, process.env.PRODUCT_ID);
/* open the device */
device.open(true);
/* claim interface WHERE IS THIS FOR */
const [interface] = device.interfaces;
interface.claim();

/* Start Polling */
const [inEndpoint, outEndpoint] = interface.endpoints;
inEndpoint.startPoll();
// inEndpoint.transferType = 2;

inEndpoint.on('data', (d) => {
    console.log("usb data:", d, " len:", d.length)
});

inEndpoint.on('error', function (error) {
    console.log("on error", error);
});

Я делаю что-то не так?

Ниже вы найдете логин, я думаю, что я все делаю правильно, но он должен что-то делать с узлом.

[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.003821] [00000307] libusb: debug [libusb_get_device_list] 
[ 0.003925] [00000307] libusb: debug [libusb_get_device_descriptor] 
[ 0.004005] [00000307] libusb: debug [libusb_get_device_descriptor] 
[ 0.004021] [00000307] libusb: debug [libusb_get_device_descriptor] 
[ 0.004033] [00000307] libusb: debug [libusb_get_device_descriptor] 
[ 0.004125] [00000307] libusb: debug [libusb_open] open 20.9
[ 0.004269] [00000307] libusb: debug [usbi_add_pollfd] add fd 26 events 1
[ 0.004275] [00000307] libusb: debug [darwin_open] device open for access
[ 0.004301] [00004903] libusb: debug [handle_events] poll() returned 1
[ 0.004306] [00004903] libusb: debug [handle_events] caught a fish on the control pipe
[ 0.004319] [00004903] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.004322] [00004903] libusb: debug [libusb_try_lock_events] someone else is modifying poll fds
[ 0.004324] [00004903] libusb: debug [libusb_event_handler_active] someone else is modifying poll fds
[ 0.004327] [00004903] libusb: debug [libusb_handle_events_timeout_completed] another thread is doing event handling
[ 0.004368] [00004903] libusb: debug [libusb_get_next_timeout] no URBs, no timeout!
[ 0.004380] [00004903] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 0.004384] [00004903] libusb: debug [handle_events] poll fds modified, reallocating
[ 0.004389] [00004903] libusb: debug [handle_events] poll() 3 fds with timeout in 60000ms
[ 0.004736] [00000307] libusb: debug [libusb_claim_interface] interface 0
[ 0.005084] [00000307] libusb: debug [get_endpoints] building table of endpoints.
[ 0.005100] [00000307] libusb: debug [get_endpoints] interface: 0 pipe 1: dir: 1 number: 1
[ 0.005107] [00000307] libusb: debug [get_endpoints] interface: 0 pipe 2: dir: 0 number: 1
[ 0.005133] [00000307] libusb: debug [darwin_claim_interface] interface opened
[ 0.005445] [00000307] libusb: debug [ep_to_pipeRef] converting ep address 0x81 to pipeRef and interface
[ 0.005454] [00000307] libusb: debug [ep_to_pipeRef] pipe 1 on interface 0 matches
[ 0.005540] [00000307] libusb: debug [ep_to_pipeRef] converting ep address 0x81 to pipeRef and interface
[ 0.005547] [00000307] libusb: debug [ep_to_pipeRef] pipe 1 on interface 0 matches
[ 0.005572] [00000307] libusb: debug [ep_to_pipeRef] converting ep address 0x81 to pipeRef and interface
[ 0.005576] [00000307] libusb: debug [ep_to_pipeRef] pipe 1 on interface 0 matches
[60.006611] [00004903] libusb: debug [handle_events] poll() returned 0
[60.006708] [00004903] libusb: debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
[60.006727] [00004903] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[60.006742] [00004903] libusb: debug [handle_events] poll() 3 fds with timeout in 60000ms
[120.011876] [00004903] libusb: debug [handle_events] poll() returned 0
[120.011973] [00004903] libusb: debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
[120.011994] [00004903] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[120.012007] [00004903] libusb: debug [handle_events] poll() 3 fds with timeout in 60000ms
[180.012077] [00004903] libusb: debug [handle_events] poll() returned 0
[180.012106] [00004903] libusb: debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
[180.012112] [00004903] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[180.012116] [00004903] libusb: debug [handle_events] poll() 3 fds with timeout in 60000ms

0 ответов

Другие вопросы по тегам