Git Product home page Git Product logo

Comments (8)

Vladimir-NTCT avatar Vladimir-NTCT commented on July 19, 2024

Most likely culprit is NOT onlp library but kernel module x86_64_accton_as7726_32x_leds

I tried to control Locator LED manually:

pwd

/sys/devices/platform/accton_as7726_32x_led/leds/accton_as7726_32x_led::loc

ls

brightness device max_brightness subsystem trigger uevent

ls -al

total 0
drwxr-xr-x 2 root root 0 Nov 28 18:53 .
drwxr-xr-x 7 root root 0 Nov 28 18:53 ..
-rw-r--r-- 1 root root 4096 Nov 28 21:28 brightness
lrwxrwxrwx 1 root root 0 Nov 28 20:24 device -> ../../../accton_as7726_32x_led
-r--r--r-- 1 root root 4096 Nov 28 20:24 max_brightness
lrwxrwxrwx 1 root root 0 Nov 28 18:53 subsystem -> ../../../../../class/leds
-rw-r--r-- 1 root root 4096 Nov 28 20:24 trigger
-rw-r--r-- 1 root root 4096 Nov 28 18:53 uevent

cat max_brightness

4

cat brightness

0

echo 4 > brightness

cat brightness

0

Writing 4 to file brightness does not have any effect. It is value is still 0 and physical LED on the chassis is OFF.

AS7712-32X has a different picture:

pwd

/sys/devices/platform/accton_as7712_32x_led/leds/accton_as7712_32x_led::loc

ls -al

total 0
drwxr-xr-x 2 root root 0 Nov 28 17:44 .
drwxr-xr-x 7 root root 0 Nov 28 17:44 ..
-rw-r--r-- 1 root root 4096 Nov 28 17:45 brightness
lrwxrwxrwx 1 root root 0 Nov 28 20:26 device -> ../../../accton_as7712_32x_led
-r--r--r-- 1 root root 4096 Nov 28 20:26 max_brightness
lrwxrwxrwx 1 root root 0 Nov 28 17:44 subsystem -> ../../../../../class/leds
-rw-r--r-- 1 root root 4096 Nov 28 20:26 trigger
-rw-r--r-- 1 root root 4096 Nov 28 17:44 uevent

cat max_brightness

4

cat brightness

0

echo 4 > brightness

cat brightness

4

cat brightness

4

Value 4 is held in a file and physical LED on a chassis is steady blue.

After

echo 0 > brightness

physiscal LED is OFF.

from opennetworklinux.

roylee123 avatar roylee123 commented on July 19, 2024

Hi,
For your case , LED 2 cid=83886082 caps=0x00001001 onlp_led_set on_off=1,

Use “onlp_led_mode_set(0x5000002, 12)” to turn LOC led amber.
Where, 12 means bit 12 of caps=0x00001001
Use “onlp_led_set(0x5000002, 0) ” or “onlp_led_mode_set(0x5000002, 0)” to turn it off.

Nothing changes on calling "onlp_led_set(0x5000002, 1)".

from opennetworklinux.

Vladimir-NTCT avatar Vladimir-NTCT commented on July 19, 2024

Use “onlp_led_mode_set(0x5000002, 12)” to turn LOC led amber.

It still does not work. onlp_led_mode_set() returns 0, but physical LED is not ON.
Call to onlp_led_info_get() returns status = 1, (LED present, but not ON)

Code:

