2021-05-22

QNAP: control LCD panel and speaker

LCD Panel

Most (if not all) QNAP models come with an LCD display, in my model i got a 2 lines by 16 characters each. The tool to control the panel is:

/sbin/lcd_tool

but sometimes it's a bit stubborn in executing the commands, so as mentioned here you may want to killall -9 lcdmond and then issue the command you want; this is the snippet i'm using:

# print a msg on the panel
killall -9 lcdmond
/sbin/lcd_tool -1 "$LINE1" -2 "$LINE2"
sleep 5
# turn off screen light
killall -9 lcdmond
/sbin/lcd_tool -f

it ain't pretty, but it gets the job done.

Speaker / Buzzer

If you look for how to make your system beep, you may find these commands:

/sbin/pic_raw 80    Beep short
/sbin/pic_raw 81    Beep long

but they no longer work. So keep looking, i stumbled upon this post, mentioning hal_app, and that indeed works, but with a different syntax than the one presented at that link.

In order to use hal_app to make a beep sound, the syntax that worked for me is:

/sbin/hal_app --se_buzzer enc_id=0,mode=XXX
If you remove entirely mode=XXX, it produces a short beep, but here is the list of all the modes available and their results (found out via exhaustive search):

code output
0 short beep (0.5 secs)
1 long beep (1 sec)
2 3x short beeps (0.5 secs), long pause (1 sec)
3-7, 10,
15, 16, 17,
18, 19, 20
2x long beeps (1 sec), very long pause (2 secs)
8, 9 3x long beeps (1 sec), very long pauses (2 secs)
12, 13 long beep, 2x very short pause (0.25) very short beep (0.25)
14 3x very short beep (0.25) very short pause (0.25)

(you can prepend as many 0 to the mode strings as you wish, so 000 is equivalent to 0, 000018 is equivalent to 18, and so on).

PS: this article is based on my system, TVS-473 running firmware 4.5.3.1652

PPS: friendly reminder that this is how you edit the crontab on a QNAP machine.

No comments: