     print_line = (mac, version, address_size, page_size, page_buffer)->
         console.log " #{left mac, 16} | #{left version, 20} | #{right address_size, 10} | #{right page_size, 9} | #{right page_buffer, 7}"
 
-    scan_devices [], (devices)->
+    scan_devices null, (devices)->
         number_of_devices = Object.keys(devices).length
 
         if number_of_devices == 0


    noble.on 'discover', ( peripheral )->
        if BOOTLOADER_SERVICE_UUID in peripheral.advertisement.serviceUuids
            devices[ peripheral.id ] = peripheral

    noble.on 'stateChange', ( state )->

        if state == 'poweredOn'
            timer = setTimeout (()->
                    noble.stopScanning()
                    cb(devices)
                ), 3000

            noble.startScanning []

                                    peripheral.disconnect()
                                    stop_waiting()

else if options.version
    scan_devices device_address(), (device)->
        if device
            connect_device device, (peripheral, error)->
                if error
                    console.log "#{device.address}: Error: #{error}"
                    process.exit 1
                else
                    execute OPC_GET_VERSION, (error, version)->
                        if error
                            console.log "error requesting version string: #{error}"
                            process.exit 1
                        else
                            console.log version
                            process.exit 0
        else
            console.log "device not found!"
            process.exit 1

else
    console.log "Unrecognized command."
    print_usage()
    process.exit 1

# if options.version
#     connect ->