// 1 - on, 0 - off
int COTS_onlp_Locator_LED_Ctl (int on_off)
{
int led, rc = 0;
onlp_oid_t cid;
onlp_led_info_t led_info;
onlp_led_mode_t set_mode = ONLP_LED_MODE_OFF;

debug_log (VXOS_TRACE_DEBUG, "START on_off=%d\n", on_off);
led = get_current_pdb()->onlp_loc_led;
if (led == 0)
{
	debug_log (VXOS_TRACE_ERROR, "LOCATOR LED is NOT defined in CDB\n");
	rc = -50;
} else
{
	cid = ONLP_LED_ID_CREATE(led);
	rc = onlp_led_info_get(cid, &led_info);
	debug_log (VXOS_TRACE_DEBUG, "LED %d cid=%d onlp_led_info_get rc=%d\n", led, cid, rc);
	debug_log (VXOS_TRACE_DEBUG, "LED %d cid=%d description='%s'\n", led, cid, led_info.hdr.description);
	debug_log (VXOS_TRACE_DEBUG, "LED %d cid=%d caps=%d 0x%08X\n", led, cid, led_info.caps, led_info.caps);
	debug_log (VXOS_TRACE_DEBUG, "LED %d cid=%d mode=%d\n", led, cid, led_info.mode);
	debug_log (VXOS_TRACE_DEBUG, "LED %d cid=%d status=%d\n", led, cid, led_info.status);

	if ((led_info.caps & ONLP_LED_CAPS_ON_OFF) == 0)
	{
		debug_log (VXOS_TRACE_ERROR, "LOCATOR LED does not have ON_OFF capacity\n");
		rc = -50;
	} else
	{
		if ((led_info.caps & COTS_LED_BLINKS) == 0)
		{
			get_current_pdb()->onlp_loc_led_cap_blinking = FALSE;
			if (on_off)
			{
				if ((led_info.caps & ONLP_LED_CAPS_RED) != 0)
					set_mode = ONLP_LED_MODE_RED;
				else if ((led_info.caps & ONLP_LED_CAPS_ORANGE) != 0)
					set_mode = ONLP_LED_MODE_ORANGE;
				else if ((led_info.caps & ONLP_LED_CAPS_YELLOW) != 0)
					set_mode = ONLP_LED_MODE_YELLOW;
				else if ((led_info.caps & ONLP_LED_CAPS_GREEN) != 0)
					set_mode = ONLP_LED_MODE_GREEN;
				else if ((led_info.caps & ONLP_LED_CAPS_BLUE) != 0)
					set_mode = ONLP_LED_MODE_BLUE;
				else if ((led_info.caps & ONLP_LED_CAPS_PURPLE) != 0)
					set_mode = ONLP_LED_MODE_PURPLE;
				else if ((led_info.caps & ONLP_LED_CAPS_AUTO) != 0)
					set_mode = ONLP_LED_MODE_AUTO;
			}
		} else
		{
			get_current_pdb()->onlp_loc_led_cap_blinking = TRUE;
			if (on_off)
			{
				if ((led_info.caps & ONLP_LED_CAPS_RED_BLINKING) != 0)
					set_mode = ONLP_LED_MODE_RED_BLINKING;
				else if ((led_info.caps & ONLP_LED_CAPS_ORANGE_BLINKING) != 0)
					set_mode = ONLP_LED_MODE_ORANGE_BLINKING;
				else if ((led_info.caps & ONLP_LED_CAPS_YELLOW_BLINKING) != 0)
					set_mode = ONLP_LED_MODE_YELLOW_BLINKING;
				else if ((led_info.caps & ONLP_LED_CAPS_GREEN_BLINKING) != 0)
					set_mode = ONLP_LED_MODE_GREEN_BLINKING;
				else if ((led_info.caps & ONLP_LED_CAPS_BLUE_BLINKING) != 0)
					set_mode = ONLP_LED_MODE_BLUE_BLINKING;
				else if ((led_info.caps & ONLP_LED_CAPS_PURPLE_BLINKING) != 0)
					set_mode = ONLP_LED_MODE_PURPLE_BLINKING;
				else if ((led_info.caps & ONLP_LED_CAPS_AUTO_BLINKING) != 0)
					set_mode = ONLP_LED_MODE_AUTO_BLINKING;

			}
		}
	}
	debug_log (VXOS_TRACE_DEBUG, "LED %d cid=%d caps=0x%08X on_off=%d set_mode=%d\n",
			   led, cid, led_info.caps, on_off, set_mode);
	rc = onlp_led_mode_set(cid, set_mode);
	debug_log (VXOS_TRACE_DEBUG, "LED %d cid=%d onlp_led_mode_set %d rc=%d\n",
			   led, cid, set_mode, rc);
	rc = onlp_led_info_get(cid, &led_info);
	debug_log (VXOS_TRACE_DEBUG, "LED %d cid=%d onlp_led_info_get rc=%d\n", led, cid, rc);
	debug_log (VXOS_TRACE_DEBUG, "LED %d cid=%d status=%d\n", led, cid, led_info.status);
}
debug_log (VXOS_TRACE_DEBUG, "DONE on_off=%d rc=%d\n", on_off, rc);
return (rc);

}

