Skip to content

Commit 706a239

Browse files
committed
Add option for manufacturers and developers
1 parent 3562ed9 commit 706a239

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

locales/en/messages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@
105105
"message": "Set connection timeout to allow longer initialisation on device plugin or reboot",
106106
"description": "Change timeout on auto-connect and reboot so the bus has more time to initialize after being detected by the system"
107107
},
108+
"showAllSerialDevices": {
109+
"message": "Show all serial devices (for manufacturers or development)",
110+
"description": "Do not filter serial devices using VID/PID values (for manufacturers or development)"
111+
},
108112
"cordovaForceComputerUI": {
109113
"message": "Use computers interface instead of phones interface"
110114
},

src/js/serial.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,13 @@ const serial = {
270270

271271
chrome.serial.getDevices(function (devices_array) {
272272
const devices = [];
273+
let showAllSerialDevices = false;
274+
273275
devices_array.forEach(function (device) {
274-
const isFC = self.serialDevices.some(el => el.vendorId === device.vendorId) && self.serialDevices.some(el => el.productId === device.productId);
276+
ConfigStorage.get('showAllSerialDevices', res => showAllSerialDevices = res.showAllSerialDevices);
277+
const isKnownSerialDevice = self.serialDevices.some(el => el.vendorId === device.vendorId) && self.serialDevices.some(el => el.productId === device.productId);
275278

276-
if (isFC) {
279+
if (isKnownSerialDevice || showAllSerialDevices) {
277280
devices.push({
278281
path: device.path,
279282
displayName: device.displayName,

src/js/tabs/options.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ options.initialize = function (callback) {
1515
TABS.options.initAnalyticsOptOut();
1616
TABS.options.initCliAutoComplete();
1717
TABS.options.initAutoConnectConnectionTimeout();
18+
TABS.options.initShowAllSerialDevices();
1819
TABS.options.initCordovaForceComputerUI();
1920
TABS.options.initDarkTheme();
2021

@@ -133,6 +134,17 @@ options.initAutoConnectConnectionTimeout = function () {
133134
});
134135
};
135136

137+
options.initShowAllSerialDevices = function() {
138+
const showAllSerialDevicesElement = $('div.showAllSerialDevices input');
139+
ConfigStorage.get('showAllSerialDevices', result => {
140+
showAllSerialDevicesElement
141+
.prop('checked', !!result.showAllSerialDevices)
142+
.on('change', () => ConfigStorage.set({ showAllSerialDevices: showAllSerialDevicesElement.is(':checked') }))
143+
.trigger('change');
144+
});
145+
146+
};
147+
136148
options.initCordovaForceComputerUI = function () {
137149
if (GUI.isCordova() && cordovaUI.canChangeUI) {
138150
ConfigStorage.get('cordovaForceComputerUI', function (result) {

src/tabs/options.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@
4646
</select>
4747
<span i18n="connectionTimeout"></span>
4848
</div>
49+
<div class="showAllSerialDevices margin-bottom">
50+
<div>
51+
<input type="checkbox" class="toggle" />
52+
</div>
53+
<span class="freelabel" i18n="showAllSerialDevices"></span>
54+
</div>
4955
<div class="cordovaForceComputerUI margin-bottom">
5056
<div>
5157
<input type="checkbox" class="toggle" />

0 commit comments

Comments
 (0)