Skip to content

Commit

Permalink
Up to 1.0.12-20220305
Browse files Browse the repository at this point in the history
  • Loading branch information
4IceG authored Mar 5, 2022
1 parent b945cee commit 773a223
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 15 deletions.
2 changes: 1 addition & 1 deletion luci-app-modemband/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PKG_NAME:=luci-app-modemband
LUCI_TITLE:=LuCI panel for modemband
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+sms-tool +modemband
PKG_VERSION:=1.0.11-20220226
PKG_VERSION:=1.0.12-20220305
PKG_RELEASE:=1

include $(TOPDIR)/feeds/luci/luci.mk
Expand Down
103 changes: 99 additions & 4 deletions luci-app-modemband/htdocs/luci-static/resources/view/modem/blte.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,57 @@ var SYSTmagic = form.DummyValue.extend({
}
});

var UPboost = form.DummyValue.extend({

load: function() {
var onuploadbtn = E('button', {
'class': 'btn cbi-button cbi-button-neutral',
'click': ui.createHandlerFn(this, function() {
return handleAction('onupload');
}),
}, _('Enable'));

var offuploadbtn = E('button', {
'class': 'btn cbi-button cbi-button-neutral',
'click': ui.createHandlerFn(this, function() {
return handleAction('offupload');
}),

}, _('Disable'));

return L.resolveDefault(fs.exec_direct('/usr/bin/modemband.sh'), 'null').then(L.bind(function(html) {
if (html == null) {
this.default = E('em', {}, [ _('The modemband error.') ]);
}
else {
this.default = E([
E('div', { 'class': 'cbi-value' }, [
E('label', { 'class': 'cbi-value-title' },
_('Enable aggregation')
),
E('div', { 'class': 'cbi-value-field', 'style': 'width:25vw' },
E('div', { 'class': 'cbi-section-node' }, [
onuploadbtn,
]),
),
]),
E('div', { 'class': 'cbi-value' }, [
E('label', { 'class': 'cbi-value-title' },
_('Disable aggregation')
),
E('div', { 'class': 'cbi-value-field', 'style': 'width:25vw' },
E('div', { 'class': 'cbi-section-node' }, [
offuploadbtn,
]),
),
]),

]);
}
}, this));
}
});

var cbiRichListValue = form.ListValue.extend({
renderWidget: function(section_id, option_index, cfgvalue) {
var choices = this.transformChoices();
Expand Down Expand Up @@ -176,6 +227,19 @@ function handleAction(ev) {
fs.exec('/sbin/ifup', [ wname ]);
});
}
if (ev === 'onupload') {
return uci.load('modemband').then(function() {
var sport = (uci.get('modemband', '@modemband[0]', 'set_port'));
fs.exec_direct('/usr/bin/sms_tool', [ '-d' , sport , 'at' , 'AT+ZULCA=1' ]);
});

}
if (ev === 'offupload') {
return uci.load('modemband').then(function() {
var sport = (uci.get('modemband', '@modemband[0]', 'set_port'));
fs.exec_direct('/usr/bin/sms_tool', [ '-d' , sport , 'at' , 'AT+ZULCA=0' ]);
});
}
}

