diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 51114e7d..bcb1c4e7 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -128,6 +128,22 @@ "message": "Failed to close serial port" }, + "usbDeviceOpened": { + "message": "USB device successfully opened with ID: $1" + }, + "usbDeviceOpenFail": { + "message": "Failed to open USB device!" + }, + "usbDeviceClosed": { + "message": "USB device successfully closed" + }, + "usbDeviceCloseFail": { + "message": "Failed to close USB device" + }, + "usbDeviceUdevNotice": { + "message": "Are udev rules installed correctly? See docs for instructions" + }, + "noConfigurationReceived": { "message": "No configuration received within 10 seconds, communication failed" }, @@ -190,26 +206,17 @@ "message": "Cycle Time:" }, - "please_grant_usb_permissions": { - "message": "Please click on \"Request Optional Permissions\" button to grant application required USB access" + "dfu_connect_message": { + "message": "Please use the Firmware Flasher to access DFU devices" }, - "usb_permissions_granted": { - "message": "Optional USB permissions granted" + "dfu_erased_kilobytes": { + "message": "Erased $1 kB of flash successfully" }, "eeprom_saved_ok": { "message": "EEPROM saved" }, - "default_optional_permissions_head": { - "message": "Optional USB Permissions" - }, - "default_optional_permissions_text": { - "message": "Due to addition of Naze32PRO to the supported hardware family, Configurator requires USB access to allow firmware flashing via DFU" - }, - "default_request_optional_permissions": { - "message": "Request Optional Permissions" - }, "defaultWelcomeText": { "message": "Welcome to Cleanflight - Configurator, a utility designed to simplify updating, configuring and tuning of your flight controller.

The application supports all hardware that can run cleanflight (SPRacingF3, Vortex, Sparky, DoDo, CC3D/EVO, Air Hero 32, Flip32/+/Deluxe, DragonFly32, CJMCU Microquad, Chebuzz F3, STM32F3Discovery, Hermit, Naze32 Tricopter Frame, Skyline32, Naze/32/Mini/Pro/Blackbox etc)

The firmware source code can be downloaded from here
The newest binary firmware image is available here, development builds available here

Latest CP210x Drivers can be downloaded from here
" }, @@ -1192,4 +1199,4 @@ "controlAxisAux8": { "message": "AUX 8" } -} \ No newline at end of file +} diff --git a/js/gui.js b/js/gui.js index 0f21ed35..bf7c142b 100644 --- a/js/gui.js +++ b/js/gui.js @@ -10,7 +10,6 @@ var GUI_control = function () { this.active_tab; this.tab_switch_in_progress = false; this.operating_system; - this.optional_usb_permissions = false; // controlled by usb permissions code this.interval_array = []; this.timeout_array = []; this.defaultAllowedTabsWhenDisconnected = [ diff --git a/js/port_handler.js b/js/port_handler.js index 88e022b3..6a053cad 100755 --- a/js/port_handler.js +++ b/js/port_handler.js @@ -1,9 +1,14 @@ 'use strict'; +var usbDevices = { + STM32DFU: {'vendorId': 1155, 'productId': 57105} +}; + var PortHandler = new function () { this.initial_ports = false; this.port_detected_callbacks = []; this.port_removed_callbacks = []; + this.dfu_available = false; }; PortHandler.initialize = function () { @@ -131,30 +136,32 @@ PortHandler.check = function () { self.initial_ports = current_ports; } - if (GUI.optional_usb_permissions) { - check_usb_devices(); - } + self.check_usb_devices(); GUI.updateManualPortVisibility(); setTimeout(function () { self.check(); }, 250); }); +}; - function check_usb_devices() { - chrome.usb.getDevices(usbDevices.STM32DFU, function (result) { - if (result.length) { - if (!$("div#port-picker #port [value='DFU']").length) { - $('div#port-picker #port').append(''); - $('div#port-picker #port').val('DFU'); - } - } else { - if ($("div#port-picker #port [value='DFU']").length) { - $("div#port-picker #port [value='DFU']").remove(); - } +PortHandler.check_usb_devices = function (callback) { + chrome.usb.getDevices(usbDevices.STM32DFU, function (result) { + if (result.length) { + if (!$("div#port-picker #port [value='DFU']").length) { + $('div#port-picker #port').append($('