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

openvfd LED display driver #143

Closed
danboid opened this issue Mar 9, 2022 · 49 comments
Closed

openvfd LED display driver #143

danboid opened this issue Mar 9, 2022 · 49 comments
Labels
documentation Improvements or additions to documentation essence Recommended essence posts support This need is supported

Comments

@danboid
Copy link
Contributor

danboid commented Mar 9, 2022

I have successfully installed your fork of Armbian on my X96 Air (using the X96 Max+ dtb) but I would like the clock to be working and it doesn't look like you currently include openvfd, which would be useful for those with LED displays like me.

https://github.com/arthur-liberman/linux_openvfd

I use another fork of Armbian for my TX6 TV boxes and that has already integrated openvfd so you could borrow the openvfd patches from that, if you agree to adding openvfd support:

https://github.com/awawa-dev/build

Keep up the great work!

Thanks

@ophub
Copy link
Owner

ophub commented Mar 9, 2022

Thank you very much for your sharing, can you introduce the usage method and applicable kernel, equipment and other information?

Which dtb file did you use, need to add anything inside the dtb?

@danboid
Copy link
Contributor Author

danboid commented Mar 9, 2022

I have tested openvfd under both Linux 5.10 and 5.15 on my Tanix-TX6.

Under Awawa's armbian fork, all the user has to do is start the openvfd service and that enables the LED clock display but his fork is only targetting one TV box SoC and not several like yours so there is no need to edit the dtb but some users may need to change the openvfd config if it doesn't work with the default config. This repo has config files for different LED displays:

https://github.com/arthur-liberman/vfd-configurations

I would just grep awawas repo for openvfd to see how he patched it into his repo. Here's how he added it to the dts:

https://github.com/awawa-dev/build/blob/tanix/patch/kernel/station-edge/3-0021-arm64-dts-allwinner-h6-fix-emmc-led.patch

openvfd {
		compatible = "open,vfd";
		dev_name = "openvfd";            
		status = "okay";
	};

@dinhchinh82
Copy link

@danboid thank you for your great idea. I'm also interested in this feature. Hope our hero @ophub will make it available soon :)

@ophub
Copy link
Owner

ophub commented Mar 9, 2022

Tested by flippy teacher, this method cannot be used.
He offers two case:

https://patchwork.kernel.org/project/linux-amlogic/patch/98b09fc5-5de7-ab71-cbfc-843f1c83239b@gmail.com/

chewitt/linux@253cf40

Can you provide a more detailed integration instructions? Need a complete code, including the core layer and the application layer.

@ophub
Copy link
Owner

ophub commented Mar 10, 2022

2022-03-10 09 02 21

The driver compiles successfully, but fails to load, how to call it? Is there a config file? Or call a method? The one in the dtb you posted above cannot be used.

@danboid
Copy link
Contributor Author

danboid commented Mar 10, 2022

Thanks for trying to get this working ophub, I know its not easy.

Both CoreELEC and awawa's Armbian fork use a systemd service to start openvfd but thats not included in the main repo, as you've noticed. I'm sure you could borrow the service code from either of those projects but its also got its own repo here:

https://github.com/arthur-liberman/service.openvfd

There are some general (but maybe outdated) docs for openvfd here:

https://github.com/LibreELEC/linux_openvfd

I would also refer you to the last comment on this page, , where a gh user describes how they got openvfd working for their X96 Max+:

arthur-liberman/linux_openvfd#8

@ophub
Copy link
Owner

ophub commented Mar 10, 2022

flippy has been added. you try. The kernel has been added and can be successfully compiled, as you said, maybe the config needs further debugging.

unifreq/linux-5.15.y@4053bad

unifreq/linux-5.4.y@b1d6b05

unifreq/linux-5.10.y@e48a78d

unifreq/linux-5.16.y@d12b7c0

Light up hope, light up the future.

@EastWoodYang
Copy link

x96 max+

1646961756(1)

is that problem ?

@danboid
Copy link
Contributor Author

danboid commented Mar 11, 2022

This is totally unrelated to openvfd @EastWoodYang