return view.extend({
Expand Down Expand Up @@ -285,7 +349,6 @@ return view.extend({

if(!("error" in json)) {
s.tab('bandset', _('Preferred bands settings'));
s.tab('aoptions', _('Additional options'));

o = s.taboption('bandset', cbiRichListValue, 'set_bands',
_('Modification of the bands:'),
Expand All @@ -307,11 +370,43 @@ return view.extend({
s.anonymous = true;
o = s.option(BANDmagic);

s = m.section(form.TypedSection);
s.tab('aoptions', _('Additional options'));
s = m.section(form.TypedSection, 'modemband',
_('Additional options'),
_('Additional options useful for modem configuration.'));

s.tab('opt1', _('Connection / router restart'));
s.anonymous = true;

o = s.taboption('opt1', form.DummyValue, '_dummy');
o.rawhtml = true;
o.default = '<div class="cbi-section-descr">' +
_('Hint: The name of the WAN section can be changed in the package settings panel.') +
'</div>';

o = s.taboption('opt1', SYSTmagic);


s.tab('opt2', _('LTE band aggregation at UL (upload)'));
s.anonymous = true;
o = s.taboption('aoptions', SYSTmagic);

o = s.taboption('opt2', form.DummyValue, '_dummy');
o.rawhtml = true;
o.default = '<div class="cbi-section-descr">' +
_('Hint: Option dedicated to the ZTE MF286D router.') +
'</div>';

if (modem.includes('MF286D')) {
o = s.taboption('opt2', UPboost);

} else {
o = s.taboption('opt2', form.DummyValue, '_dummy');
o.rawhtml = true;
o.default = '<div class="cbi-value-field"><em>' +
_('No supported modem / router was found...') +
'</em></div>';
};


}

return m.render();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ return view.extend({
load: function() {
return fs.list('/dev').then(function(devs) {
return devs.filter(function(dev) {
return dev.name.match(/^ttyUSB/);
return dev.name.match(/^ttyUSB/) || dev.name.match(/^cdc-wdm/) || dev.name.match(/^ttyACM/);
});
});
},
Expand All @@ -32,6 +32,14 @@ return view.extend({
o.noaliases = true;
o.default = 'wan';

o = s.option(form.Value, 'set_port', _('Port for communication with the modem'),
_("Select one of the available ttyUSBX ports."));
devs.forEach(function(dev) {
o.value('/dev/' + dev.name);
});
o.placeholder = _('Please select a port');
o.rmempty = false;

o = s.option(form.Flag, 'wanrestart', _('Restart WAN'),
_('WAN restart after making changes to bands.')
);
Expand All @@ -41,15 +49,6 @@ return view.extend({
_('Modem restart after making changes to bands.')
);
o.rmempty = false;

o = s.option(form.Value, 'set_port', _('Port for communication with the modem'),
_("Select one of the available ttyUSBX ports."));
devs.forEach(function(dev) {
o.value('/dev/' + dev.name);
});
o.depends("modemrestart", "1");
o.placeholder = _('Please select a port');
o.rmempty = false;

o = s.option(form.Value, 'restartcmd', _('Restart with AT command'),
_('AT command to restart the modem.')
Expand Down
30 changes: 30 additions & 0 deletions luci-app-modemband/po/pl/modemband.po
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,33 @@ msgstr "Nie znaleziono obsługiwanego modemu, kończymy pracę..."

msgid "Port not found, quitting..."
msgstr "Port nie został znaleziony, kończymy pracę..."

msgid "Additional options useful for modem configuration."
msgstr "Dodatkowe opcje przydatne przy konfiguracji modemu."

msgid "Connection / router restart"
msgstr "Restart połączenia / routera"

msgid "Hint: The name of the WAN section can be changed in the package settings panel."
msgstr "Podpowiedź: Nazwę sekcji WAN można zmienić w panelu ustawień pakietu."

msgid "LTE band aggregation at UL (upload)"
msgstr "Agregacja pasm LTE w UL (upload)"

msgid "No supported modem / router was found..."
msgstr "Nie znaleziono obsługiwanego modemu / routera..."

msgid "Hint: Option dedicated to the ZTE MF286D router."
msgstr "Podpowiedź: Opcja dedykowana dla routera ZTE MF286D."

msgid "Enable aggregation"
msgstr "Włącz agregację"

msgid "Disable aggregation"
msgstr "Wyłącz agregację"

msgid "Disable"
msgstr "Wyłącz"

msgid "Enable"
msgstr "Włącz"
14 changes: 14 additions & 0 deletions luci-app-modemband/root/usr/share/modemband/probeport.gcom
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
let $d = $env("DEVICE")
if $d = "" goto timeout

open com $d
set com 115200n81
set senddelay 0.05
waitquiet 2 0.5
send "AT^m"
waitfor 2 "OK" "+CME ERROR"
if % = -1 goto timeout
exit 0

:timeout
exit 1

0 comments on commit 773a223

Please sign in to comment.