Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PC Engines APU* LED support #2114

Closed
ktk opened this issue Jan 20, 2018 · 43 comments
Closed

PC Engines APU* LED support #2114

ktk opened this issue Jan 20, 2018 · 43 comments
Assignees
Labels
upstream Third party issue
Milestone

Comments

@ktk
Copy link

ktk commented Jan 20, 2018

Unless I missed something it looks like OPNsense does not include default support for onboard LEDs on PC Engines APU* boards.

It looks like there is a kernel module available for them called apuled. According to the FreeBSD issue it supports APU1, APU2 and APU3.

Would be great if this could be shipped/included in the default configuration for serial builds so one can enable it. On ALIX boards/pfsense a popular package was BlinkLED, which would probably easy to re-implement once I have the LEDs available.

Thanks for the awesome work!

@fichtner fichtner added the support Community support label Jan 20, 2018
@fichtner
Copy link
Member

Hi @ktk,

The led driver nodes should be there for your APU already...

# ls /dev/led/led*

And it is easy to operate via shell script:

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

Cheers,
Franco

@ktk
Copy link
Author

ktk commented Jan 20, 2018

@fichtner oh great didn't realize that thanks! Will update the posts in the forum accordingly. Also I will try to see if I can port BlinkLED! Will report here as well for reference.

@fichtner
Copy link
Member

Best way of integrating would be to rewrite the management parts in the MVC framework. That would automatically provide an API for future use... :)

https://docs.opnsense.org/development/examples/helloworld.html

@ktk
Copy link
Author

ktk commented Jan 20, 2018

@fichtner tnx will check that out!

@ktk
Copy link
Author

ktk commented Jan 20, 2018

@fichtner just checked on 17.7, I only see:

