Closed danboid closed 2 years ago
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?
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:
openvfd {
compatible = "open,vfd";
dev_name = "openvfd";
status = "okay";
};
@danboid thank you for your great idea. I'm also interested in this feature. Hope our hero @ophub will make it available soon :)
Tested by flippy
teacher, this method cannot be used.
He offers two case:
https://github.com/chewitt/linux/commit/253cf40451bc45bc45e3d48b36077c4823f53039
Can you provide a more detailed integration instructions? Need a complete code, including the core layer and the application layer.
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.
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+:
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.
https://github.com/unifreq/linux-5.15.y/commit/4053bade92f9282ef0607d8f0eea04baea8c9235
https://github.com/unifreq/linux-5.4.y/commit/b1d6b050d887eb375eec8c60855a0383bfba7777
https://github.com/unifreq/linux-5.10.y/commit/e48a78d032aaf080e1a31903ec1e8f15d9bf8b15
https://github.com/unifreq/linux-5.16.y/commit/d12b7c0708f6b3e69c9e1be21388f1dc1b6d5fc1
Light up hope, light up the future.
x96 max+
is that problem ?
This is totally unrelated to openvfd @EastWoodYang
If you are having problems with lightdm you can install lxdm instead.
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.
Light up hope, light up the future.
@ophub To try this one, just run armbian-update to update the latest kernel version, right?
Although it is included in the kernel, the control method has not yet been found, and the flippy boss is constantly debugging
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.
Debugging, it will take some time
After the efforts of flippy, now x96, h96, hk1, tx3 can use the screen.
Later he will post how to use it
Are you going to update the README with instructions on how to use openvfd?
@danboid @dinhchinh82
According to the script and instructions released by flippy, I added it to armbian, welcome to test feedback and share more configuration.
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
Great work @ophub ! I will test soon. Thanks!
On
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-updateand
apt get upgrade` just now.
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.
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 https://github.com/arthur-liberman/linux_openvfd/issues/12#issuecomment-893167354 , WiFi and LAN indicator is showing.
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?
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.
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.
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.
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 !
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.
functions='wifi eth usb alarm play pause'
this worked perfectly
Is your file hk1-x3.conf?
Yes
https://github.com/ophub/amlogic-s9xxx-armbian/commit/c14a1b2b841113c54621bc1d29b912a9c2841f1a
Updated, future firmware will use this default config.
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.
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
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
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.
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.)
https://github.com/unifreq/linux-5.4.y/commit/09ac608418e377cef9b2abfae0342b433de00712
It has also been added to the kernel, and subsequent kernel packages will have this function.
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.
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 !
good
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.
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?
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 programtxbox-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 programtvbox-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.
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.
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
@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 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!
@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.)
@tri-pole
it is a pity... anyway thank you very much!
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