This is a stupid example of how the compat_version can be implemented.
It's just for illustration and should not be used except for testing.

While there is nothing remarkable to say about the DEVICE_COMPAT_*
variables, note that the placement of the ucidef_set_compat_version
variable is suboptimal in the example and might actually be done in
a separate file or function.

This also gives rise to interesting possibilities:
If ath79 hadn't been introduced already, we could e.g. set
  ucidef_set_compat_version 1.1
in a default case for ath79, so all ar71xx devices would be required
to upgrade without keeping settings...
---
 .../ath79/generic/base-files/etc/board.d/02_network  | 12 ++++++++++--
 target/linux/ath79/image/generic-tp-link.mk          |  3 +++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network 
b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index f93d914374..1df6826e9e 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -167,11 +167,15 @@ ath79_setup_interfaces()
        dlink,dir-859-a1|\
        engenius,epg5000|\
        tplink,archer-c2-v3|\
-       tplink,tl-wr1043nd-v4|\
        tplink,tl-wr1043n-v5)
                ucidef_add_switch "switch0" \
                        "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
                ;;
+       tplink,tl-wr1043nd-v4)
+               ucidef_add_switch "switch0" \
+                       "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan"
+                       ucidef_set_compat_version "2.0"
+               ;;
        elecom,wrc-1750ghbk2-i|\
        elecom,wrc-300ghbk2-i|\
        sitecom,wlr-8100)
@@ -264,12 +268,16 @@ ath79_setup_interfaces()
        tplink,archer-c7-v4|\
        tplink,archer-c7-v5|\
        tplink,tl-wdr3600-v1|\
-       tplink,tl-wdr4300-v1|\
        tplink,tl-wdr4300-v1-il|\
        tplink,tl-wdr4310-v1)
                ucidef_add_switch "switch0" \
                        "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
                ;;
+       tplink,tl-wdr4300-v1)
+               ucidef_add_switch "switch0" \
+                       "0@eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
+               ucidef_set_compat_version "1.1"
+               ;;
        tplink,archer-c5-v1|\
        tplink,archer-c7-v1|\
        tplink,archer-c7-v2|\
diff --git a/target/linux/ath79/image/generic-tp-link.mk 
b/target/linux/ath79/image/generic-tp-link.mk
index 967eb2a7c3..e18d6aad91 100644
--- a/target/linux/ath79/image/generic-tp-link.mk
+++ b/target/linux/ath79/image/generic-tp-link.mk
@@ -464,6 +464,7 @@ define Device/tplink_tl-wdr4300-v1
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
   TPLINK_HWID := 0x43000001
   SUPPORTED_DEVICES += tl-wdr4300
+  DEVICE_COMPAT_VERSION := 1.1
 endef
 TARGET_DEVICES += tplink_tl-wdr4300-v1
 
@@ -543,6 +544,8 @@ define Device/tplink_tl-wr1043nd-v4
   TPLINK_HWID := 0x10430004
   TPLINK_BOARD_ID := TLWR1043NDV4
   SUPPORTED_DEVICES += tl-wr1043nd-v4
+  DEVICE_COMPAT_VERSION := 2.0
+  DEVICE_COMPAT_MESSAGE := The router cannot be updated because it will 
explode. Flash factory via TFTP instead.
 endef
 TARGET_DEVICES += tplink_tl-wr1043nd-v4
 
-- 
2.20.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to