diff --git a/iopsys-brcm63xx-arm/base-files/lib/db/boards/FT-P3410B b/iopsys-brcm63xx-arm/base-files/lib/db/boards/FT-P3410B index 1986affdd78a822eb3bba55c78aeedda226398b6..823f38a7249407d403bd9a9807657ce2e78cba1a 100644 --- a/iopsys-brcm63xx-arm/base-files/lib/db/boards/FT-P3410B +++ b/iopsys-brcm63xx-arm/base-files/lib/db/boards/FT-P3410B @@ -17,7 +17,7 @@ config board 'board' option ethernetPorts '5' option ethernetWanPort 'eth4' option ethernetPortNames 'LAN1 LAN2 LAN3 LAN4 WAN' - option ethernetPortOrder 'eth0 eth1 eth2 eth3 eth4' + option ethernetPortOrder 'eth3 eth2 eth1 eth0 eth4' option ethernetLanPorts 'eth0 eth1 eth2 eth3' option gpio_one '67' option gpio_zero '40 22' diff --git a/iopsys-brcm63xx-arm/base-files/lib/db/boards/XGX b/iopsys-brcm63xx-arm/base-files/lib/db/boards/XGX index 9addfab2a5e8ce693dc8a04bc1789e33f489dd51..5e84f194f354257934cc6c58677e41a86781586b 100644 --- a/iopsys-brcm63xx-arm/base-files/lib/db/boards/XGX +++ b/iopsys-brcm63xx-arm/base-files/lib/db/boards/XGX @@ -1,21 +1,178 @@ config board 'board' - # Spec + # Specs option hasAdsl '0' option hasVdsl '0' option hasEthWan '0' option hasVoice '0' option hasDect '0' - option hasUsb '0' + option hasUsb '1' + option VoicePorts '0' + option VoiceLeds '0' option hasWifi '0' option hasSfp '1' - # SFP - option sfpBus '/dev/i2c-0' # Voice option VoicePorts '0' + # SFP + option sfpBus '/dev/i2c-0' # Ethernet option ethernetPorts '5' option ethernetWanPort 'eth4' option ethernetPortNames 'LAN1 LAN2 LAN3 LAN4 WAN' option ethernetPortOrder 'eth0 eth1 eth2 eth3 eth4' option ethernetLanPorts 'eth0 eth1 eth2 eth3' + +############################################################################### +# Button config, start +############### gpio buttons, driver config + +config gpio_button gpio_buttons + list buttons gpio_reset + +config gpio_button gpio_reset + option addr 54 + option active low + +############### mapping function button to driver button +config button RESET + list button gpio_reset + option minpress 5000 + option hotplug resetbutton + +############################################################################### +# Led config, start +# + +config gpio_led gpio_leds + list leds wan_yellow + list leds wan_green + list leds usb_green + list leds power_on_green + list leds alarm_red + list leds lan1_green + list leds lan1_yellow + list leds lan2_green + list leds lan2_yellow + list leds lan3_green + list leds lan3_yellow + list leds lan4_yellow + list leds lan4_green + +config gpio_led wan_yellow + option active high + option sysfs_attr 2s + option mode led_linux + +config gpio_led wan_green + option active high + option sysfs_attr 8s + option mode led_linux + +config gpio_led power_on_green + option active high + option sysfs_attr 11s + option mode led_linux + +config gpio_led alarm_red + option active high + option sysfs_attr 5s + option mode led_linux + +config gpio_led lan1_yellow + option active high + option sysfs_attr 1s + option mode led_linux + +config gpio_led lan1_green + option active high + option sysfs_attr 0s + option mode led_linux + +config gpio_led lan2_yellow + option active high + option sysfs_attr 4s + option mode led_linux + +config gpio_led lan2_green + option active high + option sysfs_attr 3s + option mode led_linux + +config gpio_led lan3_yellow + option active high + option sysfs_attr 7s + option mode led_linux + +config gpio_led lan3_green + option active high + option sysfs_attr 6s + option mode led_linux + +config gpio_led lan4_green + option active high + option sysfs_attr 12s + option mode led_linux + +config gpio_led lan4_yellow + option active high + option sysfs_attr 13s + option mode led_linux + +config gpio_led usb_green + option active high + option sysfs_attr 15s + option mode led_linux + + +############### mapping led function to driver led +config led_map led_map + list functions status + list functions usb + list functions wan_speed + list functions lan + + +config led_map led_status + list led_action_ok 'power_on_green = ON' + list led_action_ok 'alarm_red = OFF' + list led_action_off 'power_on_green = OFF' + list led_action_off 'alarm_red = OFF' + list led_action_notice 'power_on_green = FLASH_SLOW' + list led_action_notice 'alarm_red = FLASH_SLOW' + list led_action_alert 'power_on_green = OFF' + list led_action_alert 'alarm_red = FLASH_SLOW' + list led_action_error 'power_on_green = OFF' + list led_action_error 'alarm_red = FLASH_FAST' + +config led_map led_usb + list led_action_ok usb_green=ON + list led_action_off usb_green=OFF + list led_action_notice usb_green=FLASH_SLOW + list led_action_alert usb_green=FLASH_SLOW + list led_action_error usb_green=FLASH_FAST + +config led_map led_wan_speed + list led_action_ok wan_green=ON + list led_action_ok wan_yellow=OFF + list led_action_off wan_green=OFF + list led_action_off wan_yellow=OFF + list led_action_notice wan_green=OFF + list led_action_notice wan_yellow=ON + +config led_map led_lan + list led_action_ok lan1_green=ON + list led_action_ok lan1_yellow=ON + list led_action_ok lan2_green=ON + list led_action_ok lan2_yellow=ON + list led_action_ok lan3_green=ON + list led_action_ok lan3_yellow=ON + list led_action_ok lan4_green=ON + list led_action_ok lan4_yellow=ON + list led_action_off lan1_green=OFF + list led_action_off lan1_yellow=OFF + list led_action_off lan2_green=OFF + list led_action_off lan2_yellow=OFF + list led_action_off lan3_green=OFF + list led_action_off lan3_yellow=OFF + list led_action_off lan4_green=OFF + list led_action_off lan4_yellow=OFF diff --git a/iopsys-brcm63xx-arm/panther/base-files/etc/hotplug.d/button/10-dimmingbutton b/iopsys-brcm63xx-arm/panther/base-files/etc/hotplug.d/button/10-dimmingbutton new file mode 100644 index 0000000000000000000000000000000000000000..72554cd02fe9a9246627d1c81be117245e604ddb --- /dev/null +++ b/iopsys-brcm63xx-arm/panther/base-files/etc/hotplug.d/button/10-dimmingbutton @@ -0,0 +1,81 @@ +#!/bin/sh + +. /lib/functions.sh +. /usr/share/libubox/jshn.sh + +need_to_sync_dimming_states() { + local current_brightness + local previous_brightness + local state_changed=0 + + json_load "$(ubus call led.status status)" + json_get_var previous_brightness brightness + + for led in $(ubus list led.*); do + json_load "$(ubus call "$led" status)" + json_get_var current_brightness brightness + + if [ "$current_brightness" != "$previous_brightness" ]; then + state_changed=1 + break + fi + + previous_brightness="$current_brightness" + done + + return $((state_changed)) +} + +dimming_button() { + local brightness + local current_brightness + local ledname + local needs_sync=0 + + [ -f /etc/config/leds ] || touch /etc/config/leds + + need_to_sync_dimming_states + needs_sync="$?" + + if [ "$needs_sync" != "0" ]; then + for led in $(ubus list led.*); do + ubus call "$led" set "{\"brightness\":0}" + done + fi + + for led in $(ubus list led.*); do + brightness=100 + current_brightness=100 + ledname=${led:4} + + json_load "$(ubus call "$led" status)" + json_get_var current_brightness brightness + + if [ "$current_brightness" -ge 100 ]; then + brightness=75 + elif [ "$current_brightness" -ge 75 ]; then # Slightly dimmed + brightness=15 + elif [ "$current_brightness" -ge 15 ]; then # Significantly dimmed + brightness=0 + case $ledname in + status) brightness=15 ;; + esac + else + brightness=100 + fi + ubus call "$led" set "{\"brightness\":$brightness}" + uci set leds.$ledname.brightness="$brightness" + done + uci commit leds +} + +case "$ACTION" in + add|register) + [ "dimmingbutton" == "$INTERFACE" ] && { + printf "\n\nDimming button is pressed\n\n" > /dev/console + dimming_button + } + ;; + remove|unregister) + ;; +esac diff --git a/iopsys-brcm63xx-arm/panther/base-files/etc/init.d/idone b/iopsys-brcm63xx-arm/panther/base-files/etc/init.d/idone deleted file mode 100755 index 3fba14720397bee9792503da9eb74967009564be..0000000000000000000000000000000000000000 --- a/iopsys-brcm63xx-arm/panther/base-files/etc/init.d/idone +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=9 - - -boot() { - # steady status led to indicate boot process is complete - ubus call led.status set '{"state":"ok"}' 2>/dev/null - - echo "All init.d scripts started." | tee /dev/console - # Cold plug trigger - USB LED etc.. - udevtrigger -} diff --git a/iopsys-brcm63xx-arm/panther/base-files/etc/init.d/udevtrigger b/iopsys-brcm63xx-arm/panther/base-files/etc/init.d/udevtrigger new file mode 100755 index 0000000000000000000000000000000000000000..3057dbc2b572a860d525afdf89a255a2c0a24b3f --- /dev/null +++ b/iopsys-brcm63xx-arm/panther/base-files/etc/init.d/udevtrigger @@ -0,0 +1,9 @@ +#!/bin/sh /etc/rc.common + +START=8 + + +boot() { + # Cold plug trigger - USB LED etc.. + udevtrigger +} diff --git a/iopsys-brcm63xx-arm/tiger/base-files/etc/hotplug.d/usb/00-led b/iopsys-brcm63xx-arm/tiger/base-files/etc/hotplug.d/usb/00-led new file mode 100644 index 0000000000000000000000000000000000000000..80ea911c3e7e1939ccad95ab3a31a6380e3e61a2 --- /dev/null +++ b/iopsys-brcm63xx-arm/tiger/base-files/etc/hotplug.d/usb/00-led @@ -0,0 +1,17 @@ +#!/bin/sh + +readonly BASENAME="$(basename "$DEVPATH")" +[ "${BASENAME:0:3}" = "usb" -a "$ACTION" = "add" ] && exit 0 +[ "${BASENAME:0:3}" = "usb" ] && ACTION="notice" # A root-hub disappeared, this SHOULD NOT happen! + +case "$ACTION" in + add) + ubus call led.usb set '{ "state": "ok" }' + ;; + notice) + ubus call led.usb set '{ "state": "notice" }' + ;; + *) + ubus call led.usb set '{ "state": "off" }' + ;; +esac diff --git a/iopsys-brcm63xx-arm/tiger/base-files/etc/init.d/udevtrigger b/iopsys-brcm63xx-arm/tiger/base-files/etc/init.d/udevtrigger new file mode 100755 index 0000000000000000000000000000000000000000..3057dbc2b572a860d525afdf89a255a2c0a24b3f --- /dev/null +++ b/iopsys-brcm63xx-arm/tiger/base-files/etc/init.d/udevtrigger @@ -0,0 +1,9 @@ +#!/bin/sh /etc/rc.common + +START=8 + + +boot() { + # Cold plug trigger - USB LED etc.. + udevtrigger +}