Configuring Advantech Software Defined Switch under FreeBSD and OPNsense

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

The Thomas-Krenn Universal Network Appliance FWA-1012VC-4CA1S allows you to control the software-defined switch located on the back of the device.

This can also be used to trigger operating states, services and alarms.

This article will show you how to control this switch in the OPNsense/FreeBSD environment.

ports of FWA-1012VC-4CA1S

System Setup

The following components were used to set up the test:

  • FWA-1012VC-4CA1S
  • OPNsense 24.7.10_2 FreeBSD 14.1-RELEASE-p6 stable/24.7 SMP amd64

Stop devd

Stop the dev daemon temporarily.

service devd stop

stop devd temporarily

Start devd in debug mode

Now start the devd daemon in debug mode.

devd -d -n

Identification of ACPI event

Press the button now. This is recognised via an ACPI event. The event can then be built on the code side from this.

acpi button event

Set up event control

The event control is now set up. Please use an editor of your choice to create the file /etc/devd/sd-button.conf:

notify 10 {
    match "system" "ACPI";
    match "subsystem" "Button";
    match "type" "\\_SB_.SLPB";
    action "/usr/local/bin/sd-button.sh";
};

Hint: Please note that to escape the backslash (\) correctly, it must be written twice (i.e. \\).

Determin Action

Now, the action will be determined. Please create the file /usr/local/bin/sd-button.sh:

#!/bin/sh
echo "SD Switch pressed!"
/sbin/shutdown -p now

Make file executable:

 chmod +x /usr/local/bin/sd-button.sh 

devd Restart

After the event has been entered, devd must be restarted:

$ service devd restart

Button Testing

When the button is pressed, the ACPI event can be processed. In this case: Shutdown of the system.


* Pressing the button will now trigger any action specified in the code shown above.


Author: Wilfried Seifert

Wilfried Seifert, working in the Systems Engineering department at Thomas-Krenn, is responsible for system/prototype development in his work area. LPIC 3 certified, deals with construction / programming of embedded / GPIO systems; in his spare time he likes to repair old home computers, attends Linux conferences or is on the road with his bike (MTB) for sporting compensation.


Related articles

Configuration of LES plus v4 RS485
Install SIM card in LES v3
Low Energy Server Details