diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 8c14b6d2..3325fb7d 100755 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -190,11 +190,8 @@ "message": "Cycle Time:" }, - "please_grant_usb_permissions": { - "message": "Please click on \"Request Optional Permissions\" button to grant application required USB access" - }, - "usb_permissions_granted": { - "message": "Optional USB permissions granted" + "dfu_connect_message": { + "message": "Please use the Firmware Flasher to access DFU devices" }, "eeprom_saved_ok": { 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($('