Date: Sat, 2 Jan 2010 10:35:39 -0500 (EST) From: george+freebsd@m5p.com To: freebsd-multimedia@freebsd.org Subject: Fix fwcontrol -R <filename> Message-ID: <201001021535.o02FZdl8051879@m5p.com>
next in thread | raw e-mail | index | archive | help
Between FreeBSD 7.0 and 7.1, fwcontrol -R <filename> 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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001021535.o02FZdl8051879>