Trace on AS7726-32X:
COTS_onlp_Locator_LED_Ctl:242 START on_off=1
COTS_onlp_Locator_LED_Ctl:252 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:253 LED 2 cid=83886082 description='LED 2 (LOC LED)'
COTS_onlp_Locator_LED_Ctl:254 LED 2 cid=83886082 caps=262145 0x00040001
COTS_onlp_Locator_LED_Ctl:255 LED 2 cid=83886082 mode=0
COTS_onlp_Locator_LED_Ctl:256 LED 2 cid=83886082 status=1
OTS_onlp_Locator_LED_Ctl:313 LED 2 cid=83886082 caps=0x00040001 on_off=1 set_mode=18
COTS_onlp_Locator_LED_Ctl:316 LED 2 cid=83886082 onlp_led_mode_set 18 rc=0
COTS_onlp_Locator_LED_Ctl:318 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:319 LED 2 cid=83886082 status=1
COTS_onlp_Locator_LED_Ctl:321 DONE on_off=1 rc=0
COTS_onlp_Locator_LED_Ctl:242 START on_off=0
COTS_onlp_Locator_LED_Ctl:252 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:253 LED 2 cid=83886082 description='LED 2 (LOC LED)'
COTS_onlp_Locator_LED_Ctl:254 LED 2 cid=83886082 caps=262145 0x00040001
COTS_onlp_Locator_LED_Ctl:255 LED 2 cid=83886082 mode=0
COTS_onlp_Locator_LED_Ctl:256 LED 2 cid=83886082 status=1
COTS_onlp_Locator_LED_Ctl:313 LED 2 cid=83886082 caps=0x00040001 on_off=0 set_mode=0
COTS_onlp_Locator_LED_Ctl:316 LED 2 cid=83886082 onlp_led_mode_set 0 rc=0
COTS_onlp_Locator_LED_Ctl:318 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:319 LED 2 cid=83886082 status=1
COTS_onlp_Locator_LED_Ctl:321 DONE on_off=0 rc=0

Trace on AS7326-56X:

COTS_onlp_Locator_LED_Ctl:242 START on_off=1
COTS_onlp_Locator_LED_Ctl:252 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:253 LED 2 cid=83886082 description='Chassis LED 2 (LOC LED)'
COTS_onlp_Locator_LED_Ctl:254 LED 2 cid=83886082 caps=4097 0x00001001
COTS_onlp_Locator_LED_Ctl:255 LED 2 cid=83886082 mode=0
COTS_onlp_Locator_LED_Ctl:256 LED 2 cid=83886082 status=1
COTS_onlp_Locator_LED_Ctl:313 LED 2 cid=83886082 caps=0x00001001 on_off=1 set_mode=12
COTS_onlp_Locator_LED_Ctl:316 LED 2 cid=83886082 onlp_led_mode_set 12 rc=0
COTS_onlp_Locator_LED_Ctl:318 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:319 LED 2 cid=83886082 status=1
COTS_onlp_Locator_LED_Ctl:321 DONE on_off=1 rc=0
COTS_onlp_Locator_LED_Ctl:242 START on_off=0
COTS_onlp_Locator_LED_Ctl:252 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:253 LED 2 cid=83886082 description='Chassis LED 2 (LOC LED)'
COTS_onlp_Locator_LED_Ctl:254 LED 2 cid=83886082 caps=4097 0x00001001
COTS_onlp_Locator_LED_Ctl:255 LED 2 cid=83886082 mode=0
COTS_onlp_Locator_LED_Ctl:256 LED 2 cid=83886082 status=1
COTS_onlp_Locator_LED_Ctl:313 LED 2 cid=83886082 caps=0x00001001 on_off=0 set_mode=0
COTS_onlp_Locator_LED_Ctl:316 LED 2 cid=83886082 onlp_led_mode_set 0 rc=0
COTS_onlp_Locator_LED_Ctl:318 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:319 LED 2 cid=83886082 status=1
COTS_onlp_Locator_LED_Ctl:321 DONE on_off=0 rc=0

