Username or Email
Password
Remember me
Sign in
Sign up
Add Paste
Add Collection
You are not allowed to edit this paste! A fork will be created instead.
C/C++
CSS
HTML
Markdown
PHP
Python
Text
ABAP
ActionScript
ADA
Apache Conf
AsciiDoc
Assembly x86
AutoHotKey
BatchFile
BBCode
C9Search
Clojure
Cobol
CoffeeScript
ColdFusion
C#
Curly
D
Dart
Diff
Dot
Erlang
EJS
Forth
FreeMarker
Glsl
Go
Groovy
HAML
Handlebars
Haskell
haXe
HTML (Ruby)
INI
Jack
Jade
Java
JavaScript
JSON
JSONiq
JSP
JSX
Julia
LaTeX
LESS
Liquid
Lisp
LiveScript
LogiQL
LSL
Lua
LuaPage
Lucene
Makefile
MATLAB
MEL
MySQL
MUSHCode
Nix
Objective-C
OCaml
Pascal
Perl
pgSQL
Powershell
Prolog
Properties
Protobuf
R
RDoc
RHTML
Ruby
Rust
SASS
SCAD
Scala
Scheme
SCSS
SH
SJS
Space
snippets
Soy Template
SQL
Stylus
SVG
Tcl
Tex
Textile
Toml
Twig
Typescript
VBScript
Velocity
Verilog
XML
XQuery
YAML
/* * dvb_signal.c * * Copyright (C) 2014 ManiacTwister * * 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., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include
#include
#include
#include
#include
#include
#include
#include
#include
int main(int argc, char** argv) { char adapter[1024]; int frontend_fd = -1; struct dvb_frontend_info Info; uint16_t Signal; uint16_t Snr; if(argc < 2) { printf("Arguments:
\n"); return -1; } sprintf(adapter, "/dev/dvb/adapter%s/frontend0", argv[1]); if ((frontend_fd = open (adapter, O_RDWR | O_NONBLOCK)) < 0) { printf("Failed to open %s\n", adapter); } if(ioctl(frontend_fd, FE_GET_INFO, &Info) < 0) { printf("ioctl FE_GET_INFO failed\n"); return -1; } if (ioctl(frontend_fd, FE_READ_SIGNAL_STRENGTH, &Signal) != 0) { printf("ioctl FE_READ_SIGNAL_STRENGTH failed\n"); } if (ioctl(frontend_fd, FE_READ_SNR, &Snr) != 0) { printf("ioctl FE_READ_SNR failed\n"); } printf("%s:\nSignal: %d SNR: %d\n", Info.name, ((Signal * 100 + 0x8001) >> 16), ((Snr * 100 + 0x8001) >> 16)); close(frontend_fd); }
Private