Date: Tue, 1 Feb 2011 13:30:54 +0100 From: Juergen Lock <nox@jelal.kn-bremen.de> To: Hans Petter Selasky <hselasky@freebsd.org> Cc: freebsd-multimedia@freebsd.org, Juergen Lock <nox@jelal.kn-bremen.de> Subject: Re: New dvb-s2 tuner, and a hack to get remaining remotes working Message-ID: <20110201123054.GA10962@triton8.kn-bremen.de> In-Reply-To: <201102011212.40488.hselasky@freebsd.org> References: <20110131212710.GA85739@triton8.kn-bremen.de> <201102010900.11121.hselasky@freebsd.org> <20110201110840.GA8591@triton8.kn-bremen.de> <201102011212.40488.hselasky@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110201123054.GA10962>