Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Open Stava upload new content page when Garmin Edge 305 is plugged in. NodeJS, node-udev
#!/usr/bin/env node
var udev = require("udev");
var monitor = udev.monitor();
monitor.on("add", function(device) {
// change vendor and model IDs to match your device if not Garmin Edge 305
if(device.ID_VENDOR_ID === "091e" && device.ID_MODEL_ID === "0003") {
require("child_process").spawn("xdg-open", ["http://app.strava.com/upload/garmin_new"], {
env: process.env
});
};
});
@morganrallen

This comment has been minimized.

Copy link
Owner Author

@morganrallen morganrallen commented May 15, 2013

Only tested on Linux. I'd imagine if udev compiles on OSX changing xdg-open to just open will allow it to work there also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment