aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <m.chehab@samsung.com>2014-09-14 13:44:12 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-09-14 13:44:12 -0300
commit7e958cb13e7d76c266d38d7d8ace4344fd9bf655 (patch)
tree811ec94504567db69163517ed7e0607bc6469c53
parent3a9ea24f542bb952740ca1ea7a23c29a9560a2da (diff)
dvb-fe-tool: Colorize the status report
Using different colors to represent different QoS helps the user when adjusting an antena. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--utils/dvb/dvb-fe-tool.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/utils/dvb/dvb-fe-tool.c b/utils/dvb/dvb-fe-tool.c
index 4d20fc6b..b3ac20d4 100644
--- a/utils/dvb/dvb-fe-tool.c
+++ b/utils/dvb/dvb-fe-tool.c
@@ -147,8 +147,30 @@ static int print_frontend_stats(FILE *fd,
dvb_fe_snprintf_stat(parms, DTV_PER, "PER",
i, &p, &len, &show);
-
if (p != buf) {
+ if (isatty(fileno(fd))) {
+ enum dvb_quality qual;
+ int color;
+
+ qual = dvb_fe_retrieve_quality(parms, 0);
+ switch (qual) {
+ case DVB_QUAL_POOR:
+ color = 31;
+ break;
+ case DVB_QUAL_OK:
+ color = 36;
+ break;
+ case DVB_QUAL_GOOD:
+ color = 32;
+ break;
+ case DVB_QUAL_UNKNOWN:
+ default:
+ color = 0;
+ break;
+ }
+ fprintf(fd, "\033[%dm", color);
+ }
+
if (n_status_lines)
fprintf(fd, "\t%s\n", buf);
else

Privacy Policy