diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-09-24 10:35:08 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-09-24 10:35:08 -0300 |
commit | ec1abc6d3b2508366efa97c0f3f08078902e47ac (patch) | |
tree | 62bc233c7f844731de7d63d8466aa857fb43a31c /v4l2-apps/lib/libv4l/libv4l1 | |
parent | e25691821b5e4762b3e642f3f78a1327aa5f6767 (diff) | |
parent | 37365f711151fceee2bbc87ef7836c5f08b7c1f1 (diff) | |
download | mediapointer-dvb-s2-ec1abc6d3b2508366efa97c0f3f08078902e47ac.tar.gz mediapointer-dvb-s2-ec1abc6d3b2508366efa97c0f3f08078902e47ac.tar.bz2 |
merge: http://linuxtv.org/hg/~hgoede/v4l-dvb
From: Mauro Carvalho Chehab <mchehab@redhat.com>
Priority: normal
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'v4l2-apps/lib/libv4l/libv4l1')
-rw-r--r-- | v4l2-apps/lib/libv4l/libv4l1/libv4l1.c | 15 | ||||
-rw-r--r-- | v4l2-apps/lib/libv4l/libv4l1/log.c | 6 |
2 files changed, 16 insertions, 5 deletions
diff --git a/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c b/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c index 39f2d29e0..797c8768a 100644 --- a/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c +++ b/v4l2-apps/lib/libv4l/libv4l1/libv4l1.c @@ -259,6 +259,15 @@ int v4l1_open (const char *file, int oflag, ...) struct v4l2_format fmt2; struct v4l2_input input2; struct v4l2_standard standard2; + int v4l_device = 0; + + /* check if we're opening a video4linux2 device */ + if (!strncmp(file, "/dev/video", 10) || !strncmp(file, "/dev/v4l/", 9)) { + /* Some apps open the device read only, but we need rw rights as the + buffers *MUST* be mapped rw */ + oflag = (oflag & ~O_ACCMODE) | O_RDWR; + v4l_device = 1; + } /* original open code */ if (oflag & O_CREAT) @@ -276,11 +285,7 @@ int v4l1_open (const char *file, int oflag, ...) fd = syscall(SYS_open, file, oflag); /* end of original open code */ - if (fd == -1) - return fd; - - /* check if we're opening a video4linux2 device */ - if (strncmp(file, "/dev/video", 10) && strncmp(file, "/dev/v4l/", 9)) + if (fd == -1 || !v4l_device) return fd; /* check that this is an v4l2 device, no need to emulate v4l1 on diff --git a/v4l2-apps/lib/libv4l/libv4l1/log.c b/v4l2-apps/lib/libv4l/libv4l1/log.c index 74ce0f20b..9ff0cea46 100644 --- a/v4l2-apps/lib/libv4l/libv4l1/log.c +++ b/v4l2-apps/lib/libv4l/libv4l1/log.c @@ -66,6 +66,7 @@ static const char *v4l1_ioctls[] = { void v4l1_log_ioctl(unsigned long int request, void *arg, int result) { const char *ioctl_str = "unknown"; + char buf[40]; if (!v4l1_log_file) return; @@ -77,6 +78,11 @@ void v4l1_log_ioctl(unsigned long int request, void *arg, int result) if (_IOC_TYPE(request) == 'v' && _IOC_NR(request) < ARRAY_SIZE(v4l1_ioctls)) ioctl_str = v4l1_ioctls[_IOC_NR(request)]; + else { + snprintf(buf, sizeof(buf), "unknown request: %c %d\n", + (int)_IOC_TYPE(request), (int)_IOC_NR(request)); + ioctl_str = buf; + } fprintf(v4l1_log_file, "request == %s\n", ioctl_str); |