If you are having problems with lightdm you can install lxdm instead.

@dinhchinh82
Copy link

flippy has been added. you try. The kernel has been added and can be successfully compiled, as you said, maybe the config needs further debugging.

unifreq/linux-5.15.y@4053bad

unifreq/linux-5.4.y@b1d6b05

unifreq/linux-5.10.y@e48a78d

unifreq/linux-5.16.y@d12b7c0

Light up hope, light up the future.

@ophub To try this one, just run armbian-update to update the latest kernel version, right?

@ophub
Copy link
Owner

ophub commented Mar 12, 2022

Although it is included in the kernel, the control method has not yet been found, and the flippy boss is constantly debugging

@dinhchinh82
Copy link

Ready to update, please wait...
current version: 5.4.182, Latest version: 5.4.184
Kernel version: 5.4.184
Start downloading kernel to [ /root ]...
01.01 The boot file download complete.
01.02 The dtb file download complete.
01.03 The modules file download complete.
01.04 The header file download complete.
custom_kernel_name: 5.4.184-flippy-70+o
Unpack [ 5.4.184-flippy-70+o ] related files ...
02.01 Unpack [ boot-5.4.184-flippy-70+o.tar.gz ] complete.
02.02 Unpack [ dtb-amlogic-5.4.184-flippy-70+o.tar.gz ] complete.
02.03 Unpack [ modules-5.4.184-flippy-70+o.tar.gz ] complete.
02.04 Unpack [ header-5.4.184-flippy-70+o.tar.gz ] complete.
Successfully updated, automatic restarting...
Connection to 192.168.100.55 closed by remote host.
Connection to 192.168.100.55 closed.

I just updated to kernel 5.4.184 and reboot but there is no any clock or LED.

Beside that, if flippy could support the API/command to customize the LED (for example, show the wifi signal, kernel version et..), that's much great.

@ophub
Copy link
Owner

ophub commented Mar 12, 2022

Debugging, it will take some time

@ophub ophub closed this as completed Mar 12, 2022
@ophub
Copy link
Owner

ophub commented Mar 13, 2022

photo_2022-03-13_22-16-41

After the efforts of flippy, now x96, h96, hk1, tx3 can use the screen.

Later he will post how to use it

@danboid
Copy link
Contributor Author

danboid commented Mar 17, 2022

Are you going to update the README with instructions on how to use openvfd?

@ophub
Copy link
Owner

ophub commented Mar 18, 2022

@danboid @dinhchinh82

According to the script and instructions released by flippy, I added it to armbian, welcome to test feedback and share more configuration.

README:
https://github.com/ophub/amlogic-s9xxx-armbian/blob/main/build-armbian/armbian-docs/led_screen_display_control.md

Command:
https://github.com/ophub/amlogic-s9xxx-armbian/blob/main/build-armbian/common-files/files/usr/sbin/armbian-led

Conf files:
https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/build-armbian/common-files/files/usr/share/openvfd

Your share has been recorded in the contributor list:
https://github.com/ophub/amlogic-s9xxx-armbian/blob/main/CONTRIBUTOR.md

@danboid
Copy link
Contributor Author

danboid commented Mar 18, 2022

Great work @ophub ! I will test soon. Thanks!

@danboid
Copy link
Contributor Author

danboid commented Mar 21, 2022

On

https://github.com/ophub/amlogic-s9xxx-armbian/blob/main/build-armbian/armbian-docs/led_screen_display_control.md