ls /dev/led/*
/dev/led/igb0   /dev/led/igb1   /dev/led/igb2

@fichtner
Copy link
Member

I don't think the drivers disappeared, but seeing igb* maybe the new APU leds are not found... I have to check on Monday on an old APU1 to see if they are available there, ok?

@ktk
Copy link
Author

ktk commented Jan 20, 2018

@fichtner sure thanks!

@fichtner
Copy link
Member

please ping me when I'm slacking off :)

@fabianfrz
Copy link
Member

Also having an APU1 board so I can check for /dev/led as well

@fabianfrz
Copy link
Member

fabianfrz commented Jan 20, 2018

there is no led on APU1d4 (release: OPNsense 17.7.12-amd64, FreeBSD 11.0-RELEASE-p17):

root@opn:~ # ls /dev/*
/dev/acpi       /dev/ctty       /dev/da0s1      /dev/geom.ctl   /dev/mem        /dev/random     /dev/ttyu0.init /dev/ufssuspend /dev/ugen6.2
/dev/apm        /dev/cuau0      /dev/da0s1a     /dev/hpet0      /dev/midistat   /dev/sndstat    /dev/ttyu0.lock /dev/ugen0.1    /dev/urandom
/dev/apmctl     /dev/cuau0.init /dev/da0s1b     /dev/io         /dev/netmap     /dev/speaker    /dev/ttyu1      /dev/ugen1.1    /dev/usbctl
/dev/audit      /dev/cuau0.lock /dev/devctl     /dev/kbd0       /dev/nfslock    /dev/stderr     /dev/ttyu1.init /dev/ugen2.1    /dev/xpt0
/dev/auditpipe  /dev/cuau1      /dev/devctl2    /dev/kbdmux0    /dev/null       /dev/stdin      /dev/ttyu1.lock /dev/ugen3.1    /dev/zero
/dev/bpf        /dev/cuau1.init /dev/devstat    /dev/klog       /dev/pass0      /dev/stdout     /dev/tun1       /dev/ugen4.1
/dev/bpf0       /dev/cuau1.lock /dev/fido       /dev/kmem       /dev/pci        /dev/sysmouse   /dev/tun2       /dev/ugen5.1
/dev/console    /dev/da0        /dev/full       /dev/mdctl      /dev/pf         /dev/ttyu0      /dev/tun3       /dev/ugen6.1

/dev/fd:
0       1       2

/dev/pts:
0

/dev/reroot:
reroot

/dev/usb:
0.1.0   0.1.1   1.1.0   1.1.1   2.1.0   2.1.1   3.1.0   3.1.1   4.1.0   4.1.1   5.1.0   5.1.1   6.1.0   6.1.1   6.2.0   6.2.1   6.2.2

@fichtner
Copy link
Member

Same issue here... so that is really an issue with all APUs.... I'll take a look at the apuled integration.

@fichtner fichtner self-assigned this Jan 26, 2018
@fichtner fichtner added feature Adding new functionality upstream Third party issue and removed support Community support labels Jan 26, 2018
@fichtner fichtner added this to the 18.7 milestone Jan 26, 2018
@fichtner fichtner removed this from the 18.7 milestone Feb 27, 2018
@fichtner fichtner removed the feature Adding new functionality label Jul 15, 2018
@fichtner fichtner added this to the 19.1 milestone Jul 15, 2018
@seamusdemora
Copy link

Here's what worked for me on the APU.2C2 via the serial port:

After login, go to the shell (8), then:

root@OPNsense:~ # ls /dev/led
igb0    igb1    igb2
root@OPNsense:~ # echo f3 > /dev/led/igb0 

blinks the LED for igb0. To turn it off:
echo 0 > /dev/led/igb0

@ktk
Copy link
Author

ktk commented Sep 7, 2018

@seamusdemora interesting, on what version are you?

@evbevz
Copy link
Member

evbevz commented Sep 7, 2018

Hi all, we have support for PC Engine APU leds and hidden front button control.
One patch to src, one additional port and one patch into core.
Configurable blinking schemes and ability to bind shell script to button action (we use it for reset config to factory defaults).
Alex can describe in details.

@alexpro
Copy link
Contributor

alexpro commented Sep 7, 2018

Patch to src:
It's a Larry's Baird driver for onboard LEDs and button, module name - apuled.ko
I got it here
Upon loading the driver creates four devices. Three led devices:
/dev/led/led1
/dev/led/led2
/dev/led/led3
One for the mode switch:
/dev/modesw

Additional port:
It's a very simple daemon which can light or quench LEDs. Also, it tracks onboard button state and can invoke action script when button pressed. LEDs can be light up by configurable schemes which can be switched.

Patch into core:
We created syshook for 'boot' runlevel which run above daemon when rc starts, before mounting filesystems rw. After rc runs, LEDs blinking according 'startup' scheme until rc finishes. Once OPNsense boot completed, blink scheme swithced to 'running'. When reboot initiated, scheme switches to 'running' again. When button pressed, blink scheme switched to scheme 'press'.

You can see how it really works on this video

@alexpro
Copy link
Contributor

alexpro commented Sep 7, 2018

And in addition about daemon:
If apuled.ko module doesn't loaded or if OPNsense running not on APU device, daemon exits immediately, so placing it in syshook doesn't make useless processes.

@seamusdemora
Copy link

@ktk: I was on 18.1 when I checked this; I've since upgraded to 18.7. Have not checked to see if it still works. I'm afraid I'm completely unclear what's going on with @alexpro's comment. I seem to recall I found this in an OpenBSD man page...

@alexpro
Copy link
Contributor

alexpro commented Sep 8, 2018

@seamusdemora I mean three green LEDs and small button on front of APU. You tried blink orange LED on RJ45 conneсtor.

@seamusdemora
Copy link

seamusdemora commented Sep 8, 2018

Ah! So sorry... my APU faces me connector-forward... I forget that there are actually LEDs on the other side :P

@evbevz
Copy link
Member

evbevz commented Sep 10, 2018

If our solution is suitable for opnsense mainstream, we can make pull-requests.

@ktk
Copy link
Author

ktk commented Sep 10, 2018

@evbevz video looks great to me. Not sure about how to proceed to get this into mainstream. @fichtner you might comment on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream Third party issue
Development

No branches or pull requests

10 participants