7 var callUSB = rpc.declare({
9 method: 'getUSBDevices',
10 expect: { 'ports': [] }
13 return baseclass.extend({
14 trigger: _('USB (kernel: usbport)'),
15 description: _('This LED trigger can be used for signalling to the user a presence of USB device in a given port.'),
20 o = s.option(form.MultiValue, 'port', _('USB Ports'));
21 o.depends('trigger', 'usbport');
24 o.load = function(s) {
27 ]).then(L.bind(function(usbport){
28 for (var i = 0; i < usbport[0].length; i++)
29 o.value(usbport[0][i].port, _('Port %s').format(usbport[0][i].port));
32 o.cfgvalue = function(section_id) {
34 value = uci.get('system', section_id, 'port');
36 if (!Array.isArray(value))
37 value = String(value || '').split(/\s+/);
39 for (var i = 0; i < value.length; i++)
40 if (value[i].match(/^(\d+)-(\d+)$/))
41 ports.push('usb%d-port%d'.format(Regexp.$1, Regexp.$2));