43 Commits

Author SHA1 Message Date
Adrian Schmutzler
6005494f25
base-files: add function to remove devicename from LED labels
Currently, we request LED labels in OpenWrt to follow the scheme

  modelname:color:function

However, specifying the modelname at the beginning is actually
entirely useless for the devices we support in OpenWrt. In patches
subsequent to this one, we will thus remove the modelname from
the label definitions on various targets.

To migrate the existing definitions from older installations,
a migration script needs to be deployed that does

  modelname:color:function -> color:function

e.g.

  dir-789:green:status -> green:status

This patch introduces two functions that do exactly that:
For each entry in /etc/config/system, the routine will check whether
two (or more) colons are present, and then remove everything up to
(and including) the first colon.

For now, this will be applied unconditionally, i.e. if the function
is called for a device, all labels will be cut like this.

However, for a future case of mixed three-part and two-part labels,
it should not be too hard to provide a function argument with
exceptions to the removal.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-22 01:29:45 +08:00
John Crispin
1fdf787f83
base-files: add board.d support for bridge device
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>
2020-11-08 02:08:43 +08:00
Petr Štetiar
35eeaf7679 base-files: add support for the new ar8xxx MIB counters settings
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>
2020-10-14 20:06:07 +08:00
AmadeusGhost
ead018693c Merge Mainline 2020-10-13 19:00:16 +08:00
Adrian Schmutzler
2dc590d630 base-files: source functions.sh in /lib/functions/system.sh
The file /lib/functions/system.sh depends on find_mtd_index() and
find_mtd_part() located in /lib/function.sh, so let's source that
file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:54:18 +08:00
Rosen Penev
e2aef72220 base-files/system.sh: remove $ in $(())
Not needed.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-10-13 18:53:58 +08:00
Adrian Schmutzler
1398716680 base-files: don't store label MAC address in uci system config
If set, label MAC address is available from one of two sources,
device tree or board.json. So far, the function get_mac_label
was meant for retrieving the address, while an option in uci
system config was specified only for case 2 (board.json).

The uci config option has several drawbacks:
- it is only used for a fraction of devices (those not in DT)
- label MAC address is a device property, while config implies
  user interaction
- label_macaddr option will only be set if /etc/config/system
  does not exist (i.e. only for new installations)

Thus, this patch changes the behavior of get_mac_label:
Instead of writing the value in board.json to uci system config
and reading from this location afterwards, get_mac_label now
extracts data from board.json directly. The uci config option
won't be used anymore.
In addition, two utility functions for extraction only from DT
or from board.json are introduced.

Since this is only changing the access to the label MAC address, it
won't interfere with the addresses stored in the code base so far.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:52:50 +08:00
Adrian Schmutzler
a34c043890 base-files: provide option to specify label MAC address in board.d
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>
2020-10-13 18:52:23 +08:00
Adrian Schmutzler
ba5180c747 base-files: add function to retrieve label MAC address
To refer to the MAC address on a device's label, one can
specify the alias label-mac-device in the DTS which should
point to the bearer of the corresponding MAC address.

With the function get_mac_label, the user can retrieve then
retrieve this address and use it as a value that uniquely
identifies his device.

This is severely helpful for several downstream functionalities,
e.g. define MAC addresses of custom netifs or change the SSID to
be easily recognizable.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:52:00 +08:00
Adrian Schmutzler
c1b72b8178 base-files: use get_mac_binary() in mtd_get_mac_binary_ubi()
The actual retrieval of the MAC address in mtd_get_mac_binary_ubi()
is the same as in get_mac_binary(). Thus, use the latter function
in the former to reduce duplicate code.

This will also allow to benefit from the enhanced path check there
and bring mtd_get_mac_binary_ubi() more in line with the similar
mtd_get_mac_binary().

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:51:31 +08:00
Adrian Schmutzler
c731bccc2a base-files: Fix path check in get_mac_binary
Logic was inverted when changing from string check to file check.
Fix it.

Fixes: 8592602d0a88 ("base-files: Really check path in get_mac_binary")
Reported-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:51:10 +08:00
Adrian Schmutzler
dd5236d4b7 base-files: Really check path in get_mac_binary
Currently, path argument is only checked for being not empty.

This changes behavior to actually check whether path exists.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-13 18:50:47 +08:00
Thomas Albers
8205266f87 base-files: fix LED IDE trigger
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>
2020-10-13 18:35:44 +08:00
Florian Eckert
ac9b04e2fa base-files: add network_get_uptime() to /lib/functions/network.sh
Add missing ubus api call for uptime value.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-10-13 18:33:19 +08:00
Piotr Dymacz
d6860f8f9a base-files: diag: restore default trigger for 'boot' LED
For devices without a dedicated 'diag' LED, we use sometimes one of
other LEDs for indicating at least 'boot', 'failsafe' and 'upgrade'
stages. In some cases, at the same time these LEDs have defined default
triggers in DTS using 'linux,default-trigger' property. Current 'diag'
setup removes the trigger and turns off 'boot' LED after bootup.

This patch extends 'diag.sh' and 'leds.sh' scripts to make sure default
trigger defined in DTS is restored for 'diag' LED which isn't used for
indicating 'running' stage.

Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2020-10-13 18:26:08 +08:00
CN_SZTL
9fff61c268
Merge Mainline 2020-09-06 14:35:11 +08:00
Christian Lamparter
8be3c496f9
base-files: support label-property-less in get_dt_leds
The LED's "label" property has been deprecated in upstream by:

