Skip to content

Commit

Permalink
Close down dongle on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed Dec 11, 2017
1 parent 820bade commit 3d444bf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const DATA_LEN = 16 * 16384 // 256k
const AUTO_GAIN = -100 // Use automatic gain
const MAX_GAIN = 999999 // Use max available gain

process.on('SIGINT', exit)

const argv = require('minimist')(process.argv.slice(2))
argv.openBrowser = argv.openBrowser !== false // default to true

Expand Down Expand Up @@ -182,3 +184,10 @@ function startServer () {
})
}
}

function exit () {
console.log('Closing down RTL-SDR device...')
rtlsdr.cancel_async(dev)
rtlsdr.close(dev)
process.exit()
}

0 comments on commit 3d444bf

Please sign in to comment.