aboutsummaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
authorAdam Hovorka <[email protected]>2020-07-21 21:49:37 -0600
committerAdam Hovorka <[email protected]>2020-07-21 21:49:37 -0600
commite97ee92acc19b30c8e3c044049ea5951d8c45d63 (patch)
treec2b6624aa7db7afea5af8d30f6c19d9ef2128a0d /index.js
parent72713e0dfba06e4b3d91d500c60f34695c9715c1 (diff)
Chunk events into discrete sets of start/end points
Diffstat (limited to 'index.js')
-rwxr-xr-xindex.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/index.js b/index.js
index 0ff053e..72c8f66 100755
--- a/index.js
+++ b/index.js
@@ -1,13 +1,13 @@
#!/usr/bin/env node
-const Device = require("./lib");
+const Device = require("./lib/device");
+const Motion = require("./lib/motion");
const path = "/dev/input/"+process.argv[2];
console.log("Opening %s", path);
const device = new Device(path);
-device.on("error", e => console.error("Reader error:", e))
- .on("open", () => { console.log(device.id); device.grab(); })
- .on("EV_KEY", e => console.log(/*e.time,*/ "KEY", e.code, e.value))
- .on("EV_ABS", e => console.log(/*e.time,*/ "ABS", e.code, e.value))
- .on("EV_REL", e => console.log(/*e.time,*/ "REN", e.code, e.value))
- .on("EV_SYN", e => console.log(/*e.time,*/ "SYN", e.code, e.value))
+const motion = new Motion(device);
+device.on("open", () => { console.log(device.id); device.grab(); });
+motion.on("error", console.error)
+ .on("short", e => console.log("short", e))
+ .on("long", e => console.log("long", e));