From owner-freebsd-multimedia@FreeBSD.ORG Sat Jan 2 15:35:51 2010 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E5811106568B for ; Sat, 2 Jan 2010 15:35:51 +0000 (UTC) (envelope-from george@m5p.com) Received: from mailhost.m5p.com (unknown [IPv6:2001:418:3fd::3]) by mx1.freebsd.org (Postfix) with ESMTP id 6A7D88FC1A for ; Sat, 2 Jan 2010 15:35:51 +0000 (UTC) Received: from m5p.com (backup.m5p.com [IPv6:2001:418:3fd::f3]) by mailhost.m5p.com (8.14.3/8.14.3) with ESMTP id o02FZjYX081437 for ; Sat, 2 Jan 2010 10:35:50 -0500 (EST) (envelope-from george@m5p.com) Received: (from george@localhost) by m5p.com (8.14.3/8.13.7/Submit) id o02FZdl8051879; Sat, 2 Jan 2010 10:35:39 -0500 (EST) Date: Sat, 2 Jan 2010 10:35:39 -0500 (EST) Message-Id: <201001021535.o02FZdl8051879@m5p.com> From: george+freebsd@m5p.com To: freebsd-multimedia@freebsd.org X-Spam-Score: -0.513 () AWL, BAYES_00, FH_DATE_PAST_20XX, J_CHICKENPOX_42, NO_RELAYS X-Scanned-By: MIMEDefang 2.64 on IPv6:2001:418:3fd::f7 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (mailhost.m5p.com [IPv6:2001:418:3fd::f7]); Sat, 02 Jan 2010 10:35:50 -0500 (EST) Subject: Fix fwcontrol -R X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jan 2010 15:35:52 -0000 Between FreeBSD 7.0 and 7.1, fwcontrol -R for storing digital video from a firewire source stopped working. Last night, I got tired of running my old 7.0 binary and debugged the problem. The attached patch fixes it. The first change is a minor enhancement for convenience, so you don't have to type the command and start the video source at the same instant. The second and third changes fix the real problem. -- George Mitchell --- usr.sbin/fwcontrol/fwcontrol.c.orig 2009-04-14 23:14:26.000000000 -0400 +++ usr.sbin/fwcontrol/fwcontrol.c 2010-01-01 21:21:11.000000000 -0500 @@ -703,9 +703,18 @@ * return the total length read, not the value * of the last uiomove(). */ - len = read(fd, buf, RECV_NUM_PACKET * RECV_PACKET_SZ); - if (len < 0) - err(EX_IOERR, "%s: error reading from device", __func__); + while (1) { + len = read(fd, buf, RECV_NUM_PACKET * RECV_PACKET_SZ); + if (len < 0) { + if (errno == EAGAIN) { + fprintf(stderr, "(EAGAIN) - push 'Play'?\n"); + fflush(stderr); + continue; + } + err(EX_IOERR, "%s: error reading from device", __func__); + } + else break; + } ptr = (u_int32_t *) buf; ciph = (struct ciphdr *)(ptr + 1); @@ -912,7 +921,7 @@ if (recv_data == NULL) err(EX_SOFTWARE, "%s:recv_data malloc", __func__); strcpy(recv_data, optarg); - open_needed = false; + open_needed = true; command_set = true; display_board_only = false; break; @@ -1065,6 +1074,7 @@ if (recvfn == NULL) { /* guess... */ recvfn = detect_recv_fn(fd, TAG | CHANNEL); close(fd); + fd = -1; } snprintf(devbase, sizeof(devbase), "%s%d.0", device_string, current_board); if (open_dev(&fd, devbase) < 0)