static bool check_connect_methode(struct led *led) { int methode = event_get_value(connect_methode); if (methode < 1) return false; return (led->options.connect_methods & CONNECT_METHODE(methode)) != 0; } static struct blink_code overlay_connect_error(struct led *led) { enum connect_pairing_values event; if (!check_connect_methode(led)) return BLINK_CODE_SKIP; event = event_get_value(connect_pairing); if (event == connect_pairing_error || event == connect_pairing_timeout) { return BLINK_CODE(.type = blink_4HZ); } return BLINK_CODE_SKIP; } static struct blink_code overlay_connect(struct led *led) { enum connect_pairing_values event; if (!check_connect_methode(led)) return BLINK_CODE_SKIP; event = event_get_value(connect_pairing); switch (event) { case connect_pairing_success: return BLINK_CODE(.type = blink_off_on); case connect_pairing_start: return BLINK_CODE(.type = blink_2HZ); case connect_pairing_error: case connect_pairing_timeout: return BLINK_CODE(.type = blink_4HZ); default: return BLINK_CODE_SKIP; } } static struct blink_code default_0_5hz(struct led *led) { return BLINK_CODE(.type = blink_0_5HZ); } static struct blink_code default_2hz(struct led *led) { return BLINK_CODE(.type = blink_2HZ); } static struct blink_code default_off(struct led *led) { return BLINK_CODE(.type = blink_off); } static struct blink_code default_on(struct led *led) { return BLINK_CODE(.type = blink_on); } static struct blink_code default_4hz(struct led *led) { return BLINK_CODE(.type = blink_4HZ); } static bool any_lan(void) { if (event_get_value(lan1) == lan1_active) return true; if (event_get_value(lan2) == lan2_active) return true; if (event_get_value(lan3) == lan3_active) return true; if (event_get_value(lan4) == lan4_active) return true; if (event_get_value(lan5) == lan5_active) return true; return false; } static struct blink_code overlay_lan_bridge_no_cable(struct led *led) { if (event_get_value(access_type) != access_type_lan_bridge) return BLINK_CODE_SKIP; if (!any_lan()) return BLINK_CODE(.type = blink_0_5HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_wlan_bridge_no_uplink(struct led *led) { enum wlan_sta_values wlan = event_get_value(wlan_sta); if (event_get_value(access_type) != access_type_wlan_bridge) return BLINK_CODE_SKIP; if (event_get_value(wlan_sta_base) != wlan_sta_base_configured) return BLINK_CODE_SKIP; if (wlan == wlan_sta_register_failed || wlan == wlan_sta_starting || wlan == wlan_sta_stopping) return BLINK_CODE(.type = blink_0_5HZ); return BLINK_CODE_SKIP; } static int get_wlan_rssi_level(void) { int level = event_get_value(wlan_rssi_level); if (level < 0) return -1; else if (level < 1 * 100 / 6) return 0; else if (level < 2 * 100 / 6) /*--- x < 33 ---*/ return 1; else if (level < 3 * 100 / 6) /*--- x < 50 ---*/ return 2; else if (level < 4 * 100 / 6) /*--- x < 66 ---*/ return 3; else if (level < 5 * 100 / 6) /*--- x < 83 ---*/ return 4; return 5; } static struct blink_code overlay_wlan_uplink_le_2(struct led *led) { int level = get_wlan_rssi_level(); if (event_get_value(access_type) != access_type_wlan_bridge) return BLINK_CODE_SKIP; if (event_get_value(wlan_sta_base) != wlan_sta_base_configured) return BLINK_CODE_SKIP; if (event_get_value(wlan) != wlan_on) return BLINK_CODE_SKIP; if (level < 0) return BLINK_CODE_SKIP; if (level < 2) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_plc_low_phyrate(struct led *led) { if (event_get_value(access_type) != access_type_plc_bridge) return BLINK_CODE_SKIP; if (event_get_value(plc) == plc_low_phyrate) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_plc_bridge(struct led *led) { if (event_get_value(access_type) != access_type_plc_bridge) return BLINK_CODE_SKIP; if (event_get_value(plc) == plc_not_connect) return BLINK_CODE(.type = blink_0_5HZ); if (event_get_value(plc) == plc_on) return BLINK_CODE(.type = blink_on); if (event_get_value(plc) == plc_standby_start) return BLINK_CODE(.type = blink_off); return BLINK_CODE_SKIP; } static struct blink_code overlay_lan_bridge(struct led *led) { if (event_get_value(access_type) != access_type_lan_bridge) return BLINK_CODE_SKIP; if (any_lan()) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_disable_no_wlan(struct led *led) { if (event_get_value(wlan) == wlan_off || event_get_value(wlan) == wlan_error) return BLINK_CODE(.type = blink_off); return BLINK_CODE_SKIP; } static struct blink_code overlay_lan(struct led *led) { if (any_lan()) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } /*-------------------------------------------------------------------*\ * NEXUS-pairing fails on the first start after set factorydefaults, * so we have to wait until the nexus-service is on start - JZ87268 \*-------------------------------------------------------------------*/ static struct blink_code overlay_nexus_not_ready(struct led *led) { if (event_get_value(nexus) != nexus_unknown) return BLINK_CODE_SKIP; return BLINK_CODE(.type = blink_2HZ); } static struct blink_code overlay_nexus_not_ready_off(struct led *led) { if (event_get_value(nexus) != nexus_unknown) return BLINK_CODE_SKIP; return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_bootup(struct led *led) { if (event_get_value(wlan) != wlan_unknown) return BLINK_CODE_SKIP; return BLINK_CODE(.type = blink_2HZ); } static struct blink_code overlay_bootup_slow(struct led *led) { if (event_get_value(wlan) != wlan_unknown) return BLINK_CODE_SKIP; return BLINK_CODE(.type = blink_0_5HZ); } static struct blink_code overlay_wlan_repeater(struct led *led) { enum wlan_sta_values wlan_station = event_get_value(wlan_sta); if (event_get_value(wlan_sta_base) != wlan_sta_base_configured && event_get_value(wlan) == wlan_on) return BLINK_CODE(.type = blink_0_5HZ); if (wlan_station == wlan_sta_register_failed || wlan_station == wlan_sta_starting || wlan_station == wlan_sta_stopping) return BLINK_CODE(.type = blink_off); if (wlan_station == wlan_sta_unregister) return BLINK_CODE(.type = blink_2HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_wlan_uplink_ge_2(struct led *led) { int level = get_wlan_rssi_level(); if (event_get_value(access_type) != access_type_wlan_bridge) return BLINK_CODE_SKIP; if (event_get_value(wlan_sta_base) != wlan_sta_base_configured) return BLINK_CODE_SKIP; if (event_get_value(wlan) != wlan_on) return BLINK_CODE_SKIP; if (level < 0) return BLINK_CODE_SKIP; if (level >= 2) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } /* * This is only used for new style "one-led" repeater, for other repeaters * hardware_error=16 will result in slow blinking */ static struct blink_code overlay_factory_defaults(struct led *led) { if (event_get_value(hardware_error) == 16) return BLINK_CODE(.type = blink_2HZ); if (event_get_value(device) == device_factory_defaults) return BLINK_CODE(.type = blink_off); return BLINK_CODE_SKIP; } static struct blink_code overlay_update(struct led *led) { if (event_get_value(update) == update_running) return BLINK_CODE(.type = blink_2HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_update_off(struct led *led) { if (event_get_value(update) == update_running) return BLINK_CODE(.type = blink_off); return BLINK_CODE_SKIP; } static bool skip_on_connect_events(struct led *led) { // connect_pairing shows that a connect-button just pressed // for example wps triggered by the GUI results in connect_pairing == 0 return (!check_connect_methode(led) && event_get_value(connect_pairing)); } static struct blink_code overlay_wps_error(struct led *led) { enum wps_values val = event_get_value(wps); // the WLAN-Led should not light up when the user has // pressed the Connect-button // if the user pressed the WLAN-button it should flash // if the user started wps on the webgui the led // should also flash if (skip_on_connect_events(led)) return BLINK_CODE_SKIP; if (val == wps_error || val == wps_timeout || val == wlan_sta_wps_error || val == wlan_sta_wps_timeout) return BLINK_CODE(.type = blink_4HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_wps(struct led *led) { enum wps_values val = event_get_value(wps); // the WLAN-Led should not light up when the user has // pressed the Connect-button // if the user pressed the WLAN-button it should flash // if the user started wps on the webgui the led // should also flash if (skip_on_connect_events(led)) return BLINK_CODE_SKIP; if (val == wps_start || val == wlan_sta_wps_start) return BLINK_CODE(.type = blink_2HZ); if (val == wps_success || val == wlan_sta_wps_success) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_hardware_error(struct led *led) { int val = event_get_value(hardware_error); if (val <= 0) return BLINK_CODE_SKIP; // Means factory defaults if (val == 16) return BLINK_CODE_SKIP; return BLINK_CODE(.type = blink_hardware_error, .params = { val, 0 }); } static struct blink_code overlay_message_zentrale(struct led *led) { switch (event_get_value(message_zentrale)) { case message_warning_high_priority: case message_warning_medium_priority: case message_warning_low_priority: /* * Some puma platforms don't have a red colour led to signal * errors. On them this error is signalled by fast blinking. * * Check if we have a non-white current colour defined. If not * use this special case. */ if (led->current_color.red == 0xFF && led->current_color.green == 0xFF && led->current_color.blue == 0xFF) return BLINK_CODE(.type = blink_4HZ); else return BLINK_CODE(.type = blink_on); default: return BLINK_CODE_SKIP; } } static struct blink_code overlay_info_filesystem(struct led *led) { if (event_get_value(filesystem) == filesystem_mount_failure) return BLINK_CODE(.type = blink_4HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_display_suspend(struct led *led) { /// display is simply enabled if (event_get_value(display) != display_suspend) return BLINK_CODE_SKIP; // We force the display on regardless if (event_get_value(display_force) == display_suspend_on_idle) return BLINK_CODE_SKIP; return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_ignore_display_suspend_on_wan_disconnect(struct led *led) { int dsl_status = event_get_value(dsl); int lte_status = event_get_value(lte); if (event_get_value(display_force) == display_suspend_on_idle) return BLINK_CODE_SKIP; if (event_get_value(display) != display_suspend) return BLINK_CODE_SKIP; if (event_get_value(ata) == ata_enable) return BLINK_CODE_SKIP; if (event_get_value(pppoe) == pppoe_on) return BLINK_CODE_SKIP; if (!dsl_status && !lte_status) return BLINK_CODE(.type = blink_1HZ); if ((dsl_status == dsl_verbunden) || (lte_status == lte_verbunden)) return BLINK_CODE_SKIP; return BLINK_CODE(.type = blink_1HZ); } static struct blink_code overlay_power_state(struct led *led) { // Turn if if explicitly requested, otherwise default to on if (event_get_value(power_state) == power_off) return BLINK_CODE(.type = blink_off); return BLINK_CODE_SKIP; } static struct blink_code overlay_uplink_connecting(struct led *led) { if (event_get_value(dsl) == dsl_training) return BLINK_CODE(.type = blink_2HZ_double); if (event_get_value(lte) == lte_suchen) return BLINK_CODE(.type = blink_2HZ_double); return BLINK_CODE_SKIP; } static struct blink_code overlay_uplink_verbunden(struct led *led) { if (event_get_value(dsl) == dsl_verbunden) return BLINK_CODE(.type = blink_on); if (event_get_value(lte) == lte_verbunden) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_ata_mode(struct led *led) { if (event_get_value(ata) == ata_enable) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_wds_repeater(struct led *led) { if (event_get_value(wlan_wds_repeater) == wlan_wds_repeater_enable) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_gsm_error(struct led *led) { enum gsm_values val = event_get_value(gsm); if (val == gsm_sync_failed || val == gsm_isp_error || val == gsm_auth_failed) return BLINK_CODE(.type = blink_2HZ); if (val == gsm_syncing) return BLINK_CODE(.type = blink_1HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_gsm(struct led *led) { enum gsm_values val = event_get_value(gsm); if (val == gsm_off || val == gsm_unknown) return BLINK_CODE_SKIP; if (val == gsm_syncing) return BLINK_CODE(.type = blink_1HZ); return BLINK_CODE(.type = blink_on); } static struct blink_code overlay_wlan(struct led *led) { switch (event_get_value(wlan)) { case wlan_on: { enum wlan_sta_values val = event_get_value(wlan_sta); if (val == wlan_sta_unregister || val == wlan_sta_register_failed) return BLINK_CODE(.type = blink_0_5HZ); return BLINK_CODE(.type = blink_on); } case wlan_error: return BLINK_CODE(.type = blink_4HZ); case wlan_starting: case wlan_configuring: return BLINK_CODE(.type = blink_1HZ); case wlan_dfs_starting: return BLINK_CODE(.type = blink_2HZ_double); case wlan_stopping: return BLINK_CODE(.type = blink_off); default: return BLINK_CODE_SKIP; } } static struct blink_code overlay_wlan_on(struct led *led) { if (event_get_value(wlan) == wlan_on) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_wlan_error(struct led *led) { switch (event_get_value(wlan)) { case wlan_error: return BLINK_CODE(.type = blink_4HZ); default: return BLINK_CODE_SKIP; } } static struct blink_code overlay_wlan_rssi_bar_common(struct led *led) { int level = event_get_value(wlan_rssi_level); enum wlan_sta_values sta = event_get_value(wlan_sta); // This led has no physical location if (led->options.location == 0) return BLINK_CODE_SKIP; if (event_get_value(wlan) != wlan_on) return BLINK_CODE_SKIP; // Can not do a bar without leds if (leds_max_location() == 0) return BLINK_CODE_SKIP; // We want to connect, but we are not ~> disconnected if (sta != wlan_sta_register && sta != wlan_sta_starting && sta != wlan_sta_stopping && sta != wlan_sta_unknown) return BLINK_CODE(.type = blink_0_5HZ); level = (level * (leds_max_location() + 1) / 100); if (level >= led->options.location) return BLINK_CODE(.type = blink_on); else return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_wlan_rssi_bar_sta(struct led *led) { if (event_get_value(access_type) != access_type_wlan_bridge) return BLINK_CODE_SKIP; if (event_get_value(wlan_sta_base) != wlan_sta_base_configured) return BLINK_CODE_SKIP; return overlay_wlan_rssi_bar_common(led); } static struct blink_code overlay_wlan_rssi_bar_client(struct led *led) { if (event_get_value(access_type) != access_type_lan_bridge) return BLINK_CODE_SKIP; return overlay_wlan_rssi_bar_common(led); } static struct blink_code overlay_wlan_bridge_mode(struct led *led) { if (event_get_value(access_type) == access_type_wlan_bridge) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } // after 30s we go from wlan lost to wlan failed static struct blink_code overlay_disable_wlan_failed(struct led *led) { enum wlan_sta_values sta = event_get_value(wlan_sta); if (event_get_value(wlan) != wlan_on) return BLINK_CODE_SKIP; if (event_get_value(access_type) != access_type_wlan_bridge) return BLINK_CODE_SKIP; if (event_get_value(wlan_sta_base) != wlan_sta_base_configured) return BLINK_CODE_SKIP; // Will be signaled by other led if (sta != wlan_sta_register && sta != wlan_sta_starting && sta != wlan_sta_stopping && sta != wlan_sta_unknown) return BLINK_CODE(.type = blink_off); return BLINK_CODE_SKIP; } static struct blink_code overlay_info_klingelsperre(struct led *led) { if (event_get_value(switch_info) != switch_info_to_klingelsperre_aktiv) return BLINK_CODE_SKIP; if (event_get_value(fon_info_klingelsperre) == fon_info_klingelsperre_aktiv) return BLINK_CODE(.type = blink_on); else return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_info_tam_mwi(struct led *led) { int info = event_get_value(switch_info); if (info != switch_info_to_tam_fax_missed_call && info != switch_info_to_tam_mwi) return BLINK_CODE_SKIP; if (event_get_value(fon_info_tam) == fon_info_tam_set_mwi) return BLINK_CODE(.type = blink_1HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_info_fax_mwi(struct led *led) { int info = event_get_value(switch_info); if (info != switch_info_to_tam_fax_missed_call && info != switch_info_to_fax_mwi) return BLINK_CODE_SKIP; if (event_get_value(fon_info_fax) == fon_info_fax_set_mwi) return BLINK_CODE(.type = blink_1HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_info_missed_call(struct led *led) { int info = event_get_value(switch_info); if (info != switch_info_to_tam_fax_missed_call && info != switch_info_to_missed_call) return BLINK_CODE_SKIP; if (event_get_value(fon_info_missed_call) == fon_info_missed_call_set) return BLINK_CODE(.type = blink_1HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_info_voip_freecall(struct led *led) { // For some reason this should be always signaled if (event_get_value(voip_info_freecall) == voip_info_freecall_start) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_dect_stick_and_surf(struct led *led) { // the DECT-Led should not light up when the user has // pressed the Connect-button // if the user pressed the DECT-button it should flash // if the user started dect-stick&surf on the webgui the led // should also flash if (skip_on_connect_events(led)) return BLINK_CODE_SKIP; switch (event_get_value(dect_stick_and_surf)) { case dect_stick_and_surf_start: return BLINK_CODE(.type = blink_2HZ); case dect_stick_and_surf_error: return BLINK_CODE(.type = blink_4HZ); case dect_stick_and_surf_success: return BLINK_CODE(.type = blink_on); default: return BLINK_CODE_SKIP; } } static struct blink_code overlay_usb_host_stick_and_surf(struct led *led) { switch (event_get_value(usb_host_stick_and_surf)) { case usb_host_stick_and_surf_start: return BLINK_CODE(.type = blink_2HZ); case usb_host_stick_and_surf_error: return BLINK_CODE(.type = blink_4HZ); case usb_host_stick_and_surf_success: return BLINK_CODE(.type = blink_on); default: return BLINK_CODE_SKIP; } } static struct blink_code overlay_info_voip_srtp(struct led *led) { if (event_get_value(switch_info) != switch_info_to_voip_srtp) return BLINK_CODE_SKIP; if (event_get_value(voip_srtp) == voip_srtp_active) return BLINK_CODE(.type = blink_2HZ); else return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_info_dect(struct led *led) { if (event_get_value(switch_info) != switch_info_to_dect) return BLINK_CODE_SKIP; if (event_get_value(dect) == dect_aktiv) return BLINK_CODE(.type = blink_on); else return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_info_budget(struct led *led) { if (event_get_value(switch_info) != switch_info_to_budget) return BLINK_CODE_SKIP; if (event_get_value(budget) == budget_reached) return BLINK_CODE(.type = blink_2HZ_double); else return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_info_lan(struct led *led) { if (event_get_value(switch_info) != switch_info_to_lan) return BLINK_CODE_SKIP; return overlay_lan(led); } static struct blink_code overlay_info_pppoe(struct led *led) { if (event_get_value(switch_info) != switch_info_to_online) return BLINK_CODE_SKIP; if (event_get_value(pppoe) == pppoe_on) return BLINK_CODE(.type = blink_on); else return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_info_wlan(struct led *led) { if (event_get_value(switch_info) != switch_info_to_wlan_active) return BLINK_CODE_SKIP; if (event_get_value(wlan) == wlan_on) return BLINK_CODE(.type = blink_on); else return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_info_wlan_guest(struct led *led) { if (event_get_value(switch_info) != switch_info_to_wlan_guest_active) return BLINK_CODE_SKIP; if (event_get_value(wlan_guest) == wlan_guest_enabled) return BLINK_CODE(.type = blink_on); else return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_info_wlan_guest_device(struct led *led) { if (event_get_value(switch_info) != switch_info_to_wlan_guest_device) return BLINK_CODE_SKIP; if (event_get_value(wlan_guest_device) == wlan_guest_device_present) return BLINK_CODE(.type = blink_on); else return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_info_usb_host(struct led *led) { if (event_get_value(switch_info) != switch_info_to_usb_host) return BLINK_CODE_SKIP; switch (event_get_value(usb_host)) { case usb_host_connected: return BLINK_CODE(.type = blink_on); case usb_host_error: return BLINK_CODE(.type = blink_4HZ); default: return BLINK_CODE(.type = blink_off); } } static struct blink_code overlay_info_usb_client(struct led *led) { if (event_get_value(switch_info) != switch_info_to_usb_client) return BLINK_CODE_SKIP; switch (event_get_value(usb_client)) { case usb_client_connected: return BLINK_CODE(.type = blink_on); case usb_client_error: return BLINK_CODE(.type = blink_4HZ); default: return BLINK_CODE(.type = blink_off); } } static struct blink_code overlay_wlan_macfilter_max(struct led *led) { if (event_get_value(wlan_macfilter_max) != wlan_macfilter_max_reached) return BLINK_CODE_SKIP; return BLINK_CODE(.type = blink_2HZ_double); } static struct blink_code overlay_plc(struct led *led) { if (event_get_value(plc) == plc_on) return BLINK_CODE(.type = blink_on); if (event_get_value(plc) == plc_low_phyrate) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_power_pppoe(struct led *led) { if (event_get_value(pppoe) == pppoe_on) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_two_factor(struct led *led) { if (event_get_value(two_factor) == two_factor_start) return BLINK_CODE(.type = blink_0_5HZ); if (event_get_value(two_factor) == two_factor_success) return BLINK_CODE(.type = blink_2HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_voice_internet(struct led *led) { if (event_get_value(internet) == internet_aufgebaut) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_voice_festnetz(struct led *led) { if (event_get_value(festnetz) == festnetz_aufgebaut) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_voice_ab(struct led *led) { if (event_get_value(ab) != 0) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_voice_mwi(struct led *led) { if (event_get_value(voip_mwi) == voip_mwi_speech_msg) return BLINK_CODE(.type = blink_2HZ); return BLINK_CODE_SKIP; } static struct blink_code overlay_dect_aktiv(struct led *led) { if (event_get_value(dect) == dect_aktiv) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_zigbee_on(struct led *led) { if (event_get_value(zigbee) == zigbee_aktiv) return BLINK_CODE(.type = blink_on); return BLINK_CODE_SKIP; } static struct blink_code overlay_vu(struct led *led) { int level = event_get_value(vu_level); bool dim = leds_all_dimmable(); int steps_per_led; int step_min, step_max, step; // This led has no physical location if (led->options.location == 0) return BLINK_CODE_SKIP; if (level < 100 || level > 200) return BLINK_CODE_SKIP; // Can not a vu without leds if (leds_max_location() == 0) return BLINK_CODE_SKIP; if (event_get_value(lte_map_mode) == lte_map_mode_rssi) return BLINK_CODE_SKIP; /* * Depending if all leds are dimmable we will use either 5 dim steps * per led or use 2 steps where the middle step is blinking. */ if (dim) steps_per_led = 5; else steps_per_led = 2; // Move range to 0-100 level -= 100; // Scale 0-200 onto 0- step = level * leds_max_location() * steps_per_led / 100; // Calculate the min step we respond on step_min = (led->options.location - 1) * steps_per_led + 1; // Calculate the max step we will be full on step_max = led->options.location * steps_per_led; if (step >= step_max) return BLINK_CODE(.type = blink_on); else if (dim && step >= step_min) { struct blink_code code = BLINK_CODE(.type = blink_on); code.color.brightness = (step - step_min + 1) * 255 / steps_per_led; return code; } else if (!dim && step >= step_min) return BLINK_CODE(.type = blink_4HZ); else return BLINK_CODE(.type = blink_off); } static struct blink_code overlay_vu_rssi(struct led *led) { int level = event_get_value(vu_level); int steps_per_led; int step_min, step_max, step; int led_count; if (led->options.location == 3) return BLINK_CODE_SKIP; if (level < 100 || level > 200) return BLINK_CODE_SKIP; // Can not a vu without leds if (leds_max_location() == 0) return BLINK_CODE_SKIP; led_count = leds_max_location(); steps_per_led = 2; // Move range to 0-100 level -= 100; // Scale 0-200 onto 0- step = level * led_count * steps_per_led / 100; // Calculate the min step we respond on step_min = (led->options.location - 1) * steps_per_led + 1; // Calculate the max step we will be full on step_max = led->options.location * steps_per_led; if (step >= step_max || step >= step_min) return BLINK_CODE(.type = blink_on); else return BLINK_CODE(.type = blink_off); return BLINK_CODE_SKIP; } static struct blink_code overlay_fb6820_vu_rssi(struct led *led) { int level = event_get_value(vu_level); int steps_per_led; int step_min, step_max, step; int led_count; if (led->options.location < 3) return BLINK_CODE_SKIP; if (level < 100 || level > 200) return BLINK_CODE_SKIP; // Can not a vu without leds if (leds_max_location() == 0) return BLINK_CODE_SKIP; led_count = leds_max_location() - 2; steps_per_led = 2; // Move range to 0-100 level -= 100; // Scale 0-200 onto 0- step = level * led_count * steps_per_led / 100; // Calculate the min step we respond on step_min = (led->options.location - 3) * steps_per_led + 1; // Calculate the max step we will be full on step_max = (led->options.location - 2) * steps_per_led; if (step >= step_max || step >= step_min) return BLINK_CODE(.type = blink_on); else return BLINK_CODE(.type = blink_off); return BLINK_CODE_SKIP; } static struct blink_code overlay_fb6820_update(struct led *led) { /* take care on led location==3 only */ if (led->options.location != 3) return BLINK_CODE_SKIP; if (event_get_value(update) == update_running) { return BLINK_CODE(.type = blink_2HZ); } return BLINK_CODE_SKIP; } struct led_type led_types[] = { { .name = "repeater-all-in-one", .options = { .connect_methods = CONNECT_METHODE_ALL, .flags = LED_FLAG_BARE_UPDATE, }, .overlays = OVERLAYS( OVERLAY(set_current_color_error), OVERLAY(overlay_hardware_error), OVERLAY(set_current_color_normal), OVERLAY(overlay_update), OVERLAY(overlay_two_factor), OVERLAY(overlay_display_suspend), OVERLAY(overlay_bootup), OVERLAY(overlay_nexus_not_ready), OVERLAY(overlay_factory_defaults), OVERLAY(overlay_connect), OVERLAY(set_current_color_error), OVERLAY(overlay_connect_error), OVERLAY(overlay_wps_error), OVERLAY(overlay_wlan_error), OVERLAY(set_current_color_warn), OVERLAY(overlay_lan_bridge_no_cable), OVERLAY(overlay_wlan_bridge_no_uplink), OVERLAY(overlay_wlan_uplink_le_2), OVERLAY(set_current_color_normal), OVERLAY(overlay_wps), OVERLAY(overlay_lan_bridge), OVERLAY(overlay_disable_no_wlan), OVERLAY(overlay_wlan_repeater), OVERLAY(overlay_wlan_uplink_ge_2), OVERLAY(default_2hz), ), }, { // found on FR2400 and also on FP1260 .name = "repeater-one-no-rssi", .options = { .connect_methods = CONNECT_METHODE_ALL, .flags = LED_FLAG_BARE_UPDATE, }, .overlays = OVERLAYS( OVERLAY(set_current_color_error), OVERLAY(overlay_hardware_error), OVERLAY(set_current_color_normal), OVERLAY(overlay_update), OVERLAY(overlay_two_factor), OVERLAY(overlay_display_suspend), OVERLAY(overlay_bootup), OVERLAY(overlay_nexus_not_ready), OVERLAY(overlay_factory_defaults), OVERLAY(overlay_connect), OVERLAY(set_current_color_error), OVERLAY(overlay_connect_error), OVERLAY(overlay_wps_error), OVERLAY(overlay_wlan_error), OVERLAY(set_current_color_warn), OVERLAY(overlay_lan_bridge_no_cable), OVERLAY(overlay_wlan_bridge_no_uplink), OVERLAY(overlay_plc_low_phyrate), OVERLAY(set_current_color_normal), OVERLAY(overlay_wps), OVERLAY(overlay_lan_bridge), OVERLAY(overlay_plc_bridge), OVERLAY(overlay_disable_no_wlan), OVERLAY(overlay_wlan_repeater), OVERLAY(overlay_wlan_on), OVERLAY(default_2hz), ), }, { /* * Copy for fr3000 only which has no orange on this led and therefore * for odd reasons require the orange part for missing wlan to be shown * on the rssi led. * * Oh man! */ .name = "repeater-one-fr3000", .options = { .connect_methods = CONNECT_METHODE_ALL, .flags = LED_FLAG_BARE_UPDATE, }, .overlays = OVERLAYS( OVERLAY(set_current_color_error), OVERLAY(overlay_hardware_error), OVERLAY(set_current_color_normal), OVERLAY(overlay_update), OVERLAY(overlay_two_factor), OVERLAY(overlay_display_suspend), OVERLAY(overlay_bootup), OVERLAY(overlay_nexus_not_ready), OVERLAY(overlay_factory_defaults), OVERLAY(overlay_connect), OVERLAY(set_current_color_error), OVERLAY(overlay_connect_error), OVERLAY(overlay_wps_error), OVERLAY(overlay_wlan_error), OVERLAY(set_current_color_warn), OVERLAY(overlay_lan_bridge_no_cable), OVERLAY(set_current_color_normal), OVERLAY(overlay_wps), OVERLAY(overlay_lan_bridge), OVERLAY(overlay_disable_no_wlan), OVERLAY(overlay_wlan_repeater), OVERLAY(default_on), ), }, { .name = "repeater-rssi-color", .overlays = OVERLAYS( OVERLAY(overlay_two_factor), OVERLAY(overlay_display_suspend), OVERLAY(overlay_disable_no_wlan), OVERLAY(overlay_nexus_not_ready_off), OVERLAY(set_current_color_warn), OVERLAY(overlay_wlan_uplink_le_2), OVERLAY(overlay_wlan_bridge_no_uplink), OVERLAY(overlay_disable_wlan_failed), OVERLAY(set_current_color_normal), OVERLAY(overlay_lan_bridge), OVERLAY(overlay_wlan_uplink_ge_2), OVERLAY(default_off), ), }, { // found on FR1750e .name = "repeater-power", .options = { .flags = LED_FLAG_BARE_UPDATE, }, .overlays = OVERLAYS( OVERLAY(overlay_update), OVERLAY(overlay_two_factor), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_bootup_slow), OVERLAY(overlay_power_state), OVERLAY(default_on), ), }, { .name = "lan", .overlays = OVERLAYS( OVERLAY(overlay_two_factor), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_lan), OVERLAY(default_off), ), }, { // found on FR1750e .name = "repeater-wlan", .options = { .connect_methods = CONNECT_METHODE_ALL, }, .overlays = OVERLAYS( OVERLAY(overlay_two_factor), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_nexus_not_ready), OVERLAY(overlay_connect), OVERLAY(overlay_wps_error), OVERLAY(overlay_wps), OVERLAY(overlay_wlan), OVERLAY(default_off), ), }, { // found on FP1260 .name = "repeater-plc-wlan", .options = { .connect_methods = CONNECT_METHODE(4), }, .overlays = OVERLAYS( OVERLAY(overlay_update_off), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_nexus_not_ready_off), OVERLAY(overlay_connect), OVERLAY(overlay_wlan_on), OVERLAY(default_off), ), }, { .name = "repeater-plc", .options = { .flags = LED_FLAG_BARE_UPDATE, }, .overlays = OVERLAYS( OVERLAY(overlay_update_off), OVERLAY(overlay_two_factor), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_plc), OVERLAY(default_off), ), }, { .name = "box-power", .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_gsm_error), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(overlay_ignore_display_suspend_on_wan_disconnect), OVERLAY(overlay_display_suspend), OVERLAY(overlay_power_state), OVERLAY(overlay_gsm), OVERLAY(overlay_wds_repeater), OVERLAY(overlay_power_pppoe), OVERLAY(overlay_ata_mode), OVERLAY(overlay_uplink_connecting), OVERLAY(overlay_uplink_verbunden), OVERLAY(default_0_5hz), ), }, { // used by FB7583 .name = "box-internet", .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_power_pppoe), OVERLAY(default_off), ), }, { // LED is blinking on connect-events .name = "box-wlan-connect", .options = { .connect_methods = CONNECT_METHODE_ALL, }, .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_connect), OVERLAY(overlay_connect_error), OVERLAY(overlay_wps_error), OVERLAY(overlay_wps), OVERLAY(overlay_wlan), OVERLAY(default_off), ), }, { // LED is NOT blinking on connect-events .name = "box-wlan", .options = { .connect_methods = CONNECT_METHODE(4), }, .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_connect), OVERLAY(overlay_wps_error), OVERLAY(overlay_wps), OVERLAY(overlay_wlan), OVERLAY(default_off), ), }, { // LED is blinking on connect-events .name = "box-fon-connect", .options = { .connect_methods = CONNECT_METHODE(1), }, .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_connect), OVERLAY(overlay_dect_stick_and_surf), OVERLAY(overlay_voice_internet), OVERLAY(overlay_voice_festnetz), OVERLAY(overlay_voice_ab), OVERLAY(overlay_voice_mwi), OVERLAY(default_off), ), }, { // LED must NOT blinking on all connect-events .name = "box-fon", .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_voice_internet), OVERLAY(overlay_voice_festnetz), OVERLAY(overlay_voice_ab), OVERLAY(overlay_voice_mwi), OVERLAY(default_off), ), }, { // LED is NOT blinking on connect-events .name = "box-fon-dect", .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_dect_stick_and_surf), OVERLAY(overlay_voice_internet), OVERLAY(overlay_voice_festnetz), OVERLAY(overlay_voice_ab), OVERLAY(overlay_voice_mwi), OVERLAY(default_off), ), }, { // LED is found on Cable-devices .name = "box-dect", .options = { .connect_methods = CONNECT_METHODE(1), }, .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_connect), OVERLAY(overlay_dect_stick_and_surf), OVERLAY(overlay_dect_aktiv), OVERLAY(default_off), ), }, { .name = "connect", .options = { .connect_methods = CONNECT_METHODE(1) | CONNECT_METHODE(2) | CONNECT_METHODE(5) | CONNECT_METHODE(6), }, .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_connect_error), OVERLAY(overlay_connect), OVERLAY(default_off), ), }, { // LED is blinking on connect-events .name = "info-connect", .options = { .connect_methods = CONNECT_METHODE(1), .flags = LED_FLAG_BARE_UPDATE, }, .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_update), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(set_current_color_error), OVERLAY(overlay_message_zentrale), OVERLAY(overlay_display_suspend), OVERLAY(overlay_info_filesystem), OVERLAY(set_current_color_normal), OVERLAY(overlay_usb_host_stick_and_surf), OVERLAY(overlay_info_voip_freecall), OVERLAY(overlay_dect_stick_and_surf), OVERLAY(overlay_wlan_macfilter_max), OVERLAY(overlay_connect), // The following overlays will only be active when they are enabled by // the switch_info call. OVERLAY(overlay_info_klingelsperre), OVERLAY(overlay_info_tam_mwi), OVERLAY(overlay_info_fax_mwi), OVERLAY(overlay_info_missed_call), OVERLAY(overlay_info_voip_srtp), OVERLAY(overlay_info_dect), OVERLAY(overlay_info_budget), OVERLAY(overlay_info_lan), OVERLAY(overlay_info_pppoe), OVERLAY(overlay_info_wlan), OVERLAY(overlay_info_wlan_guest), OVERLAY(overlay_info_wlan_guest_device), OVERLAY(overlay_info_usb_host), OVERLAY(overlay_info_usb_client), OVERLAY(default_off), ), }, { // LED is NOT blinking on connect-events .name = "info", .options = { .flags = LED_FLAG_BARE_UPDATE, }, .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_update), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(set_current_color_error), OVERLAY(overlay_message_zentrale), OVERLAY(overlay_display_suspend), OVERLAY(overlay_info_filesystem), OVERLAY(set_current_color_normal), OVERLAY(overlay_usb_host_stick_and_surf), OVERLAY(overlay_info_voip_freecall), OVERLAY(overlay_wlan_macfilter_max), // The following overlays will only be active when they are enabled by // the switch_info call. OVERLAY(overlay_info_klingelsperre), OVERLAY(overlay_info_tam_mwi), OVERLAY(overlay_info_fax_mwi), OVERLAY(overlay_info_missed_call), OVERLAY(overlay_info_voip_srtp), OVERLAY(overlay_info_dect), OVERLAY(overlay_info_budget), OVERLAY(overlay_info_lan), OVERLAY(overlay_info_pppoe), OVERLAY(overlay_info_wlan), OVERLAY(overlay_info_wlan_guest), OVERLAY(overlay_info_wlan_guest_device), OVERLAY(overlay_info_usb_host), OVERLAY(overlay_info_usb_client), OVERLAY(default_off), ), }, { // this INFO-LED should not flash on connect-events but // on dect_stick_and_surf events. this is used on boxes // without a FON/DECT LED to signal GUI related DECT events // this LED is found on a FB6690 and FB4060 .name = "info-dect", .options = { .flags = LED_FLAG_BARE_UPDATE, }, .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_update), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(set_current_color_error), OVERLAY(overlay_message_zentrale), OVERLAY(overlay_display_suspend), OVERLAY(overlay_info_filesystem), OVERLAY(set_current_color_normal), OVERLAY(overlay_dect_stick_and_surf), OVERLAY(overlay_usb_host_stick_and_surf), OVERLAY(overlay_info_voip_freecall), OVERLAY(overlay_wlan_macfilter_max), // The following overlays will only be active when they are enabled by // the switch_info call. OVERLAY(overlay_info_klingelsperre), OVERLAY(overlay_info_tam_mwi), OVERLAY(overlay_info_fax_mwi), OVERLAY(overlay_info_missed_call), OVERLAY(overlay_info_voip_srtp), OVERLAY(overlay_info_dect), OVERLAY(overlay_info_budget), OVERLAY(overlay_info_lan), OVERLAY(overlay_info_pppoe), OVERLAY(overlay_info_wlan), OVERLAY(overlay_info_wlan_guest), OVERLAY(overlay_info_wlan_guest_device), OVERLAY(overlay_info_usb_host), OVERLAY(overlay_info_usb_client), OVERLAY(default_off), ), }, { .name = "uplink-rssi", .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_nexus_not_ready_off), /* * When no ap is configured, always turn off. * * Otherwise if lan uplink is available -> full * Otherwise if wlan uplink -> show actual rssi */ OVERLAY(overlay_disable_no_wlan), OVERLAY(overlay_lan_bridge), OVERLAY(overlay_disable_wlan_failed), OVERLAY(overlay_wlan_rssi_bar_sta), OVERLAY(default_off), ), }, { .name = "wlan-rssi", .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_nexus_not_ready_off), OVERLAY(overlay_wlan_rssi_bar_client), OVERLAY(overlay_wlan_rssi_bar_sta), OVERLAY(default_off), ), }, { .name = "fsg-dect", .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_vu), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_dect_aktiv), OVERLAY(default_off), ), }, { // LED is NOT blinking on connect-events .name = "fsg-wlan", .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_wlan_bridge_mode), OVERLAY(default_off), ), }, { .name = "fsg-connect-rgy", .options = { .connect_methods = CONNECT_METHODE_ALL, .flags = LED_FLAG_BARE_UPDATE, }, .overlays = OVERLAYS( OVERLAY(set_current_color_error), OVERLAY(overlay_hardware_error), OVERLAY(set_current_color_normal), OVERLAY(overlay_update), OVERLAY(overlay_two_factor), OVERLAY(overlay_display_suspend), OVERLAY(overlay_bootup), OVERLAY(overlay_nexus_not_ready), OVERLAY(overlay_factory_defaults), OVERLAY(overlay_connect), OVERLAY(set_current_color_error), OVERLAY(overlay_connect_error), OVERLAY(overlay_wps_error), OVERLAY(overlay_wlan_error), OVERLAY(set_current_color_warn), OVERLAY(overlay_lan_bridge_no_cable), OVERLAY(overlay_wlan_bridge_no_uplink), OVERLAY(overlay_wlan_uplink_le_2), OVERLAY(set_current_color_normal), OVERLAY(overlay_wps), OVERLAY(overlay_lan_bridge), OVERLAY(overlay_wlan_uplink_ge_2), OVERLAY(default_0_5hz), ), }, { .name = "zigbee", .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_two_factor), OVERLAY(overlay_hardware_error), OVERLAY(overlay_display_suspend), OVERLAY(overlay_zigbee_on), OVERLAY(default_off), ), }, { .name = "default-on", .options = { 0 }, .overlays = OVERLAYS( OVERLAY(overlay_display_suspend), OVERLAY(default_on), ), }, { .name = "unknown", .options = { 0 }, .overlays = OVERLAYS( OVERLAY(default_4hz), ), }, { .name = "always-on", .options = { 0 }, .overlays = OVERLAYS( OVERLAY(default_on), ), }, { .name = "always-off", .options = { 0 }, .overlays = OVERLAYS( OVERLAY(default_off), ), }, { .name = "lte-rssi", .options = { 0 }, .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_hardware_error), OVERLAY(overlay_two_factor), OVERLAY(overlay_display_suspend), OVERLAY(overlay_vu_rssi), OVERLAY(default_off), ), }, { /* fb6820 */ .name = "lte-rssi_6820", .options = { 0 }, /*--- no need for any options ---*/ .overlays = OVERLAYS( OVERLAY(set_current_color_normal), OVERLAY(overlay_hardware_error), OVERLAY(overlay_two_factor), OVERLAY(overlay_fb6820_update), OVERLAY(overlay_vu), OVERLAY(overlay_display_suspend), OVERLAY(overlay_fb6820_vu_rssi), OVERLAY(default_off), ), } };