New dvb-s2 tuner, and a hack to get remaining remotes working
Juergen Lock
nox at jelal.kn-bremen.de
Tue Feb 1 12:31:50 UTC 2011
On Tue, Feb 01, 2011 at 12:12:40PM +0100, Hans Petter Selasky wrote:
> On Tuesday 01 February 2011 12:08:40 Juergen Lock wrote:
> > F_SETFL
>
> Try to change FIONBIO with F_SETFL in the patch.
Turns out FIONBIO was correct but I had to allow for FIOASYNC too:
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 || cmd == FIOASYNC)
+ 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));
That allowed the ioctl to complete and irrecord to wait for the
first button press, but then select() seems to misbehave: (I get an
endless loop of "Really read -1 bytes from '/dev/lirc0', expected 3"
until I hit ^c.)
[...]
10950 irrecord CALL select(0x5,0x7fffffffe5d0,0,0,0x7fffffffe650)
10950 irrecord RET select 1
10950 irrecord CALL read(0x4,0x7fffffffe660,0x3)
10950 irrecord RET read -1 errno 22 Invalid argument
10950 irrecord CALL clock_gettime(0xd,0x7fffffffe550)
10950 irrecord RET clock_gettime 0
10950 irrecord CALL write(0x2,0x7fffffffdee0,0xa)
10950 irrecord GIO fd 2 wrote 10 bytes
"irrecord: "
10950 irrecord RET write 10/0xa
10950 irrecord CALL write(0x2,0x7fffffffdfc0,0x32)
10950 irrecord GIO fd 2 wrote 50 bytes
"Really read -1 bytes from '/dev/lirc0', expected 3"
10950 irrecord RET write 50/0x32
10950 irrecord CALL write(0x2,0x8008599d7,0x1)
10950 irrecord GIO fd 2 wrote 1 byte
"
"
10950 irrecord RET write 1
10950 irrecord CALL select(0x5,0x7fffffffe5d0,0,0,0x7fffffffe650)
10950 irrecord RET select 1
10950 irrecord CALL read(0x4,0x7fffffffe660,0x3)
10950 irrecord RET read -1 errno 22 Invalid argument
10950 irrecord CALL clock_gettime(0xd,0x7fffffffe550)
10950 irrecord RET clock_gettime 0
10950 irrecord CALL write(0x2,0x7fffffffdee0,0xa)
10950 irrecord GIO fd 2 wrote 10 bytes
"irrecord: "
10950 irrecord RET write 10/0xa
10950 irrecord CALL write(0x2,0x7fffffffdfc0,0x32)
10950 irrecord GIO fd 2 wrote 50 bytes
"Really read -1 bytes from '/dev/lirc0', expected 3"
10950 irrecord RET write 50/0x32
10950 irrecord CALL write(0x2,0x8008599d7,0x1)
10950 irrecord GIO fd 2 wrote 1 byte
"
"
10950 irrecord RET write 1
10950 irrecord PSIG SIGINT SIG_DFL
More information about the freebsd-multimedia
mailing list