Date: Tue, 1 Feb 2011 09:00:11 +0100 From: Hans Petter Selasky <hselasky@freebsd.org> To: freebsd-multimedia@freebsd.org Cc: Juergen Lock <nox@jelal.kn-bremen.de> Subject: Re: New dvb-s2 tuner, and a hack to get remaining remotes working Message-ID: <201102010900.11121.hselasky@freebsd.org> In-Reply-To: <20110131212710.GA85739@triton8.kn-bremen.de> References: <20110131212710.GA85739@triton8.kn-bremen.de>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Monday 31 January 2011 22:27:10 Juergen Lock wrote:
> (also copied below) - I wasn't able to test this with the lirc
> port yet (it complained that it can't set /dev/lirc0 to O_NONBLOCK),
Can you try the attached patch and report back?
--HPS
[-- Attachment #2 --]
Index: kernel/linux_file.c
===================================================================
--- kernel/linux_file.c (revision 1701)
+++ kernel/linux_file.c (working copy)
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009-2010 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2009-2011 Hans Petter Selasky. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,6 +26,8 @@
#include <sys/mman.h>
#include <sys/syscall.h>
+#include <cuse4bsd.h>
+
struct cdev_handle *
linux_open(int f_v4b, int fflags)
{
@@ -96,7 +98,7 @@
static void
linux_fix_f_flags(struct file *fp, int fflags)
{
- if (fflags & O_NONBLOCK) {
+ if (fflags & CUSE_FFLAG_NONBLOCK) {
if (!(fp->f_flags & O_NONBLOCK))
fp->f_flags |= O_NONBLOCK;
} else {
Index: webcamd.c
===================================================================
--- webcamd.c (revision 1701)
+++ webcamd.c (working copy)
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
+ * Copyright (c) 2010-2011 Hans Petter Selasky. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <sys/param.h>
#include <sys/time.h>
+#include <sys/filio.h>
#include <fcntl.h>
#include <unistd.h>
@@ -237,14 +238,20 @@
handle = cuse_dev_get_per_file_handle(cdev);
+ /* we support blocking/non-blocking I/O */
+ if (cmd == FIONBIO)
+ return (0);
+
/* execute ioctl */
error = linux_ioctl(handle, fflags & CUSE_FFLAG_NONBLOCK,
cmd, peer_data);
- if (cmd == VIDIOC_QUERYBUF) {
+ if ((cmd == VIDIOC_QUERYBUF) && (error >= 0)) {
- if (copy_from_user(&buf, peer_data, sizeof(buf)) != 0)
+ if (copy_from_user(&buf, peer_data, sizeof(buf)) != 0) {
+ error = -EFAULT;
goto done;
+ }
ptr = linux_mmap(handle, fflags, NULL,
buf.length, buf.m.offset);
@@ -255,8 +262,10 @@
buf.m.offset = 0x80000000UL;
}
- if (copy_to_user(peer_data, &buf, sizeof(buf)) != 0)
+ if (copy_to_user(peer_data, &buf, sizeof(buf)) != 0) {
+ error = -EFAULT;
goto done;
+ }
}
done:
return (v4b_convert_error(error));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102010900.11121.hselasky>
