src/cmd/usb-util.js
function openUsbDevice(usbDevice, { dfuMode = false } = {}) {
	if (!dfuMode && usbDevice.isInDfuMode) {
		return when.reject(new Error('The device should not be in DFU mode'));
	}
	return when.resolve().then(() => usbDevice.open())
		.catch(e => handleDeviceOpenError(e));
}
function openUsbDevice(usbDevice, { dfuMode = false } = {}) {
	if (!dfuMode && usbDevice.isInDfuMode) {
		return when.reject(new Error('The device should not be in DFU mode'));
	}
	return when.resolve().then(() => usbDevice.open())
		.catch(e => handleDeviceOpenError(e));
}
function openUsbDevice ( usbDevice , { dfuMode = false } = { } ) { if ( ! dfuMode && usbDevice . isInDfuMode ) { return when . reject ( new Error ( 'The device should not be in DFU mode' ) ) ; } return when . resolve ( ) . then ( ( ) => usbDevice . open ( ) ) . catch ( e => handleDeviceOpenError ( e ) ) ; }
Open a USB device.

This function checks whether the user has necessary permissions to access the device.
Use this function instead of particle-usb's Device.open().

@param {Object} usbDevice USB device.
@param {Object} options Options.
@param {Boolean} [options.dfuMode] Set to `true` if the device can be in DFU mode.
@return {Promise}
Open a USB device .