aboutsummaryrefslogtreecommitdiff
path: root/index.js
blob: 72c8f668f619a4bc49c554bcb4fa177225f4ec23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env node
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);
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));