/* femon -- monitor frontend status * * Copyright (C) 2003 convergence GmbH * Johannes Stezenbach * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef TRUE #define TRUE (1==1) #endif #ifndef FALSE #define FALSE (1==0) #endif #define FRONTENDDEVICE "/dev/dvb/adapter%d/frontend%d" static char *usage_str = "\nusage: femon [options]\n" " -a number : use given adapter (default 0)\n" " -f number : use given frontend (default 0)\n\n"; static void usage(void) { fprintf(stderr, usage_str); exit(1); } static int check_frontend (int fe_fd) { fe_status_t status; uint16_t snr, signal; uint32_t ber, uncorrected_blocks; do { ioctl(fe_fd, FE_READ_STATUS, &status); ioctl(fe_fd, FE_READ_SIGNAL_STRENGTH, &signal); ioctl(fe_fd, FE_READ_SNR, &snr); ioctl(fe_fd, FE_READ_BER, &ber); ioctl(fe_fd, FE_READ_UNCORRECTED_BLOCKS, &uncorrected_blocks); printf ("status %02x | signal %04x | snr %04x | ber %08x | unc %08x | ", status, signal, snr, ber, uncorrected_blocks); if (status & FE_HAS_LOCK) printf("FE_HAS_LOCK"); printf("\n"); usleep(1000000); } while (1); return 0; } static int do_mon(unsigned int adapter, unsigned int frontend) { char fedev[128]; int fefd; int result; struct dvb_frontend_info fe_info; snprintf(fedev, sizeof(fedev), FRONTENDDEVICE, adapter, frontend); printf("using '%s'\n", fedev); if ((fefd = open(fedev, O_RDONLY | O_NONBLOCK)) < 0) { perror("opening frontend failed"); return FALSE; } result = ioctl(fefd, FE_GET_INFO, &fe_info); if (result < 0) { perror("ioctl FE_GET_INFO failed"); close(fefd); return FALSE; } printf("FE: %s (%s)\n", fe_info.name, fe_info.type == FE_QPSK ? "SAT" : fe_info.type == FE_QAM ? "CABLE": "TERRESTRIAL"); check_frontend (fefd); close(fefd); return result; } int main(int argc, char *argv[]) { unsigned int adapter = 0, frontend = 0; int opt; while ((opt = getopt(argc, argv, "hlrn:a:f:d:")) != -1) { switch (opt) { case '?': case 'h': default: usage(); case 'a': adapter = strtoul(optarg, NULL, 0); break; case 'f': frontend = strtoul(optarg, NULL, 0); } } do_mon(adapter, frontend); return FALSE; } '#n22'>22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
#
# /etc/lcd4linux.conf
# configuration file for lcd4linux
#
# http://lcd4linux.sourceforge.net
#
# for the complete lcd4linux documentation please refer to 
# http://lcd4linux.sourceforge.net/manual.html


# driver-specific options
# 
# Display:
# the name of a display driver
#
# every driver has its own configuration options
# (e.g. 'Port', 'Speed', ...)
# for a detailed description of every option which is
# available for a specific driver please refer to
# http://lcd4linux.sourceforge.net/display/main.html 
#
#Display LCD2041
#Port /dev/ttyS2
#Speed 19200
#Contrast 160
#
#Display HD44780
#Port /dev/parport0
#Size 24x2
#Delay 503
#
#Display BLC100x
#Port /dev/ttyS2
#Type 20x4
#
#Display USBLCD
#Port /dev/usb/usblcd
#Size 20x4
#
#Display PalmPilot
#Port /dev/ttyS2
#Speed 4800
#size 20x4
#font 6x8
#pixel 1+0
#gap 0x0
#border 2
#
#Display PPM
#size 20x4
#font 5x8
#pixel 3+0
#gap -1x-1
#border 10
#foreground \#102000
#halfground \#70c000
#background \#80d000
#
#Display PNG
#size 20x4
#font 5x8
#pixel 2+0
#gap -1x-1
#border 5
#foreground \#102000
#halfground \#70c000
#background \#80d000
#
#Display X11
#size 20x5
#font 5x8
#pixel 1+0
#gap -1x-1
#border 1
#foreground \#102000
#halfground \#90c000
#background \#a0d000
#
#Display Text
#size 40x8
#TextBar 1
#
#Display SIN
#Port /dev/tty9


# timing options - all values are milliseconds
#
# please note that starting with 0.9.11 the settings tick,
# tack, tau are marked as obsolete and replaced by the
# following ones:
#
# Tick.Text:
# time between text updates - default is 500
#
# Tick.bar :
# time between bar updates - default is 100
#
# Tick.icon:
# time between icon updates - default is 100
#
# Tick.gpo :
# time between gpo updates - default is 100
#
#Tick.Text 500
#Tick.bar 100
#Tick.icon 100
#Tick.gpo 100


# data-specific options
#
# Overload:
# load average threshold and bar scaling
#
# SetiDir:
# directory where seti@home stores its data files
#
# Battwarning:
# flash bp-bar if running below Battwarning
# I use: Row6 "Bat%bp%bs%bd$r10bp+bp"
# which gives a nice flash effect - default is 10
#
Overload 2.0
SetiDir /etc/setiathome
#Battwarning 10


# mail/news related options
#
# Mailbox[1..9]:
# defines the mailbox for querying
# the string may be a plain mbox file or a pop3/imap4/nntp
# server string with the following format:
#     pop3:[user[:pass]@]machine[:port]
#     imap4:[user[:pass]@]machine[:port][/dir]
#     nntp:[user[:pass]@]machine[:port][/dir]
# quering a plain (local) mbox file is achieved by giving
# the full path/name to the mbox file
# port defaults to 110 (pop3 query) and 143 (imap query)
# if [/dir] is not given, INBOX is assumed
# if [/dir] is given for nntp it should be a valid group name
# with '.' separating items
# if [/dir] is not given for nntp all/unread news of subscribed
# groups from Newsrc are calculated.
#
# Delay_e[1..9]:
# delay in seconds for querying Mailbox[1..9] - default is 5
#
# Newsrc:
# path/name of your .newsrc file containing subscribed news
# please note that authorization on newsservers is currently untested
# user and pass may not contain a '/' with above syntax
#
#Mailbox1 /var/spool/mail/michi
#Delay_e1 5
#
#Mailbox2 pop3:user:pass@machine
#Delay_e2 20
#
#Mailbox3 imap4:user:pass@machine/folder
#Delay_e3 20
#
#Mailbox4 nntp:server/at.linux
#Delay_e4 120


# temperature sensors
#
# Sensor[1..9]:
# path to temperature file [1...9]
#
# Sensor[1..9]_min:
# temperature where the corresponding bar starts
#
# Sensor[1..9]_max:
# temperature where bar ends
#
# Sensor[1..9]_factor:
# formula to calculate real temperature
# (display_value=raw_value*factor+offset)
# lookup these values in /etc/sensors.conf
#
# Sensor[1..9]_offset:
# offset to calculate the real temperature
#
#Sensor1 /proc/sys/dev/sensors/as99127f-i2c-0-2d/temp1
#Sensor1_min 30
#Sensor1_max 50
#
#Sensor2 /proc/sys/dev/sensors/as99127f-i2c-0-2d/temp2
#Sensor2_min 30
#Sensor2_max 50
#
#Sensor3 /proc/sys/dev/sensors/as99127f-i2c-0-2d/temp3
#Sensor3_min 30
#Sensor3_max 50



# plugins
#
# x[1..9]:
# command to execute. predefined $PATH:
# PATH=/usr/local/bin:/usr/bin:/bin 
# $X[1..9] is the result of command x[1..9] in environment
#
# Tick_x[1..9]:
# delay in ticks (overrides Delay_x[1..9])
#
# Delay_x[1..9]:
# delay in seconds - default is 1
#
# Max_x[1..9]:
# max value for scaling bars - default is 100 (value should be numeric)
#
# Min_x[1..9]:
# min value for bars - default is 0 (should be != Max_x[1..9])
#
#x1 tail -1 /var/log/messages
#Tick_x1 10
#Delay_x1 1
#Max_x1 50
#Min_x1 10
#
#x2 echo $X1 | cut -b25-


# display options
#
# Row[1..9]:
# text to display in row [1..9]
#
# the text to be displayed can contain specific directives which will
# be replaced by the appropriate values or will create bars or icons.
# for a detailed description of every possible directive please refer to
# http://lcd4linux.sourceforge.net/manual.html or
# /usr/share/doc/packages/lcd4linux/README.Rows
#
Row1 "Busy %cb%% $r14cs+cb"
Row2 "Load%l1%L$r14l1"
#
#Row1 "$u3l1$u3cb$u3cs $u3mu$u3ma$u3ms $u3dr$u3dw $u3nr$u3nw $u3ii$u3io"
#Row2 " "
#Row3 " "
#Row4 "CPU MEM IO IP"
#
#Row1 "*** %o %v ***"
#Row2 "%p CPU  %r MB RAM"
#Row3 "Busy %cb%% $r10cs+cb"
#Row4 "Load%l1%L$r10l1"
#
#Row1 "Load%l1%L$r10cs+cb"
#Row2 "Disk%dm $R10dr+dw"
#Row3 "Net %nm $R10nr+nw"
#Row4 "ISDN%im $r10ii+io"
#Row4 "DSL %tm $r10ti+to"
#Row5 "Temp%s2�$r10s1+s2"
#
#Row5 %x1
#Row6 %x2
#
#Row6 "Mails %e3/%u3"


# icons
#
# Icons:
# number of icons
#
# every icon you are reserving here is no longer available
# for bars. As most displays have only eight user-defineable
# characters, and a dual-bar needs at least five of them
# you should not use more than 3 icons in parallel
# with bars...
#
# Icon<num>.Bitmap<row>:
# bitmap row 'row' for icon 'num'
#
# for a detailed description of how to use icons please refer to
# http://lcd4linux.sourceforge.net/display/main.html
#
#Icons 1
#
#Icon1.Bitmap1 .....
#Icon1.Bitmap2 .*.*.
#Icon1.Bitmap3 *****
#Icon1.Bitmap4 *****
#Icon1.Bitmap5 .***.
#Icon1.Bitmap6 .***.
#Icon1.Bitmap7 ..*..
#Icon1.Bitmap8 .....


# virtual rows
#
# Rows:
# number of rows to use (maybe greater than your displays rows)
#
# Scroll:
# number of rows to scroll
#
# Turn:
# time in milliseconds between scrolling events
#
#Rows 10
#Scroll 2
#Turn 5000


# general purpose outputs
#
# GPOs:
# number of outputs to use
#
# GPO[1..max]:
# token to use for GPO[1..max]
#
# the token should return a numeric value. If this value is greater
# than zero the output will be enabled otherwise disabled.
# please refer to the corresponding documentation under
# http://lcd4linux.sourceforge.net/display/main.html to
# find out if GPOs are supported with your display