aboutsummaryrefslogtreecommitdiffstats
path: root/console
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-04-01 09:24:40 (GMT)
committerGerd Hoffmann <kraxel@redhat.com>2010-04-01 09:24:40 (GMT)
commit9bbee7df3b13eb0caf1874748038235350916fbd (patch)
tree3fb2783458e405e75e9e0b2fc4e26f38ee601f0d /console
parent82fbaff22e3e4b1bbdd1e2192cfeff061ce7285c (diff)
v3.84
Diffstat (limited to 'console')
-rw-r--r--console/fbtools.c52
-rw-r--r--console/fbtv.c16
-rw-r--r--console/fs.c3
-rw-r--r--console/fs.h3
-rw-r--r--console/record.c31
-rw-r--r--console/scantv.c9
-rw-r--r--console/showqt.c2
-rw-r--r--console/showriff.c4
-rw-r--r--console/streamer.c16
-rw-r--r--console/v4l-conf.c4
-rw-r--r--console/v4l-info.c2
-rw-r--r--console/webcam.c31
12 files changed, 81 insertions, 92 deletions
diff --git a/console/fbtools.c b/console/fbtools.c
index 228589f..6ad7ceb 100644
--- a/console/fbtools.c
+++ b/console/fbtools.c
@@ -20,7 +20,6 @@
#include <linux/kd.h>
#include <linux/vt.h>
#include <linux/fb.h>
-#include <linux/major.h>
#include <asm/page.h>
@@ -307,61 +306,32 @@ static int fb_activate_current(int tty)
if (-1 == ioctl(tty,VT_GETSTATE, &vts)) {
perror("ioctl VT_GETSTATE");
return -1;
- } else {
- if (-1 == ioctl(tty,VT_ACTIVATE, vts.v_active)) {
- perror("ioctl VT_ACTIVATE");
- return -1;
- }
- if (-1 == ioctl(tty,VT_WAITACTIVE, vts.v_active)) {
- perror("ioctl VT_WAITACTIVE");
- return -1;
- }
}
- return 0;
-}
-
-int fb_probe(void)
-{
- struct fb_con2fbmap c2m;
- struct stat st;
- int fb;
-
- dev_init();
- fstat(0,&st);
- if (((st.st_rdev >> 8) & 0xff) != TTY_MAJOR)
- /* not a linux console */
- return -1;
- if (-1 == (fb = open(devices->fb0,O_WRONLY,0)))
- /* can't open /dev/fb0 */
+ if (-1 == ioctl(tty,VT_ACTIVATE, vts.v_active)) {
+ perror("ioctl VT_ACTIVATE");
return -1;
-
- c2m.console = st.st_rdev & 0xff;
- if (-1 == ioctl(fb, FBIOGET_CON2FBMAP, &c2m))
- /* ??? */
+ }
+ if (-1 == ioctl(tty,VT_WAITACTIVE, vts.v_active)) {
+ perror("ioctl VT_WAITACTIVE");
return -1;
- close(fb);
+ }
return 0;
}
int
fb_init(char *device, char *mode, int vt)
{
- struct stat st;
char fbdev[16];
+ struct vt_stat vts;
dev_init();
tty = 0;
if (vt != 0)
fb_setvt(vt);
- /* FIXME: where are MAJOR() / MINOR() ??? */
- fstat(tty,&st);
- if (((st.st_rdev >> 8) & 0xff) != TTY_MAJOR) {
- /* catch that here, give a more user friendly error message that just
- * throw a error about a failed ioctl later on ... */
- fprintf(stderr,
- "ERROR: tty is not a linux console. You can not start this\n"
- " tool from a pseudo tty (xterm/ssh/screen/...).\n");
+ if (-1 == ioctl(tty,VT_GETSTATE, &vts)) {
+ fprintf(stderr,"ioctl VT_GETSTATE: %s (not a linux console?)\n",
+ strerror(errno));
exit(1);
}
@@ -373,7 +343,7 @@ fb_init(char *device, char *mode, int vt)
fprintf(stderr,"open %s: %s\n",devices->fb0,strerror(errno));
exit(1);
}
- c2m.console = st.st_rdev & 0xff;
+ c2m.console = vts.v_active;
if (-1 == ioctl(fb, FBIOGET_CON2FBMAP, &c2m)) {
perror("ioctl FBIOGET_CON2FBMAP");
exit(1);
diff --git a/console/fbtv.c b/console/fbtv.c
index 9c4e868..2a20090 100644
--- a/console/fbtv.c
+++ b/console/fbtv.c
@@ -575,7 +575,8 @@ scaler_test(int off)
int
main(int argc, char *argv[])
{
- int key,i,c,gray=0,rc,vt=0,fps=0,t1,t2,lirc,js,err,mute=1,fdmax;
+ int i,key,c,gray=0,rc,vt=0,fps=0,t1,t2,lirc,js,err,mute=1,fdmax;
+ unsigned int ui;
unsigned long freq;
struct timeval tv;
time_t t;
@@ -801,8 +802,9 @@ main(int argc, char *argv[])
dst = fb_mem +
dy * fb_fix.line_length +
dx * ((fb_var.bits_per_pixel+7)/8);
- for (i = 0; i < buf->fmt.height; i++) {
- memcpy(dst,buf->data + i*buf->fmt.bytesperline, buf->fmt.bytesperline);
+ for (ui = 0; ui < buf->fmt.height; ui++) {
+ memcpy(dst, buf->data + ui*buf->fmt.bytesperline,
+ buf->fmt.bytesperline);
dst += fb_fix.line_length;
}
ng_release_video_buf(buf);
@@ -864,12 +866,12 @@ main(int argc, char *argv[])
sprintf(event,"kbd-key-f%d",key - KEY_F(0));
} else {
/* other special keys */
- for (i = 0; i < NKEYTAB; i++) {
- if (keytab[i].key == key)
+ for (ui = 0; ui < NKEYTAB; ui++) {
+ if (keytab[ui].key == key)
break;
}
- if (i != NKEYTAB)
- sprintf(event,"kbd-key-%s",keytab[i].name);
+ if (ui != NKEYTAB)
+ sprintf(event,"kbd-key-%s",keytab[ui].name);
}
if (0 != event[0]) {
event_dispatch(event);
diff --git a/console/fs.c b/console/fs.c
index c5008a2..4f129e0 100644
--- a/console/fs.c
+++ b/console/fs.c
@@ -122,7 +122,8 @@ void fs_render_fb(unsigned char *ptr, int pitch,
}
}
-int fs_puts(struct fs_font *f, int x, int y, unsigned char *str)
+int fs_puts(struct fs_font *f, unsigned int x, unsigned int y,
+ unsigned char *str)
{
unsigned char *pos,*start;
int i,c,j,w;
diff --git a/console/fs.h b/console/fs.h
index 2ac7228..290a00b 100644
--- a/console/fs.h
+++ b/console/fs.h
@@ -56,7 +56,8 @@ struct fs_font {
int fs_init_fb(int white8);
void fs_render_fb(unsigned char *ptr, int pitch,
FSXCharInfo *charInfo, unsigned char *data);
-int fs_puts(struct fs_font *f, int x, int y, unsigned char *str);
+int fs_puts(struct fs_font *f, unsigned int x, unsigned int y,
+ unsigned char *str);
int fs_textwidth(struct fs_font *f, unsigned char *str);
void fs_render_tty(FSXCharInfo *charInfo, unsigned char *data);
diff --git a/console/record.c b/console/record.c
index b334a1e..4bc43dd 100644
--- a/console/record.c
+++ b/console/record.c
@@ -39,14 +39,14 @@ tty_restore(void)
/* -------------------------------------------------------------------- */
-static int sound_fd;
-static int sound_blksize;
-static short *sound_buffer;
-static int maxl,maxr;
-static int secl,secr;
-static int *histl,*histr,histn,histi;
-static float peak_seconds = 1.5;
-static char *audio_dev = "/dev/dsp";
+static int sound_fd;
+static unsigned int sound_blksize;
+static short *sound_buffer;
+static int maxl,maxr;
+static int secl,secr;
+static int *histl,*histr,histn,histi;
+static float peak_seconds = 1.5;
+static char *audio_dev = "/dev/dsp";
static int
sound_open(int rate)
@@ -126,7 +126,8 @@ sound_open(int rate)
static int
sound_read(void)
{
- int i,rc,have;
+ unsigned int have;
+ int i,rc;
short *v;
/* read */
@@ -305,8 +306,8 @@ typedef struct WAVEHDR {
/* -------------------------------------------------------------------- */
static WAVEHDR fileheader;
-static off_t wav_size;
-static off_t done_size;
+static size_t wav_size;
+static size_t done_size;
static void
wav_init_header(int rate)
@@ -457,7 +458,7 @@ record_stop(int fd)
}
}
-static off_t
+static size_t
parse_size(const char *arg)
{
int value;
@@ -465,7 +466,7 @@ parse_size(const char *arg)
off_t retval = -1;
if (2 != sscanf(arg,"%d%3s",&value,mul))
- return -1;
+ return 0;
if (0 == strcasecmp(mul,"g") ||
0 == strcasecmp(mul,"gb"))
retval = (off_t)value * 1024 * 1024 * 1024;
@@ -555,7 +556,7 @@ main(int argc, char *argv[])
fd_set s;
int sec,maxhour,maxmin,maxsec;
int maxfiles = 0;
- off_t maxsize;
+ size_t maxsize;
/* init some vars */
progname = strrchr(argv[0],'/');
@@ -627,7 +628,7 @@ main(int argc, char *argv[])
}
}
maxsize = parse_size(str_maxsize);
- if (-1 == maxsize) {
+ if (0 == maxsize) {
fprintf(stderr,"maxsize parse error [%s]\n",str_maxsize);
exit(1);
}
diff --git a/console/scantv.c b/console/scantv.c
index a33ee06..3bebf78 100644
--- a/console/scantv.c
+++ b/console/scantv.c
@@ -120,10 +120,12 @@ usage(FILE *out, char *prog, char *outfile)
" -f table set frequency table.\n"
" -c device set video device file. [%s]\n"
" -C device set vbi device file. [%s]\n"
- " -s skip channel scan\n",
+ " -s skip channel scan\n"
+ " -a full scan (all frequencies, not just\n"
+ " the ones from the frequency table)\n",
prog,
outfile ? outfile : "stdout",
- ng_dev.video,ng_dev.vbi);
+ ng_dev.video, ng_dev.vbi);
}
int
@@ -131,7 +133,8 @@ main(int argc, char **argv)
{
struct vbi_state *vbi;
struct ng_attribute *attr;
- int c,f,f1,f2,fc,fi,on,tuned,i,j,scan=1,fullscan=0;
+ int c,fi,on,tuned,i,j,scan=1,fullscan=0;
+ unsigned int f,f1,f2,fc;
char *name,dummy[32];
char *tvnorm = NULL;
char *freqtab = NULL;
diff --git a/console/showqt.c b/console/showqt.c
index 12a9d18..51dfc94 100644
--- a/console/showqt.c
+++ b/console/showqt.c
@@ -547,7 +547,7 @@ static int handle_classic_atom(int fh, off_t pos, off_t size, int depth)
{
struct classic_atom a;
uint64_t asize;
- off_t off;
+ size_t off;
int i;
if (-1 == lseek(fh,pos,SEEK_SET)) {
diff --git a/console/showriff.c b/console/showriff.c
index c2240b9..c884e4d 100644
--- a/console/showriff.c
+++ b/console/showriff.c
@@ -370,7 +370,7 @@ static boolean ReadChunkHead(FILE* f, FOURCC* ID, DWORD* size)
ProcessChunk prints out information of the chunk to stdout
and returns FALSE, if an error occured. */
-static boolean ProcessChunk(FILE* f, off_t filepos, off_t filesize,
+static boolean ProcessChunk(FILE* f, size_t filepos, size_t filesize,
FOURCC DesiredTag, int RekDepth,
DWORD* chunksize)
{
@@ -378,7 +378,7 @@ static boolean ProcessChunk(FILE* f, off_t filepos, off_t filesize,
int buflen;
char tagstr[5]; /* FOURCC of chunk converted to string */
FOURCC chunkid; /* read FOURCC of chunk */
- off_t datapos; /* position of data in file to process */
+ size_t datapos; /* position of data in file to process */
if (filepos>filesize-1) { /* Oops. Must be something wrong! */
printf(" ***** Error: Data would be behind end of file!\n");
diff --git a/console/streamer.c b/console/streamer.c
index 50fd7c8..1759403 100644
--- a/console/streamer.c
+++ b/console/streamer.c
@@ -66,12 +66,13 @@ int debug = 0, have_dga = 0;
static void
list_formats(FILE *out)
{
+ struct list_head *item;
const struct ng_writer *wr;
- int i,j;
+ int j;
fprintf(out,"\nmovie writers:\n");
- for (i = 0; NULL != ng_writers[i]; i++) {
- wr = ng_writers[i];
+ list_for_each(item,&ng_writers) {
+ wr = list_entry(item, struct ng_writer, list);
fprintf(out," %s - %s\n",wr->name,
wr->desc ? wr->desc : "-");
if (NULL != wr->video) {
@@ -186,10 +187,11 @@ usage(FILE *out)
static void
find_formats(void)
{
+ struct list_head *item;
const struct ng_writer *wr = NULL;
char *mext = NULL;
char *aext = NULL;
- int w,v=-1,a=-1;
+ int v=-1,a=-1;
if (moviename) {
mext = strrchr(moviename,'.');
@@ -201,8 +203,8 @@ find_formats(void)
if (aext)
aext++;
}
- for (w = 0; NULL != ng_writers[w]; w++) {
- wr = ng_writers[w];
+ list_for_each(item,&ng_writers) {
+ wr = list_entry(item, struct ng_writer, list);
if (debug)
fprintf(stderr,"checking writer %s [%s] ...\n",wr->name,wr->desc);
if ((/*!wr->combined && */mext) || NULL != vfmt_name) {
@@ -268,7 +270,7 @@ find_formats(void)
}
break;
}
- if (NULL != ng_writers[w]) {
+ if (item != &ng_writers) {
writer = wr;
if (-1 != v) {
video.fmtid = wr->video[v].fmtid;
diff --git a/console/v4l-conf.c b/console/v4l-conf.c
index a17e416..e492644 100644
--- a/console/v4l-conf.c
+++ b/console/v4l-conf.c
@@ -224,7 +224,7 @@ displayinfo_dga(Display *dpy, struct DISPLAYINFO *d)
{
#ifdef HAVE_LIBXXF86DGA
int width,bar,foo,major,minor,flags=0;
- void *base = 0;
+ void *base = NULL;
if (!XF86DGAQueryExtension(dpy,&foo,&bar)) {
fprintf(stderr,"WARNING: Your X-Server has no DGA support.\n");
@@ -238,7 +238,7 @@ displayinfo_dga(Display *dpy, struct DISPLAYINFO *d)
fprintf(stderr,"WARNING: No DGA support available for this display.\n");
return;
}
- XF86DGAGetVideoLL(dpy,XDefaultScreen(dpy),(int*)&base,&width,&foo,&bar);
+ XF86DGAGetVideoLL(dpy,XDefaultScreen(dpy),(void*)&base,&width,&foo,&bar);
d->bpl = width * d->bpp/8;
d->base = base;
#else
diff --git a/console/v4l-info.c b/console/v4l-info.c
index 0f184b2..38659cf 100644
--- a/console/v4l-info.c
+++ b/console/v4l-info.c
@@ -29,7 +29,7 @@ static int dump_v4l(int fd, int tab)
struct video_picture picture;
struct video_buffer buffer;
struct video_window window;
- int i;
+ unsigned int i;
printf("general info\n");
memset(&capability,0,sizeof(capability));
diff --git a/console/webcam.c b/console/webcam.c
index 4baf12a..8ddc107 100644
--- a/console/webcam.c
+++ b/console/webcam.c
@@ -42,8 +42,8 @@ int grab_height = 240;
int grab_delay = 3;
int grab_wait = 0;
int grab_rotate = 0;
-int grab_top = 0;
-int grab_left = 0;
+int grab_top = -1;
+int grab_left = -1;
int grab_bottom = -1;
int grab_right = -1;
int grab_quality= 75;
@@ -726,15 +726,24 @@ main(int argc, char *argv[])
grab_dist_sensorw = i;
if (-1 != (i = cfg_get_int("grab","distor_sensorh")))
grab_dist_sensorh = i;
-
- if ( grab_top < 0 ) grab_top = 0;
- if ( grab_left < 0 ) grab_left = 0;
- if ( grab_bottom > grab_height ) grab_bottom = grab_height;
- if ( grab_right > grab_width ) grab_right = grab_width;
- if ( grab_bottom < 0 ) grab_bottom = grab_height;
- if ( grab_right < 0 ) grab_right = grab_width;
- if ( grab_top >= grab_bottom ) grab_top = 0;
- if ( grab_left >= grab_right ) grab_left = 0;
+
+ /* defaults */
+ if (grab_top < 0) grab_top = 0;
+ if (grab_left < 0) grab_left = 0;
+ if (grab_bottom < 0) grab_bottom = grab_height;
+ if (grab_right < 0) grab_right = grab_width;
+
+ if (grab_bottom > grab_height) grab_bottom = grab_height;
+ if (grab_right > grab_width) grab_right = grab_width;
+
+ if (grab_top >= grab_bottom) {
+ fprintf(stderr, "config error: top must be smaller than bottom\n");
+ exit(1);
+ }
+ if (grab_left >= grab_right) {
+ fprintf(stderr, "config error: left must be smaller than right\n");
+ exit(1);
+ }
if (grab_dist_k < 1 || grab_dist_k > 10000)
grab_dist_k = 700;

Privacy Policy