2 # SPDX-License-Identifier: GPL-2.0-or-later
4 # This script migrates GPIO switch pin numbers
5 # from kernel versions prior to 6.6
6 # See https://lists.openwrt.org/pipermail/openwrt-devel/2024-March/042448.html
10 ten64_update_gpioswitch_num
() {
12 config_get gpio_pin
"${section}" gpio_pin
13 config_get gpio_name
"${section}" name
14 if [ -z "${gpio_pin}" ]; then
17 local this_pin_name
=$
(uci get
"system.${section}.name")
18 if [ "${gpio_pin}" -lt 640 ]; then
19 new_pin_value
=$
(( $gpio_pin + 272 ))
20 uci
set "system.${section}.gpio_pin=${new_pin_value}"
25 if [ "${board}" != "traverse,ten64" ]; then
29 KERNEL_MINOR
=$
(uname
-r |
awk -F '.' '{print $2}')
30 if [ "${KERNEL_MINOR}" -lt "6" ]; then
35 config_foreach ten64_update_gpioswitch_num gpio_switch