summaryrefslogtreecommitdiffhomepage
path: root/protocols/luci-proto-qmi/htdocs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-09-08 16:12:25 +0200
committerJo-Philipp Wich <jo@mein.io>2019-09-10 15:29:04 +0200
commit9cae3b9e67aef68cd579213bee1865ce1b815027 (patch)
tree902a1138bd8e783108656de279b5a082daa1ad5e /protocols/luci-proto-qmi/htdocs
parent5697ebbef575a182841cfff9e722b513f373ec6a (diff)
protocols: replace luci/getTTYDevices calls with generic file/list ones
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'protocols/luci-proto-qmi/htdocs')
-rw-r--r--protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js b/protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js
index 79b1fd3b2..eeda91f6e 100644
--- a/protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js
+++ b/protocols/luci-proto-qmi/htdocs/luci-static/resources/protocol/qmi.js
@@ -3,11 +3,18 @@
'require form';
'require network';
-var callTTYDevices = rpc.declare({
- object: 'luci',
- method: 'getTTYDevices',
- params: [ 'with_cdc', 'with_tts' ],
- expect: { result: [] }
+var callFileList = rpc.declare({
+ object: 'file',
+ method: 'list',
+ params: [ 'path' ],
+ expect: { entries: [] },
+ filter: function(list, params) {
+ var rv = [];
+ for (var i = 0; i < list.length; i++)
+ if (list[i].name.match(/^cdc-wdm/))
+ rv.push(params.path + list[i].name);
+ return rv.sort();
+ }
});
network.registerPatternVirtual(/^qmi-.+$/);
@@ -50,12 +57,9 @@ return network.registerProtocol('qmi', {
o = s.taboption('general', form.Value, 'device', _('Modem device'));
o.rmempty = false;
o.load = function(section_id) {
- return callTTYDevices(true, false).then(L.bind(function(devices) {
- if (Array.isArray(devices))
- for (var i = 0; i < devices.length; i++)
- if (/cdc-wdm/.test(devices[i]))
- this.value(devices[i]);
-
+ return callFileList('/dev/').then(L.bind(function(devices) {
+ for (var i = 0; i < devices.length; i++)
+ this.value(devices[i]);
return form.Value.prototype.load.apply(this, [section_id]);
}, this));
};