mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-12 10:31:51 +00:00
Add mbim proto support
This commit is contained in:
parent
a3607d0497
commit
e83eb15bd6
2 changed files with 114 additions and 0 deletions
14
luci-proto-mbim/Makefile
Normal file
14
luci-proto-mbim/Makefile
Normal file
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=Support for MBIM
|
||||
LUCI_DEPENDS:=+umbim
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
100
luci-proto-mbim/htdocs/luci-static/resources/protocol/mbim.js
Normal file
100
luci-proto-mbim/htdocs/luci-static/resources/protocol/mbim.js
Normal file
|
@ -0,0 +1,100 @@
|
|||
'use strict';
|
||||
'require rpc';
|
||||
'require form';
|
||||
'require network';
|
||||
|
||||
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(/^mbim-.+$/);
|
||||
|
||||
return network.registerProtocol('mbim', {
|
||||
getI18n: function() {
|
||||
return _('MBIM Cellular');
|
||||
},
|
||||
|
||||
getIfname: function() {
|
||||
return this._ubus('l3_device') || 'mbim-%s'.format(this.sid);
|
||||
},
|
||||
|
||||
getOpkgPackage: function() {
|
||||
return 'umbim';
|
||||
},
|
||||
|
||||
isFloating: function() {
|
||||
return true;
|
||||
},
|
||||
|
||||
isVirtual: function() {
|
||||
return true;
|
||||
},
|
||||
|
||||
getDevices: function() {
|
||||
return null;
|
||||
},
|
||||
|
||||
containsDevice: function(ifname) {
|
||||
return (network.getIfnameOf(ifname) == this.getIfname());
|
||||
},
|
||||
|
||||
renderFormOptions: function(s) {
|
||||
var dev = this.getL3Device() || this.getDevice(), o;
|
||||
|
||||
o = s.taboption('general', form.Value, 'device', _('Modem device'));
|
||||
o.rmempty = false;
|
||||
o.load = function(section_id) {
|
||||
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));
|
||||
};
|
||||
|
||||
s.taboption('general', form.Value, 'apn', _('APN'));
|
||||
s.taboption('general', form.Value, 'pincode', _('PIN'));
|
||||
|
||||
o = s.taboption('general', form.ListValue, 'auth', _('Authentication Type'));
|
||||
o.value('both', 'PAP/CHAP');
|
||||
o.value('pap', 'PAP');
|
||||
o.value('chap', 'CHAP');
|
||||
o.value('none', 'NONE');
|
||||
o.default = 'none';
|
||||
|
||||
o = s.taboption('general', form.Value, 'username', _('PAP/CHAP username'));
|
||||
o.depends('auth', 'pap');
|
||||
o.depends('auth', 'chap');
|
||||
o.depends('auth', 'both');
|
||||
|
||||
o = s.taboption('general', form.Value, 'password', _('PAP/CHAP password'));
|
||||
o.depends('auth', 'pap');
|
||||
o.depends('auth', 'chap');
|
||||
o.depends('auth', 'both');
|
||||
o.password = true;
|
||||
|
||||
if (L.hasSystemFeature('ipv6')) {
|
||||
o = s.taboption('advanced', form.Flag, 'ipv6', _('Enable IPv6 negotiation'));
|
||||
o.default = o.disabled;
|
||||
}
|
||||
|
||||
o = s.taboption('advanced', form.Value, 'delay', _('Modem init timeout'), _('Maximum amount of seconds to wait for the modem to become ready'));
|
||||
o.placeholder = '10';
|
||||
o.datatype = 'min(1)';
|
||||
|
||||
o = s.taboption('general', form.ListValue, 'pdptype', _('PDP Type'));
|
||||
o.value('ipv4v6', 'IPv4/IPv6');
|
||||
o.value('ipv4', 'IPv4');
|
||||
o.value('ipv6', 'IPv6');
|
||||
o.default = 'ipv4v6';
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue