OPNsense Forum

English Forums => Development and Code Review => Topic started by: juliocbc on November 08, 2018, 03:16:10 am

Title: APU LEDs Plugin
Post by: juliocbc on November 08, 2018, 03:16:10 am
Hello!

I made a simple plugin to get APUs boxes more shiny!

https://github.com/cloudfence/dev-packages (plugin package)

https://github.com/cloudfence/apuled (plugin source code)

I've compiled the LED's module from this source code: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189772

I know that isn't a good idea to put a binary (compiled) in a plugin package, but I don't know exactly how put this module with the plugin yet... maybe build a custom port and put it as plugin dependence... Anyway ideas are very welcome!

This initial version is not very useful yet... but it's a begining!
Title: Re: APU LEDs Plugin
Post by: evbevz on November 08, 2018, 07:43:49 am
https://github.com/opnsense/core/issues/2114
https://github.com/opnsense/plugins/pull/920
Title: Re: APU LEDs Plugin
Post by: juliocbc on November 08, 2018, 10:49:46 am
Good to know!

Is there any plans to make a WebUI page?

Title: Re: APU LEDs Plugin
Post by: Ricardo on February 04, 2019, 11:48:45 am
I am also very interested, eagerly waiting for this feature to be shipped since 18.1.

Is there any description what is possible / what has been implemented as part of "APU LED" ?

LED sequence During startup phase / LED sequence normal working phase / LED sequence during shutdown phase? 
Title: Re: APU LEDs Plugin
Post by: franco on February 04, 2019, 11:51:43 am
The driver is there now by default and can be used, but the plugin path needs to be evaluated still... it's a bit heavy for my taste with a C++ daemon required.


Cheers,
Franco
Title: Re: APU LEDs Plugin
Post by: Ricardo on February 04, 2019, 12:40:11 pm
The driver is there now by default and can be used, but the plugin path needs to be evaluated still... it's a bit heavy for my taste with a C++ daemon required.


Cheers,
Franco

At least can it be tested via CLI, how?
Title: Re: APU LEDs Plugin
Post by: juliocbc on February 04, 2019, 05:14:53 pm
After the module loaded, you can run the echo command direct to the device:

https://www.freebsd.org/cgi/man.cgi?query=led&sektion=4

power on the first LED:

Code: [Select]
echo 1 > /dev/led/led1

power off :

Code: [Select]
echo 0 > /dev/led/led1
Title: Re: APU LEDs Plugin
Post by: franco on February 05, 2019, 09:43:36 am
The module is loaded via:

# kldload apuled

But I haven't used it yet so I cannot say.

Here's the daemon that was written by Smart Soft with a bit of documentation...

https://github.com/alexpro/apuledctld/tree/master/apuledctld
Title: Re: APU LEDs Plugin
Post by: juliocbc on February 05, 2019, 02:11:00 pm
@Franco

I tested today the APU's led module on OPNsense 19.1 and works fine!

Just to avoid to have a duplicate effort... the plan is to use the plugin from Smart Soft as the official plugin?

We're planning to make an updated version from our plugin to control the LEDs using just shell (not a binary version).

What you think about it?

Title: Re: APU LEDs Plugin
Post by: franco on February 05, 2019, 03:34:36 pm
I would prefer a script to keep it simple, yes.


Cheers,
Franco
Title: Re: APU LEDs Plugin
Post by: Ricardo on February 07, 2019, 07:53:04 pm
I would prefer a script to keep it simple, yes.


Cheers,
Franco

Some hints:
-  WAN UP/DOWN trigger LED-changes
- system load over x / load below y trigger LED-changes
- WAN interface traffic in the past minute above X bps / below Y bps trigger LED-changes (or define 10 ranges: 1) at max. 10% bandwidth utilization 1 blink/sec, 2) at max  20% bw util 2 blinks/sec, etc. and finally over 90% bw util, 9 blinks/sec)
- free disk space is low trigger LED-changes

My idea is to have the scripts selected from the above list, 1 script
assigned to each LED device, max of 3 scripts active at any time.
Title: Re: APU LEDs Plugin
Post by: fabian on February 07, 2019, 09:55:08 pm
@franco: this is a C daemon as it does not look like it is using any C++ features but needs to be compiled anyway.

The C code needs some improvements in my opinion anyway (for example bad variable naming practice).
Title: Re: APU LEDs Plugin
Post by: juliocbc on March 18, 2019, 07:14:35 pm
@franco

I finished the initial release.

https://github.com/cloudfence/dev-packages/blob/master/os-apuled-1.0.txz


Details and Readme:
https://github.com/cloudfence/apuled
Title: Re: APU LEDs Plugin
Post by: rcmcronny on March 18, 2019, 09:08:39 pm
sorry for my clueless, but how to try it on a normal OPNsense 19.1 ?

Ronny
Title: Re: APU LEDs Plugin
Post by: juliocbc on March 19, 2019, 07:26:36 pm
Hi Ronny, my bad!

The download and installation process, please see this video: https://youtu.be/OR6hg-WOTB0


Title: Re: APU LEDs Plugin
Post by: rcmcronny on March 19, 2019, 07:41:12 pm
So simple :) Thanks.

Works perfectly, reboot test, will be done with the next update :P

Ronny


The short text version is for version 1.0:

Install Package:
Code: [Select]
pkg add https://github.com/cloudfence/dev-packages/raw/master/os-apuled-1.0.txz
Then add the minute cron refresh for APULED, Apply and finish

Title: Re: APU LEDs Plugin
Post by: franco on March 20, 2019, 10:15:16 pm
Hey Julio,

Neat, do you want to do a PR against our plugins for inclusion? I'm sure there's a bit of work and discussion coming up but it's better than a compiled daemon so ideally we should go for merging this simple script instead. :)


Cheers,
Franco
Title: Re: APU LEDs Plugin
Post by: juliocbc on March 21, 2019, 11:21:09 am
Hi Franco!

Sure! Done!

https://github.com/opnsense/plugins/pull/1269

Cheers!
Title: Re: APU LEDs Plugin
Post by: Ricardo on July 13, 2019, 11:19:41 am
(Reminder for myself)
Title: Re: APU LEDs Plugin
Post by: KoS on April 05, 2020, 11:04:24 pm
Hi Franco

I assume the APULED plugin should show up on my OPNsense 20.1.3 plugin page as I can see it in the 20.1 repo (https://github.com/opnsense/plugins/tree/stable/20.1)? Or where can I see which are the "current" plugins available for 20.1.3 ?

Kind regards
 KoS
Title: Re: APU LEDs Plugin
Post by: franco on April 06, 2020, 12:29:28 pm
os-apuled is still in development mode due to missing community feedback.

# pkg install os-apuled-devel


Cheers,
Franco
Title: Re: APU LEDs Plugin
Post by: KoS on April 06, 2020, 02:29:22 pm
Thank you Franco. I'll try it.

Is there a way to see which of the plugins are in the normal repo and which are only available as dev?
I am new to OPNsense and haven't found it yet. e.g. something like http://packages.debian.org/).

How/where shall I provide feedback on the plugin? github? create a new issue on github?
Title: Re: APU LEDs Plugin
Post by: franco on April 06, 2020, 02:54:34 pm
Feedback anywhere is nice, just let us know you're using the plugin successfully and want to have it released. :)

I added the "(development only)" notes to https://github.com/opnsense/plugins#a-list-of-currently-available-plugins


Cheers,
Franco
Title: Re: APU LEDs Plugin
Post by: KoS on April 18, 2020, 05:55:12 pm
I am using the plugin successfully :-)

FYI, due to a change in the APU Bios I had to add the line
Code: [Select]
debug.acpi.avoid="\_SB_.PCI0.GPIO" to loader.conf to make the general APULED module work again.
(see https://github.com/opnsense/core/issues/2114#issuecomment-609365754 and https://github.com/pcengines/coreboot/issues/329#issuecomment-526217280)
-> It survived the OPNsense upgrade from 20.1.3 to 20.1.4

I want to do changes on the module, e.g. I would suggest to have the 1st LED always blinking to have "heartbeat", as I had in the past APU boards that freezed and if the LED is always on, you would not notice that the device got stuck. Should I "pre-discuss" it somewhere or just provide a pull-request in Github?
Title: Re: APU LEDs Plugin
Post by: juliocbc on April 29, 2020, 01:53:01 pm
Hi kos!

Thank you!

I think you can submit a PR on the Github: https://github.com/opnsense/plugins/pulls
Title: Re: APU LEDs Plugin
Post by: Ricardo on June 19, 2020, 01:34:25 pm
I am using the plugin successfully :-)

FYI, due to a change in the APU Bios I had to add the line
Code: [Select]
debug.acpi.avoid="\_SB_.PCI0.GPIO" to loader.conf to make the general APULED module work again.
(see https://github.com/opnsense/core/issues/2114#issuecomment-609365754 and https://github.com/pcengines/coreboot/issues/329#issuecomment-526217280)
-> It survived the OPNsense upgrade from 20.1.3 to 20.1.4

I want to do changes on the module, e.g. I would suggest to have the 1st LED always blinking to have "heartbeat", as I had in the past APU boards that freezed and if the LED is always on, you would not notice that the device got stuck. Should I "pre-discuss" it somewhere or just provide a pull-request in Github?

That is a long running story, unfortunately with no result. Somebody demoed a youtube video that it works under linux. But under Freebsd i think it was never done.
Title: Re: APU LEDs Plugin
Post by: guest30486 on September 27, 2021, 01:27:01 pm
Do LEDs work with the 21.7 version and apu4d4?
Title: Re: APU LEDs Plugin
Post by: senser on November 05, 2021, 06:41:43 pm
Works for me on OPNsense 21.7.4-amd64. But under plugins it sais the plugin is (misconfigured).
Title: Re: APU LEDs Plugin
Post by: firedog on March 03, 2023, 11:48:55 am
Hi,

sorry for chiming in,

I made a simple plugin to get APUs boxes more shiny!

I've compiled the LED's module from this source code: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=189772

I know that isn't a good idea to put a binary (compiled) in a plugin package, but I don't know exactly how put this module with the plugin yet... maybe build a custom port and put it as plugin dependence... Anyway ideas are very welcome!

did you succeed to compile that source code against freeBSD 14 current? If yes would you be so kind and make the binary available?

Thank you and have a nice day,
firedog
Title: Re: APU LEDs Plugin
Post by: franco on March 03, 2023, 11:55:30 am
It has been included in OPNsense for ages.


Cheers,
Franco
Title: Re: APU LEDs Plugin
Post by: firedog on March 03, 2023, 12:45:08 pm
It has been included in OPNsense for ages.


Cheers,
Franco
Oooh - sorry!

Thank you!