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

Reading from a keyboard? #170

Open
danawoodman opened this issue Feb 15, 2018 · 10 comments
Open

Reading from a keyboard? #170

danawoodman opened this issue Feb 15, 2018 · 10 comments

Comments

@danawoodman
Copy link

Is it possible to read from a keyboard connected to the USB port?

I would like to use a USB RFID reader that sends data over as a keyboard. Is this possible?

@HipsterBrown
Copy link
Contributor

Yes, you should be able to use something like node-hid to read data events from the USB stack .

@danawoodman
Copy link
Author

@HipsterBrown thanks! Does node-hid support the tessel platform?

@HipsterBrown
Copy link
Contributor

Yes, we have compiled binaries for the native dependencies of node-hid version 0.5.4 to work on Tessel's architecture (mipsel).

I can push compiled binaries for the latest release of node-hid (v0.7.2) sometime this week.

@danawoodman
Copy link
Author

@HipsterBrown thanks, does that mean I have to wait to use node-hid until that binary is released?

@HipsterBrown
Copy link
Contributor

@danawoodman No. If you install version 0.5.4 (npm install node-hid@v0.5.4) then you can use it now. Otherwise, yes, you will need to wait.

@danawoodman
Copy link
Author

I installed that version and setup their "hello world":

const HID = require('node-hid')
const devices = HID.devices()

console.log('DEVICES:', devices)

Getting this with a keyboard connected:

node: can't resolve symbol 'libiconv_open'

If I unplug the keyboard I get and empty array (which makes sense)

Any ideas?

@danawoodman
Copy link
Author

@HipsterBrown do you have time to push the v0.7.2 version? Maybe that is the issue?

@rwaldron
Copy link
Contributor

rwaldron commented Mar 5, 2018

@danawoodman I've cross compiled v0.7.2 and uploaded it just now

@danawoodman
Copy link
Author

I updated to the newest version but I am still getting:

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at dirname (path.js:1324:5)
    at Function.exports.getRoot (/tmp/remote-script/node_modules/node-hid/node_modules/bindings/bindings.js:1:1834)
    at exports (/tmp/remote-script/node_modules/node-hid/node_modules/bindings/bindings.js:1:1000)
    at e (/tmp/remote-script/node_modules/node-hid/nodehid.js:1:101)
    at Object.exports.devices (/tmp/remote-script/node_modules/node-hid/nodehid.js:1:1171)
    at Function.devices (/tmp/remote-script/src/models/rfid-reader.js:1:198)
    at s.initializeRFIDReader (/tmp/remote-script/src/models/doorlock.js:1:358)
    at new s (/tmp/remote-script/src/models/doorlock.js:1:259)
    at Object.<anonymous> (/tmp/remote-script/src/boot.js:1:63)

With this code:

const hid = require('node-hid')
console.log(hid.devices())

Any suggestions?

@danawoodman
Copy link
Author

Has anyone ever been able to get node-hid working on a Tessel? This is becoming really frustrating because I bought the Tessel specifically to use a USB RFID reader (the module won't work as it is the wrong frequency). Someone please save my day! 😚

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

3 participants