I'm trying to log any input data that comes from a piano connected to computer via usb.
$ lsusb
...
Bus 003 Device 046: ID fc08:0101
....
Bus 003 Device 046: ID fc08:0101 is my piano.
If I do $ cat /dev/bus/usb/003/046 I get something strange:
�P e�2 $ $A$$ $ $ �% %
Also, I wrote a little NodeJS script that should create a read stream and log data:
var Fs = require("fs");
var str = Fs.createReadStream("/dev/bus/usb/003/046");
str.on("data", function (chunk) {
console.log("data: " + chunk.toString());
});
str.on("error", function (chunk) {
console.log("error" + chunk.toString());
});
str.on("end", function (chunk) {
console.log("ended");
});
Output:
$ node read.js
data: �P e�2 $ $A$$ $ $ �% %
ended
Why is the stream ending? How can I capture data coming from piano?
Is it possible to parse data and log the piano key that I pressed?
I'm running Ubuntu 14.04.
Try /dev/input/by-id/[Your piano]
For example, my mouse is at /dev/input/by-id/usb-Microsoft_Microsoft_5-Button_Mouse_with_IntelliEye_TM_-event-mouse