1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-17 21:35:33 +03:00

Add an ability to handle multiple DFU device types

This commit is contained in:
jflyper 2018-11-12 20:27:11 +09:00
parent 1fbf411b5a
commit 2f2da42f53
3 changed files with 8 additions and 6 deletions

View file

@ -34,7 +34,8 @@
"notifications", "notifications",
"alwaysOnTopWindows", "alwaysOnTopWindows",
{"usbDevices": [ {"usbDevices": [
{"vendorId": 1155, "productId": 57105} {"vendorId": 1155, "productId": 57105},
{"vendorId": 10473, "productId": 393}
]}, ]},
"webview", "webview",
"unlimitedStorage" "unlimitedStorage"

View file

@ -1,8 +1,9 @@
'use strict'; 'use strict';
var usbDevices = { var usbDevices = { filters: [
STM32DFU: {'vendorId': 1155, 'productId': 57105} {'vendorId': 1155, 'productId': 57105},
}; {'vendorId': 10473, 'productId': 393}
] };
var PortHandler = new function () { var PortHandler = new function () {
this.initial_ports = false; this.initial_ports = false;
@ -146,7 +147,7 @@ PortHandler.check = function () {
}; };
PortHandler.check_usb_devices = function (callback) { PortHandler.check_usb_devices = function (callback) {
chrome.usb.getDevices(usbDevices.STM32DFU, function (result) { chrome.usb.getDevices(usbDevices, function (result) {
if (result.length) { if (result.length) {
if (!$("div#port-picker #port [value='DFU']").length) { if (!$("div#port-picker #port [value='DFU']").length) {
$('div#port-picker #port').append($('<option/>', {value: "DFU", text: "DFU", data: {isDFU: true}})); $('div#port-picker #port').append($('<option/>', {value: "DFU", text: "DFU", data: {isDFU: true}}));

View file

@ -497,7 +497,7 @@ TABS.firmware_flasher.initialize = function (callback) {
} else { } else {
analytics.sendEvent(analytics.EVENT_CATEGORIES.FIRMWARE, 'Flashing'); analytics.sendEvent(analytics.EVENT_CATEGORIES.FIRMWARE, 'Flashing');
STM32DFU.connect(usbDevices.STM32DFU, parsed_hex, options); STM32DFU.connect(usbDevices, parsed_hex, options);
} }
} else { } else {
$('span.progressLabel').text(i18n.getMessage('firmwareFlasherFirmwareNotLoaded')); $('span.progressLabel').text(i18n.getMessage('firmwareFlasherFirmwareNotLoaded'));