It mentions /usr/sbin/armbian-led and /usr/share/openvfd/vfdservice /usr/sbin/*-led but none of these files are present on my system. Because one of these files is armbian-led then I presume there is a package I need to install first? I have done an armbian-updateandapt get upgrade` just now.

@ophub
Copy link
Owner

ophub commented Mar 21, 2022

This file was not included in the system before the release of this function.
There is a link in the description, click to download and upload to a fixed directory.

@ophub ophub added the support This need is supported label Mar 29, 2022
@833M0L3
Copy link

833M0L3 commented Apr 2, 2022

Hello, So I recently installed the latest build of the armbian with the latest kernel that is available here on my HK1 S905x3 box. Everything is working great. These Tv Boxes bring Raspberry Pi devices to shame.

Now the main issue I am having is with the VFD. I tried the armbian-led with correct config selected and LED Panel lids off with time and alarm, USB, play and pause indicator, but I am not getting WiFi and LAN indicator , which it should do. Is there anything missing in the current config file that is causing this? Because in here arthur-liberman/linux_openvfd#12 (comment) , WiFi and LAN indicator is showing.

@ophub
Copy link
Owner

ophub commented Apr 2, 2022

@833M0L3
Copy link

833M0L3 commented Apr 2, 2022

Yes, those are there in the config file, as I haven't changed anything from it. Is there something else we have to do to bring LAN and WiFi indicators?

@ophub
Copy link
Owner

ophub commented Apr 2, 2022

functions='alarm wifi eth pause play usb apps setup sd hdmi cvbs'

Note: Some displays have indicators 1 - 6, and others 6 - 11. There is no overlap, and you can't trigger an indicator that does not exist on your display type.

@833M0L3
Copy link

833M0L3 commented Apr 2, 2022

Interesting. So I tried rearranging the orders of the names inside that function array but nothing seems to change even after several restarts on the LED Panel.

IMG_20220402_200945

image

@ophub
Copy link
Owner

ophub commented Apr 2, 2022

Not all can be used, each device can only use the display supported by its own LED panel. For example, my TX3 only has time, no other icons, and his LED panel does not support display.

@833M0L3
Copy link

833M0L3 commented Apr 2, 2022

Oh nvm, it started working now. It seems like changing wlan to wifi and lan to eth from the function did the job. Thank you so much for taking the time to answer my question.
Also it would be great if you add these changes to the original build here in the repo. Thank you !

IMG_20220402_201917

@ophub
Copy link
Owner

ophub commented Apr 2, 2022

Please post your modified available options, I will update this configuration. Upload your modified file, and I will update the configuration file in the warehouse.

@833M0L3
Copy link

833M0L3 commented Apr 2, 2022

functions='wifi eth usb alarm play pause' this worked perfectly

@ophub
Copy link
Owner

ophub commented Apr 2, 2022

Is your file hk1-x3.conf?

@833M0L3
Copy link

833M0L3 commented Apr 2, 2022

Yes

@ophub
Copy link
Owner

ophub commented Apr 2, 2022

c14a1b2

Updated, future firmware will use this default config.

@moarmarmalade
Copy link

moarmarmalade commented Apr 3, 2022

I don't quite know where to post this, but for my Tanix TX3-mini s905w (version A, manufactured by Oranth) the following works to get vfd working:

(1) Update the dtb by adding the openvfd{} stub as described e.g. by @danboid above.
(2) Set up the following tx3.conf file for the openvfd driver/module

vfd_gpio_clk='0,76,0'
vfd_gpio_dat='0,75,0'
vfd_gpio_stb='1,4,0'
vfd_chars='4,3,2,1,0'
vfd_dot_bits='0,1,2,3,4,5,6'
vfd_display_type='0x01,0x00,0x00,0x00'
# The functions list here only defines what is 'on' at start; thereafter on-offing is
# done by writes to the openvfd sysfs node by e.g. an openvfd service.
functions='usb colon eth wifi'

(3) Then use the command armbian-led 16 to start the openvfd functionality (e.g. from rc.local).

(4) To also get a ugly-hacky openvfd service running I'm also using this script (e.g. started in background from rc.local)

#!/bin/bash

# Program to turn on/off VFD indicator leds on a TV box using openvfd.
# The program monitors the usb bus and the eth and wifi network interfaces.

# Primary parameters.
loop_time="2s"
eth_devname="eth0"
wifi_devname="wlan0"
eth_vfdname="eth"
wifi_vfdname="wifi"
usb_vfdname="usb"
lsusb_bin="/usr/bin/lsusb"
net_sysnode="/sys/class/net"
vfd_sysnode="/sys/class/leds/openvfd/"

# Derived parameters.
eth_opstate="${net_sysnode}/${eth_devname}/operstate"
wifi_opstate="${net_sysnode}/${wifi_devname}/operstate"

# Functions
# Signal handler for clean shutdown.
shutdown() {
  # Possibly do cleanup stuff here.
  echo "Received shutdown signal, quitting program ${0}."
  exit 0
}

# Main
trap shutdown INT TERM EXIT

# Check to see that the script is being run by root.
if [ "$EUID" -ne 0 ] ; then
    echo "This script must be run as root, exiting."
    exit 1
fi

echo "Starting ${0} (vfd leds for net ifaces), press CTRL-C to end."

while true ; do

  eth_state=$(cat ${eth_opstate})
  # echo "${eth_devname} is ${eth_state}."
  if [ "${eth_state}" = "up" ] ; then
    echo $eth_vfdname > "${vfd_sysnode}/led_on"
  else
    echo $eth_vfdname > "${vfd_sysnode}/led_off"
  fi

  if [[ -d "${net_sysnode}/${wifi_devname}" ]] ; then
  wifi_state=$(cat ${wifi_opstate})
  # echo "${wifi_devname} is ${wifi_state}."
    if [ "${wifi_state}" = "up" ] ; then
      echo $wifi_vfdname > "${vfd_sysnode}/led_on"
    else
      echo $wifi_vfdname > "${vfd_sysnode}/led_off"
    fi
  else
    echo $wifi_vfdname > "${vfd_sysnode}/led_off"
  fi

  usb_removables=$(${lsusb_bin} | grep -v "Linux Foundation")
  # echo -e "usb removable devices:\n${usb_removables}"
  if [ "${usb_removables}" != "" ] ; then
    echo $usb_vfdname > "${vfd_sysnode}/led_on"
  else
    echo $usb_vfdname > "${vfd_sysnode}/led_off"
  fi

  sleep $loop_time

done ;

Someone with actual programming skillz can perhaps make this proper.

Finally, many thanks to ophub+family for the great work!

Edit: Two words.

@ophub
Copy link
Owner

ophub commented Apr 3, 2022

https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/build-armbian/common-files/rootfs/usr/share/openvfd

Here are some configuration files that passed the test.

vfd_gpio_clk='0,76,0'
vfd_gpio_dat='0,75,0'
vfd_gpio_stb='1,4,0'
vfd_chars='4,3,2,1,0'
vfd_dot_bits='0,1,2,3,4,5,6'
vfd_display_type='0x01,0x00,0x00,0x00'
# The functions list here only defines what is 'on' at start; thereafter on-offing is
# done by writes to the openvfd sysfs node by e.g. an openvfd service.
functions='usb colon eth wifi'

I then add a tx3-mini.conf based on your feedback

What is the name of the dtb you are using?(use meson-gxl-s905w-tx3-mini.dtb ?) I add the openvfd function to the dtb file of the kernel

@moarmarmalade
Copy link

moarmarmalade commented Apr 3, 2022

Yes, I was using meson-gxl-s905w-tx3-mini.dtb for kernel 5.4.y but I don't remember the y-number (the box isn't running right now). Edit: The kernel version is 5.4.187

@ophub
Copy link
Owner

ophub commented Apr 3, 2022

https://github.com/ophub/amlogic-s9xxx-armbian/blob/main/build-armbian/common-files/rootfs/usr/share/openvfd/conf/tx3-mini.conf

armbian-led 18

You take a photo of the tx3-mini lighting up the led and share the final effect with everyone. thanks

I have added the configuration, and then added it in the kernel. You use your own dtb file first.

@moarmarmalade
Copy link

moarmarmalade commented Apr 3, 2022

Sure, here is the result (the eth/LAN indicator is off since I'm using my openvfd script above but no cable is connected but I have a USB WiFi dongle attached). (Edit: The icons for 'play' 'pause' and 'alarm' also work, but I don't use them.)

IMG_20220403_121837303_crop

@ophub
Copy link
Owner

ophub commented Apr 3, 2022

unifreq/linux-5.4.y@09ac608

It has also been added to the kernel, and subsequent kernel packages will have this function.

@833M0L3
Copy link

833M0L3 commented Apr 4, 2022

The program monitors the usb bus and the eth and wifi network interfaces

This is actually what the LED lights should do. If it is not much, can anyone make a proper edit to the armbian-led bash script, so that the LED indicators of WiFi and ETH reacts based on their current status on the box.

@danboid
Copy link
Contributor Author

danboid commented Apr 7, 2022

Sorry it took me so long to getting round to testing this but I have now done a fresh install of Armbian_22.05.0_Aml_s905x3_focal_5.15.32_2022.04.03.1949.img on my X96 Air Q1000 (but using the X96 Max Plus dtb because the X96 Air dtb doesn't work for me) and I can confirm armbian-led presets 11, 12 and 13 all work for me. My rhymes are on time like the hands of a clock!

Thanks @ophub and @dinhchinh82 !

@ophub
Copy link
Owner

ophub commented Apr 7, 2022

good

@tri-pole
Copy link

The program monitors the usb bus and the eth and wifi network interfaces

This is actually what the LED lights should do. If it is not much, can anyone make a proper edit to the armbian-led bash script, so that the LED indicators of WiFi and ETH reacts based on their current status on the box.

I have written a c-program to monitor certain system resources (eth0, wlan0, usb, temp) and to turn on/off the icons on the VFD accordingly on a TVbox (such as the TX3-mini). The code can be found here: tvbox-mon. It uses the OpenVFD interface and can be run as a systemd service. (The program tvbox-mon is probably overly complicated and I think it would be good if someone could also code a more complete bash script than the one suggested above by @moarmarmalade since a bash script is transparent, portable and easily edited, and a bash script would certainly suffice for this job.)

P.S. I used the handle @moarmarmalade when I posted before/above.

@danboid
Copy link
Contributor Author

danboid commented Apr 10, 2022

Hi @tri-pole !

I was thinking of trying to replicate your tv-box led with a bash script but I don't have the time for that right now so I'm glad you've given us a C version. I've just tried it on my X96 Air Q1000. It built fine but I've not got it to work.

I have got openvfd working, I think. The clock shows the correct time and all the other LEDs (HD, CVBS. APPS, SETUP and CARD) are all constantly lit so maybe its not 100% correctly configured yet? All of the other armbian led settings I've tried so far behaved the same but I've not played with armbian led much yet. I am currently using armbian led preset 11. Does you app co-exist nicely with armbian-led?

I would like to use your app to show network activity by blinking one or all of the non-time LEDs so I ran the command

./tvbox-mon -c n

Then I logged in again (it felt better than backgrounding it) and used wget to download an iso but there was no blinking of my LEDs.

So, what can I expect to blink? Can I use your app to only blink one of the specific LEDs? What does it default to blinking if not all of the non-time LEDs?

@tri-pole
Copy link

tri-pole commented Apr 10, 2022

Does you app co-exist nicely with armbian-led?

Yes, the script armbian-led just inserts the correct parameter values (for the box in question) into a kernel module load string (command) and then loads the module with these values. If you can see the clock digits working, then the OpenVFD kernel module is working correctly. (The function=blabla near the end of your conf file for openvfd (corresponding to the value 11 for armbian-led) defines which icons should start in "on" state. Edit: It defines available-and-to-be-used icons, and makes them turn on at module load time (I think).)

Every box (display) has its own distinct set of available icons (you can see the ones for TX3 in the def.h file in the tvbox-mon repo). To find out which ones are available to you, you can try by writing different single-keyword strings to the led control node in sysfs for OpenVFD. For example, from what you are writing about your display, the following should work (you must do this as user root, hence the first hashmark on each line)

# echo "hd" > /sys/class/leds/openvfd/led_on # turn on HD led
# echo "hd" > /sys/class/leds/openvfd/led_off # turn off HD led

Try things like this until you have definitely identified the correct names (as used inside OpenVFD) for the icons on you particular display.

The program txbox-mon is not configured to blink icons (except for the alarm, when used as high temp warning) but merely to turn on the USB icon if there is an external USB device present, if you have an USB icon, and to turn on the wired connection symbol when the eth0 interface is up (and the cable is connected), if you have an Ethernet icon, and similarly turn on the icon for WiFi etc.

Since it appears that you have neither of these icons (usb, eth, wifi) I'm not sure if the program tvbox-mon is so useful to you, unless you want to re-assign the meaning of e.g. the HD icon to in fact mean USB (which is something the code in tvbox-mon checks for).

If you are willing to re-assign some of your existing exons to the tasks of showing usb, eth, wifi or temp (alarm) then have a look at the struct vfd_iconprops in def.h and the instantiation of such a struct in main.c (near the top), and edit to taste (i.e. to match the icon names you have experimentally found to work by echoing strings to the sysfs node as in my example above).

Finally, I invite everyone to fork the code and add functionality for other boxes than the TX3 that I wrote the code for; there seems to exist a large number of different displays with different icons and corresponding monitoring functions that could be desirable.

@danboid
Copy link
Contributor Author

danboid commented Apr 10, 2022

Thanks for your comprehensive response @tri-pole! You're right in saying your app doesn't do what I want or rather I got the wrong idea about what the -n switch might do.

@ophub ophub added the documentation Improvements or additions to documentation label Apr 10, 2022
@ophub ophub added the essence Recommended essence posts label Dec 28, 2022
@fran6120
Copy link

fran6120 commented Jan 19, 2023

I don't quite know where to post this, but for my Tanix TX3-mini s905w (version A, manufactured by Oranth) the following works to get vfd working:

(1) Update the dtb by adding the openvfd{} stub as described e.g. by @danboid above. (2) Set up the following tx3.conf file for the openvfd driver/module

vfd_gpio_clk='0,76,0'
vfd_gpio_dat='0,75,0'
vfd_gpio_stb='1,4,0'
vfd_chars='4,3,2,1,0'
vfd_dot_bits='0,1,2,3,4,5,6'
vfd_display_type='0x01,0x00,0x00,0x00'
# The functions list here only defines what is 'on' at start; thereafter on-offing is
# done by writes to the openvfd sysfs node by e.g. an openvfd service.
functions='usb colon eth wifi'

(3) Then use the command armbian-led 16 to start the openvfd functionality (e.g. from rc.local).

(4) To also get a ugly-hacky openvfd service running I'm also using this script (e.g. started in background from rc.local)

#!/bin/bash

# Program to turn on/off VFD indicator leds on a TV box using openvfd.
# The program monitors the usb bus and the eth and wifi network interfaces.

# Primary parameters.
loop_time="2s"
eth_devname="eth0"
wifi_devname="wlan0"
eth_vfdname="eth"
wifi_vfdname="wifi"
usb_vfdname="usb"
lsusb_bin="/usr/bin/lsusb"
net_sysnode="/sys/class/net"
vfd_sysnode="/sys/class/leds/openvfd/"

# Derived parameters.
eth_opstate="${net_sysnode}/${eth_devname}/operstate"
wifi_opstate="${net_sysnode}/${wifi_devname}/operstate"

# Functions
# Signal handler for clean shutdown.
shutdown() {
  # Possibly do cleanup stuff here.
  echo "Received shutdown signal, quitting program ${0}."
  exit 0
}

# Main
trap shutdown INT TERM EXIT

# Check to see that the script is being run by root.
if [ "$EUID" -ne 0 ] ; then
    echo "This script must be run as root, exiting."
    exit 1
fi

echo "Starting ${0} (vfd leds for net ifaces), press CTRL-C to end."

while true ; do

  eth_state=$(cat ${eth_opstate})
  # echo "${eth_devname} is ${eth_state}."
  if [ "${eth_state}" = "up" ] ; then
    echo $eth_vfdname > "${vfd_sysnode}/led_on"
  else
    echo $eth_vfdname > "${vfd_sysnode}/led_off"
  fi

  if [[ -d "${net_sysnode}/${wifi_devname}" ]] ; then
  wifi_state=$(cat ${wifi_opstate})
  # echo "${wifi_devname} is ${wifi_state}."
    if [ "${wifi_state}" = "up" ] ; then
      echo $wifi_vfdname > "${vfd_sysnode}/led_on"
    else
      echo $wifi_vfdname > "${vfd_sysnode}/led_off"
    fi
  else
    echo $wifi_vfdname > "${vfd_sysnode}/led_off"
  fi

  usb_removables=$(${lsusb_bin} | grep -v "Linux Foundation")
  # echo -e "usb removable devices:\n${usb_removables}"
  if [ "${usb_removables}" != "" ] ; then
    echo $usb_vfdname > "${vfd_sysnode}/led_on"
  else
    echo $usb_vfdname > "${vfd_sysnode}/led_off"
  fi

  sleep $loop_time

done ;

Someone with actual programming skillz can perhaps make this proper.

Finally, many thanks to ophub+family for the great work!

Edit: Two words.

The script works like a charm on a HK1 X3.

Thanks so much!

The program monitors the usb bus and the eth and wifi network interfaces

This is actually what the LED lights should do. If it is not much, can anyone make a proper edit to the armbian-led bash script, so that the LED indicators of WiFi and ETH reacts based on their current status on the box.

I have written a c-program to monitor certain system resources (eth0, wlan0, usb, temp) and to turn on/off the icons on the VFD accordingly on a TVbox (such as the TX3-mini). The code can be found here: tvbox-mon. It uses the OpenVFD interface and can be run as a systemd service. (The program tvbox-mon is probably overly complicated and I think it would be good if someone could also code a more complete bash script than the one suggested above by @moarmarmalade since a bash script is transparent, portable and easily edited, and a bash script would certainly suffice for this job.)

P.S. I used the handle @moarmarmalade when I posted before/above.

The binary compiles and works perfectly but for some reason the running service uses 100% of one CPU core

@tri-pole
Copy link

@fran6120
Hmm... I don't know why it consumes 100% of one core. (The program should spend most of its time in usleep() and usleep() should be implemented so that the execution thread is suspended, i.e. not using CPU resources (see man 3 usleep.) I don't have my TX3 up and running at the moment so I cannot check, unfortunately.

Perhaps you can try and run the program from command line and see if the problem persists (to separate out any systemd related problems)?

@fran6120
Copy link

@fran6120 Hmm... I don't know why it consumes 100% of one core. (The program should spend most of its time in usleep() and usleep() should be implemented so that the execution thread is suspended, i.e. not using CPU resources (see man 3 usleep.) I don't have my TX3 up and running at the moment so I cannot check, unfortunately.

Perhaps you can try and run the program from command line and see if the problem persists (to separate out any systemd related problems)?

On a fresh Armbian installation, your tvbox-mon works perfectly, only, a few times systemd service is degraded on boot but "systemctl reset-failed" restarts the service well.

Maybe increasing the RestartSec time will solve it.

Is there a way to set the screen brightness? In that case, in the future, if you want, could you add a night mode by setting a low brightness in a certain period of time?

For example, between 00:00 and 7:00, or configurable time slot.

The last is just a suggestion, I am already very thankful for this tool.

Thank you!

@tri-pole
Copy link

@fran6120

Thank you for your feedback. (I will keep the tip about "systemctl reset-failed" for handling systemd serives in general.)

Unfortunately, I don't know of any (direct) way of changing the brightness when using the openvfd interface to control the VFD/LEDs. I have been bothered by this too; I think the default brightness is too low. (For the old 4.x kernel series there were codes floating around to control the VFD/LEds via direct gpio bit banging; it required a modified dtb, a kernel module and a service. I used this on my TX3 (it is written about in some old Armbian thread) but unfortunately it was not easy to port to the 5.x series of kernels (or newer), if I recall correctly.)

@fran6120
Copy link

@tri-pole

it is a pity... anyway thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation essence Recommended essence posts support This need is supported
Projects
None yet
Development

No branches or pull requests

8 participants