Automatic pair

New pull request for automatic pairing feature on Linux (issue #58). Rebased my commits on top of current master.