6 var callUSB = rpc.declare({
8 method: 'getUSBDevices',
9 expect: { 'ports': [] }
12 return L.Class.extend({
13 trigger: _('usbport (kernel)'),
18 o = s.option(form.Value, 'port', _('USB Ports'));
19 o.depends('trigger', 'usbport');
22 o.load = function(s) {
25 ]).then(L.bind(function(usbport){
26 for (var i = 0; i < usbport[0].length; i++)
27 o.value(usbport[0][i].port, _('Port %s').format(usbport[0][i].port));
30 o.cfgvalue = function(section_id) {
32 value = uci.get('system', section_id, 'port');
34 if (!Array.isArray(value))
35 value = String(value || '').split(/\s+/);
37 for (var i = 0; i < value.length; i++)
38 if (value[i].match(/^(\d+)-(\d+)$/))
39 ports.push('usb%d-port%d'.format(Regexp.$1, Regexp.$2));