aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/functions/uci-defaults.sh
Commit message (Collapse)AuthorAgeFilesLines
* treewide: drop shebang from non-executable lib filesAdrian Schmutzler2021-01-291-2/+0
| | | | | | | | | | | | This drops the shebang from another bunch of files in various /lib folders, as these are sourced and the shebang is useless. Fix execute bit in one case, too. This should cover almost all trivial cases now, i.e. where /lib is actually used for library files. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: allow setting device and bridge macsJohn Crispin2020-12-021-1/+17
| | | | | | | | | Add code for setting mac addresses inside board.json and rendering them out to uci. On switches we want to have a unique MAC on each port. With 48 port switches that would require 48 device sections in /etc/config/network. Doing so via board.json is easier. Signed-off-by: John Crispin <john@phrozen.org>
* base-files: add board.d support for bridge deviceJohn Crispin2020-11-041-0/+4
| | | | | | | | | Latest netifd allows us to setup network bridges with implicit vlan tagging. For this to work, we need to setup several additional uci sections. This feature is particularly usefull for DSA tupe devices. Add board.d and uci-defaults support for generating the sections. Signed-off-by: John Crispin <john@phrozen.org>
* base-files: add support for compat_version on deviceAdrian Schmutzler2020-07-311-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We regularly encounter the situation that devices are subject to changes that will make them incompatible to previous versions. Removing SUPPORTED_DEVICES will not really be helpful in most of these cases, as this only helps after a rename. To solve this situation, this patchset introduces a compatibility version for devices. To complement the DEVICE_COMPAT_VERSION set for the image to be flashed, this implements a compat_version on the device, so it will have something to compare with the image. The only viable way to achieve this seems to be via board.d files, i.e. this is technically adding a compat version for the device's config. Like for the network setup, this will set up a command ucidef_set_compat_version to set the compat_version in board.d. This will then add a string to /etc/board.json, which will be translated into uci system config by bin/config_generate. By this, the compat_version, being a version of the config, will also be exposed to the user. As with DEVICE_COMPAT_VERSION, missing uci entry will be assumed as compat_version "1.0", so we only need to add this if a device needs to be bumped, e.g. ucidef_set_compat_version "1.1" Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: gpio switch: add named GPIO supportKuan-Yi Li2020-06-181-1/+1
| | | | | | | | | | | | | | | | Previously, gpio_switch only accepts GPIO pin number as input. Once a GPIO pin is exported and named by device tree, its pin state cannot be configured and saved across reboots by UCI. This patch adds support for named GPIO pins. Thus GPIO pin can be exported by device tree with active high/low correctly configured, having human-readable name in /sys/class/gpio/ is also now possible. More importantly, GPIO pins which are referenced by name will be immune from pin mapping breakage while unintentional pin number changes are introduced by kernel or driver updates. Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
* base-files: fix LED IDE triggerThomas Albers2020-06-031-1/+1
| | | | | | | | | | This changes the ide-disk LED trigger to the generic disk-activity as ide-disk trigger was removed in upstream commit eb25cb9956cc ("leds: convert IDE trigger to common disk trigger"). Signed-off-by: Thomas Albers <thomas.gameiro@googlemail.com> [split into separate commit, commit description facelift] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* base-files: uci-defaults: do config flush in one shotRoman Yeryomin2019-10-221-2/+1
| | | | | | | | | | | Moving a file between tmpfs and other fs is neither faster nor safer, thus no point in doing it in two steps. Use new jshn option to write output directly to file. Originally discussed here: http://lists.openwrt.org/pipermail/openwrt-devel/2017-December/010127.html Signed-off-by: Roman Yeryomin <roman@advem.lv>
* base-files: provide option to specify label MAC address in board.dAdrian Schmutzler2019-09-191-0/+8
| | | | | | | | | | | | | | For many devices, MAC addresses cannot be retrieved via the device tree alias. To still provide the label MAC address for those, this implements a second mechanism that will put the address into uci config. Note that this stores the actual MAC address, whereas in DTS we reference the bearing device. This is based on the work of Rosy Song <rosysong@rosinson.com> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: fix uci led oneshot/timer triggerRobinson Wu2019-06-201-0/+1
| | | | | | | | | | | | | This patch adds a missing type property. This fixes the creation of oneshot and timer led triggers like: | ucidef_set_led_timer "system" "system" "zhuotk:green:system" "1000" "1000" from /etc/init.d/01_leds. Fixes: b06a286a4861 ("base-files: cleanup led functions in uci-defaults.sh") Signed-off-by: Robinson Wu <wurobinson@qq.com> Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* base-files: add support for the new ar8xxx MIB counters settingsPetr Štetiar2019-05-201-0/+13
| | | | | | | | | | | | | Commit "generic: ar8216: add mib_poll_interval switch attribute" has added mib_poll_interval global config option and commit "generic: ar8216: group MIB counters and use two basic ones only by default" has added mib_type config option. So this patch adds ucidef_set_ar8xxx_switch_mib helper function which would allow configuration of the above mentioned new switch config options. Signed-off-by: Petr Štetiar <ynezz@true.cz>
* base-files: make it possible to specify switch led modeChristian Lamparter2018-09-291-0/+2
| | | | | | | | | | | | | | | | | The swconfig switch led driver has the ability to switch between a "link, rx and/or tx" mode. However, this feature was not implemented in uci, the led init script and config_generate. This patch adds a seventh parameter to the ucidef_set_led_switch() function. The accepted values for this parameter are: link, rx and tx. Any permutations of these three values are supported, as long as they are properly encased with quotes. If the parameter is not specified it will default to "all" (link rx tx). Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* base-files: fix ucidef_set_interface() protocol selectionJo-Philipp Wich2018-05-251-5/+11
| | | | | | | | | | | | The previous refactoring of ucidef_set_interface() removed the protocol selection heuristic which breaks the networking defaults for the majority of boards. Re-add the protocol selection and rename two bad "proto" references to the expected "protocol" value. Fixes: 85048a9c1f ("base-files: rework _ucidef_set_interface to be more generic") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: rework _ucidef_set_interface to be more genericRoman Yeryomin2018-05-241-50/+24
| | | | | | | | | | | | This is a rework of previously submitted patch reworking ucidef_set_interface_raw [1]. Here, keep the idea but instead make _ucidef_set_interface more generic and use it instead of ucidef_set_interface_raw. Also change the users like ucidef_set_interface_lan and others. [1] https://patchwork.ozlabs.org/patch/844961/ Signed-off-by: Roman Yeryomin <roman@advem.lv>
* linux-atm: add br2684ctl option to specify the netdev nameMartin Schiller2018-01-101-0/+2
| | | | | | | | | | | Add the uci option nameprefix to specifc a target netdev name. Patch the br2684ctl code to accept and set a netdev name via commandline parameters. It allows to use the same netdev name for ATM and PTM lines on lantiq xdsl hardware. Signed-off-by: Martin Schiller <ms@dev.tdt.de> Signed-off-by: Mathis Kresin <dev@kresin.me>
* base-files: make ucidef_set_led_rssi offset and factor optionalMathias Kresin2017-06-171-2/+2
| | | | | | | | | | The offset and factor are only related for LEDs which can have different brightness values. But binary LEDs are more common and don't require any further configuation than setting the factor to 1. Use offset = 0 and factor = 1 in case nothing else is specified. Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: add led functions to uci-defaults.shAlberto Bursi2017-05-141-0/+8
| | | | | | | | | | | | | uci_set_leds_ataport() allows to set a led to show activity on a specific (s)ata port, which is needed for devices that have a Sata led for each sata port. The led trigger is from the 834-ledtrig-libata.patch LEDE kernel patch. uci_set_leds_usbhost() allows to set a led to show total usb activity. Signed-off-by: Alberto Bursi <alberto.bursi@outlook.it> [Jo-Philipp Wich: use a single underscore to denote private functions] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: cleanup led functions in uci-defaults.shAlberto Bursi2017-05-141-145/+91
| | | | | | | | | | create a function with code common to all led functions, create another function with code common to functions setting a simple led trigger, restore alphabetical order in function names. Signed-off-by: Alberto Bursi <alberto.bursi@outlook.it> [Jo-Philipp Wich: use a single underscore to denote private functions] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: implement ucidef_set_hostname(), ucidef_set_ntpserver()Jo-Philipp Wich2017-05-031-0/+20
| | | | | | | | | | | | | | Commit 2036ae4 (base-files: support hostname and ntp servers through board.d) was supposed to implement these procedures but lacked the required changes to uci-defaults.sh. Add the missing procedures now to fix config generation on targets relying on hostname or NTP server presetting. Fixes FS#754. Reported-by: Cristian Morales Vega <cristian@samknows.com> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: always set proto passed to _ucidef_set_interface()Mathias Kresin2017-03-111-1/+1
| | | | | | | | | | | | | | | Overwrite an already set proto if a new one is passed to _ucidef_set_interface() similar to what is done for the interface. It is required when using ""ucidef_set_interface_wan 'ptm0' 'pppoe'" after some initial wan interface configuration is already done by ucidef_add_switch. The "json_is_a protocol string" guard is meant to not reset an earlier set interface proto in case something like "ucidef_set_interface_lan 'eth0'" is used afterwards. Signed-off-by: Mathias Kresin <dev@kresin.me>
* base-files: emit tagged switch configuration by defaultJo-Philipp Wich2017-02-021-1/+1
| | | | | | | | | | | | | | | | | | | Instead of only using tagged CPU port configurations when more than one VLAN is present on the switch, always emit tagged configurations unless a board explicitely opts out of this behaviour by using the previously introduced [0-9]u@netdev syntax. Emitting default tagged configurations has the following benefits: - Relation of switch vlans to netdevs is easier to understand, especially for multi-cpu-port switches - Adding additional VLANs (e.g. to break out a LAN port for other purposes) becomes easier as users are not forced to change the existing untagged VLAN to tagged and the existing ifname notation from ethX to ethX.Y anymore, drastly reducing the likelyhood of soft-bricks. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: uci-defaults: support requesting untagged switch port configurationJo-Philipp Wich2016-11-021-8/+14
| | | | | | | | | | | | | Introduce support for a new [0-9]u@netdev syntax to ucidev_add_switch() to let board.d network files request default network switch configurations which do not use tagged CPU ports. This commit itself has no effect on generated configurations at the moment since we still emit untagged configurations by default but it allows boards to opt-out from default tagged configs in case we start emitting tagged settings by default. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: add ucidef_set_led_usbport for full usbport supportRafał Miłecki2016-10-221-0/+24
| | | | | | | | | | | | | | | | | | | | This helper allows using usbport trigger directly. It requires usbport compatible syntax and supports specifying multiple USB ports, e.g.: ucidef_set_led_usbport "usb" "USB" "devicename:colour:function" "usb1-port1" "usb2-port1" This adds a proper object to the board.json, e.g. "usb": { "name": "USB", "type": "usbport", "sysfs": "devicename:colour:function", "ports": [ "usb1-port1", "usb2-port1" ] } and supports translating it into uci section. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* base-files: board_detect: allow specifying the generated fileJonas Gorski2016-08-131-2/+0
| | | | | | | Allow passing a filename to change the location of the generated board.json. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
* base-files: support port_state LED types in board.dJo-Philipp Wich2016-06-081-0/+19
| | | | | | Add support for handling port_state LEDs as used by ADM5120. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: add function ucidef_set_interface_raw to enable default ↵John Crispin2016-03-101-0/+6
| | | | | | | | configuration on interfaces other than lan and wan. Signed-off-by: Micke Prag <micke.prag@telldus.se> SVN-Revision: 48976
* lantiq: do not set default firmware fileFelix Fietkau2016-03-071-4/+2
| | | | | | | | | We are now shipping a DSL firmware, do not set it by default to some file name. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 48941
* base-files: support passing mode to ucidef_set_led_netdev()Jo-Philipp Wich2016-02-261-0/+2
| | | | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 48806
* base-files: add support for speed mask to switch config init scriptsFelix Fietkau2016-02-251-0/+2
| | | | | | | | | | | This patch adds extra parameter to switch LED trigger initialization functions. New functionality maintains backward compatibility, so calling functions without setting new speed_mask parameter works as expected. Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl> SVN-Revision: 48776
* leds: support oneshot as well as timer triggersJohn Crispin2016-02-251-4/+13
| | | | | | | | | oneshot and timer have the same configuration options, just a different trigger name. Signed-off-by: Karl Palsson <karlp@etactica.com> SVN-Revision: 48770
* all: drop old uci-defaults.shJo-Philipp Wich2015-12-111-288/+519
| | | | | | | | | Replace former uci-defaults.sh implementation with the uci-defaults-new.sh one and update all users accordingly. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 47867
* base-files: allow setting ide-disk led triggerJonas Gorski2015-09-041-0/+16
| | | | | | Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 46794
* base-files: added option to configure the gpio led trigger in uci-defaultsJohn Crispin2015-07-141-0/+20
| | | | | | Signed-off-by: Günther Kelleter <guenther.kelleter@devolo.de> SVN-Revision: 46341
* base-files: implemented basic GPIO controlJohn Crispin2015-07-081-0/+24
| | | | | | | | | | Internal GPIO pins are used for PoE passthrough setups in multi-port routers. This patch implemnets control over this hardware feature for Ubiquiti Nanostations and TP-Link CPE510. Signed-off-by: Lars Kruse <lists@sumpfralle.de> SVN-Revision: 46271
* uci-defaults: add ucidef_set_led_mmcJohn Crispin2015-02-141-0/+17
| | | | | | Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> SVN-Revision: 44446
* base-files: Add ucidef_set_led_timer to uci-defaults.shJohn Crispin2015-01-171-0/+20
| | | | | | Signed-off-by: Gerald Kerma <dreagle@doukki.net> SVN-Revision: 44000
* scripts: fix wrong usage of '==' operatorJohn Crispin2014-10-141-1/+1
| | | | | | | | | | | | | | [base-files] shell-scripting: fix wrong usage of '==' operator normally the '==' is used for invoking a regex parser and is a bashism. all of the fixes just want to compare a string. the used busybox-ash will silently "ignore" this mistake, but make it portable/clean at least. this patch does not change the behavior/logic of the scripts. Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com> SVN-Revision: 42911
* network: Unbind DHCPv6 from underlying interfacesSteven Barth2014-10-081-1/+1
| | | | | | | | | This allows IPv6 to set up without IPv4 being up thus IPv6-only or IPv6+DS-Lite working with the default config. Signed-off-by: Steven Barth <steven@midlink.org> SVN-Revision: 42848
* base-files: add a protocol argument to ucidef_set_interface_rawFlorian Fainelli2014-09-251-1/+2
| | | | | | | | | Add a third argument to ucidef_set_interface_raw, which is specifying the protocol. Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 42665
* base-files: enable force_link for lan by defaultFelix Fietkau2014-05-161-0/+1
| | | | | | | | | This allows services to bind to it at boot time instead of waiting for a cable to be plugged in Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40773
* base-files: add ucidef_add_switch_port functionLuka Perkov2014-01-231-0/+10
| | | | | | Signed-off-by: Luka Perkov <luka@openwrt.org> SVN-Revision: 39372
* Change default IPv6 config to enable DHCPv6-PDSteven Barth2013-04-221-1/+1
| | | | SVN-Revision: 36384
* Adapt default network configuration for IPv6Steven Barth2013-04-091-0/+6
| | | | SVN-Revision: 36278
* base-files: uci-defaults for rssiledsGabor Juhos2012-08-131-0/+44
| | | | | | | | Adds capability to add uci-defaults defining RSSI LEDs Signed-off-by: Daniel Golle <dgolle@allnet.de> SVN-Revision: 33164
* base-files: add LED specific functions to /lib/functions/uci-defaultsGabor Juhos2012-05-291-0/+98
| | | | SVN-Revision: 31991
* base-files: add lib/functions/uci-defaults.shGabor Juhos2011-12-011-0/+88
SVN-Revision: 29384