Both platforms have LED status 1 (present and off) all the time.

Trace on AS7712-32X where it works:

COTS_onlp_Locator_LED_Ctl:242 START on_off=1
COTS_onlp_Locator_LED_Ctl:252 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:253 LED 2 cid=83886082 description='Chassis LED 2 (LOC LED)'
COTS_onlp_Locator_LED_Ctl:254 LED 2 cid=83886082 caps=262145 0x00040001
COTS_onlp_Locator_LED_Ctl:255 LED 2 cid=83886082 mode=0
COTS_onlp_Locator_LED_Ctl:256 LED 2 cid=83886082 status=1
COTS_onlp_Locator_LED_Ctl:285 LED 2 cid=83886082 caps=0x00040001 on_off=1 set_mode=18
COTS_onlp_Locator_LED_Ctl:288 LED 2 cid=83886082 onlp_led_mode_set 18 rc=0
COTS_onlp_Locator_LED_Ctl:325 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:326 LED 2 cid=83886082 status=5
COTS_onlp_Locator_LED_Ctl:328 DONE on_off=1 rc=0
COTS_onlp_Locator_LED_Ctl:242 START on_off=0
COTS_onlp_Locator_LED_Ctl:252 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:253 LED 2 cid=83886082 description='Chassis LED 2 (LOC LED)'
COTS_onlp_Locator_LED_Ctl:254 LED 2 cid=83886082 caps=262145 0x00040001
COTS_onlp_Locator_LED_Ctl:255 LED 2 cid=83886082 mode=18
COTS_onlp_Locator_LED_Ctl:256 LED 2 cid=83886082 status=5
COTS_onlp_Locator_LED_Ctl:285 LED 2 cid=83886082 caps=0x00040001 on_off=0 set_mode=0
COTS_onlp_Locator_LED_Ctl:288 LED 2 cid=83886082 onlp_led_mode_set 0 rc=0
COTS_onlp_Locator_LED_Ctl:325 LED 2 cid=83886082 onlp_led_info_get rc=0
COTS_onlp_Locator_LED_Ctl:326 LED 2 cid=83886082 status=1
COTS_onlp_Locator_LED_Ctl:328 DONE on_off=0 rc=0

Please note status is changing to 5 (present and ON).

from opennetworklinux.

roylee123 avatar roylee123 commented on July 19, 2024

Hi,
There are some flaws at x86-64-accton-as7326-56x-leds module.
I'll update it and sent PR for it.

from opennetworklinux.

Vladimir-NTCT avatar Vladimir-NTCT commented on July 19, 2024

There are some flaws at x86-64-accton-as7326-56x-leds module.
I'll update it and sent PR for it.

Great!
Please also look at x86_64_accton_as7726_32x_leds as well. WE have same problem with locator LED on this platform.

from opennetworklinux.

roylee123 avatar roylee123 commented on July 19, 2024

Hi,
I've sent a PR for as7326-56x, #499.
My colleague, @jostar-yang, will fix same problem on as7726_32x.

from opennetworklinux.

jostar-yang avatar jostar-yang commented on July 19, 2024

For as7726-32x_led, please check #495. I has fixed led-loc and send PR.

from opennetworklinux.

Vladimir-NTCT avatar Vladimir-NTCT commented on July 19, 2024

With new x86-64-accton-as7326-56x-leds problem is resolved. Physical LED works.

from opennetworklinux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.