|commit c5d18dd6b64e09dd6984bda9bdd55160af537a8c
|Author: Jacek Anaszewski <jacek.anaszewski@gmail.com>
|Date:   Sun Jun 9 20:19:04 2019 +0200
|
|    dt-bindings: leds: Add properties for LED name construction
|
|    Introduce dedicated properties for conveying information about
|    LED function and color. Mark old "label" property as deprecated.
|
|    Additionally function-enumerator property is being provided
|    for the cases when neither function nor color can be used
|    for LED differentiation.

in order to be somewhat prepared, this patch adds a fallback
as a last resort to make the current led code work by falling
back to the node-name as the "label".

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-09-06 13:22:08 +08:00
CN_SZTL
4afad7690d
Merge Mainline 2020-09-04 15:53:54 +08:00
Walter Sonius
c1c5b38f7c base-files: fix comment typo in lib/functions/network.sh
Fix typo in comment.

Signed-off-by: Walter Sonius <walterav1984@gmail.com>
[commit title/message facelift]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-02 11:33:22 +08:00
David Bauer
f11241f0fc
base-files: add function for generating random MAC
This adds a function for generating a valid random MAC address (unset MC
bit / set locally administered bit).

It is necessary for devices which do not have a MAC address programmed
by the manufacturer.

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-07-18 13:25:37 +08:00
Kuan-Yi Li
87980872d2 base-files: gpio switch: add named GPIO support
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>
2020-06-19 11:58:15 +08:00
Thomas Albers
2d4a8204a4 base-files: fix LED IDE trigger
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>
2020-06-04 12:16:00 +08:00
AmadeusGhost
aac401fc39 lantiq: sync official source code 2020-04-25 18:29:43 +08:00
AmadeusGhost
caf22aa4ce apm821xx/archs38/armvirt/gemini/imx6/kirkwood/lantiq/malta: add kernel 5.4 support 2020-04-16 18:09:15 +08:00
AmadeusGhost
9f1b8f1812 ipq40xx: sync source code
This commit sync ipq40xx from openwrt and x-wrt.

1. ac58u: use ath10k-ct-smallbuffers instead of ath10k, avoid memory
explosion.
2. hugo-ac1200: It seems that only one device, so move the content of
dtsi to dts.

Signed-off-by: AmadeusGhost <amadeus@jmu.edu.cn>

ipq40xx: add support for ASUS RT-ACRH17/RT-AC82U/RT-AC42U

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>

ipq40xx: easy install for ASUS RT-AC58U/RT-ACRH13

This patch make it easy to flash via web upgrade from factory firmware.

idea from 981213

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2020-02-25 17:26:06 +08:00
CN_SZTL
5893c0d03c
Merge Lean's source 2020-02-03 14:13:23 +08:00
coolsnowwolf
ecea39f109 Revert "files: sync from openwrt v19.07 (#2690)"
This reverts commit 2289184a623c4da882a376abb649969dee73654f.
2020-02-03 12:33:25 +08:00
CN_SZTL
e6abd4e3ba
Merge Lean's source 2020-02-01 17:10:56 +08:00
AmadeusGhost
2289184a62
files: sync from openwrt v19.07 (#2690) 2020-02-01 16:50:37 +08:00
CN_SZTL
92e3440682
Revert "base-files: update"
This reverts commit 468c38afbf472940f4e3cdac41dc03674c7852a9.
2019-11-24 01:27:26 +08:00
CN_SZTL
468c38afbf
base-files: update 2019-11-23 18:21:44 +08:00
CN_SZTL
38864eaeb6
Revert "base-files: update"
This reverts commit d88d3ca89a9ab431ec9c25077be2fe96aaba1499.
2019-11-07 11:43:47 +08:00
CN_SZTL
d88d3ca89a
base-files: update 2019-11-07 11:41:06 +08:00
CN_SZTL
ce8ed9121b
add luci-app-haproxy & luci-app-udpspeederv2 2019-05-25 21:05:51 +08:00
coolsnowwolf
9d54c42ced update base-files sync with upstream 2018-10-14 12:59:07 +08:00
coolsnowwolf
806f5db174 sync with OpenWrt trunk 2018-09-07 13:43:55 +08:00
coolsnowwolf
9ba04fd0d7 sync with OpenWrt v18.06.1 stable new R8.1 version 2018-08-23 17:40:23 +08:00
coolsnowwolf
8fe0636b8a Merge branch 'master' of github.com:lede-project/source 2018-04-23 18:50:49 +08:00
coolsnowwolf
20f7e75789 update to R7.5.4 2018-01-15 18:26:41 +08:00
coolsnowwolf
b1266c659b fix some target VLAN switch untagged settings 2018-01-13 16:14:03 +08:00
coolsnowwolf
b0f643aa87 update to R7.5.3 stable to fix firewall freeze 2018-01-10 20:55:06 +08:00
coolsnowwolf
229cde62a4 Merge branch 'master' of https://github.com/lede-project/source 2018-01-09 14:38:15 +08:00
coolsnowwolf
97a4ffcc12 update source 2017-09-06 19:19:45 +08:00