From bugmaster at FreeBSD.org Mon Sep 1 11:06:54 2008 From: bugmaster at FreeBSD.org (FreeBSD bugmaster) Date: Mon Sep 1 11:07:38 2008 Subject: Current problem reports assigned to freebsd-firewire@FreeBSD.org Message-ID: <200809011106.m81B6rBr068404@freefall.freebsd.org> Current FreeBSD problem reports Critical problems Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/74238 firewire [firewire] fw_rcv: unknown response; firewire ad-hoc w 1 problem total. Non-critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/113785 firewire [firewire] dropouts when playing DV on firewire 1 problem total. From freebsd at sopwith.solgatos.com Sat Sep 6 22:23:18 2008 From: freebsd at sopwith.solgatos.com (Dieter) Date: Sat Sep 6 22:23:24 2008 Subject: New and improved? patch [ fwcontrol ] In-Reply-To: Your message of "Sun, 31 Aug 2008 13:05:44 BST." Message-ID: <200809062222.WAA13366@sopwith.solgatos.com> > > 7.0 AMD64 # ./fwcontrol -f -5 > > fwcontrol: main:set_root_node out of range: No such file or directory > > > > "No such file or directory" seems wrong > > err(EX_USAGE, "%s:set_root_node out of range", __func__); > > Err() is correct for places where errno would be set, such as > checking the return code from read(2). But for the range checks, > errno does not apply, so err() gives misleading results. > > The err(3) man page isn't clear, but it looks like errx(3) is > the function you want for the range checks. > > Changing err() to errx() gives: > > 7.0 AMD64 # ./fwcontrol -f 70 > fwcontrol: main:set_root_node out of range Also, I'm thinking we probably don't want "\n" in the err() and errx() calls, since they put that in automagically. When a file cannot be opened, it is useful to print the name of the file. int len=1024, i; if ((file = fopen(filename, "r")) == NULL) - err(1, "load_crom"); + err(1, "load_crom filename = %s", filename); for (i = 0; i < len/(4*8); i ++) { fscanf(file, DUMP_FORMAT, p, p+1, p+2, p+3, p+4, p+5, p+6, p+7); if (open_dev(&fd, devbase) < 0) { - errx(EX_IOERR, "%s: Error opening board #%d\n", __func__, current_board); + err(EX_IOERR, "%s: Error opening firewire controller #%d %s ", + __func__, current_board, devbase); } } /* Since open_dev() calls open(2), which sets errno, this time we want err(3) rather than errx(3). From sbruno at miralink.com Sun Sep 7 02:19:59 2008 From: sbruno at miralink.com (Sean Bruno) Date: Sun Sep 7 02:20:06 2008 Subject: New and improved? patch In-Reply-To: <200808311934.TAA10392@sopwith.solgatos.com> References: <200808311934.TAA10392@sopwith.solgatos.com> Message-ID: <48C33A35.6090203@miralink.com> > usage: > >> [-f force_root ] >> > > Suggestion: [-f force_root_node ] or maybe "desired_root_node" or maybe > "root_node" or maybe just "node", same as -c -d -o -s > > I think the variable name is fine, but the man page should be expanded. >> -g: broadcast gap_count by phy_config packet >> > > Suggestion: -g: set gap_count by broadcasting phy_config packet > or maybe just: -g: set gap_count > I agree. The description is deficient and should not only be expanded, but should reference the IEEE specifications, i.e. 1394a-2005 >> -f: broadcast force_root by phy_config packet >> > > Suggestion: -f force a node to become the root node by broadcasting phy_config packet > or maybe just: -f force a node to become the root node > > 7.0 AMD64 # ./fwcontrol -f -5 > fwcontrol: main:set_root_node out of range: No such file or directory > > "No such file or directory" seems wrong > > 7.0 AMD64 # ./fwcontrol -g 70 > fwcontrol: main:set_gap_count out of range: No such file or directory > > "No such file or directory" seems wrong > > 7.0 AMD64 # ./fwcontrol -d 70 > fwcontrol: no such node -1. > > (a) 70 becomes -1 ? > (b) Wouldn't -d have the same range as -f ? > > 7.0 AMD64 # ./fwcontrol -c 70 > fwcontrol: no such node -1. > > (a) 70 becomes -1 ? > (b) Wouldn't -c have the same range as -f ? > > 7.0 AMD64 # ./fwcontrol -o 70 > fwcontrol: main: node out of range: 70 > : No such file or directory > > "No such file or directory" seems wrong > > 7.0 AMD64 # ./fwcontrol -s 70 > fwcontrol: main: node out of range: 70 > : No such file or directory > > "No such file or directory" seems wrong > > > > - asyreq->pkt.mode.ld[1] |= (root_node & 0x3f) << 24 | 1 << 23; > + asyreq->pkt.mode.ld[1] |= ((root_node << 24) | (1 << 23)); > if (gap_count >= 0) > - asyreq->pkt.mode.ld[1] |= 1 << 22 | (gap_count & 0x3f) << 16; > + asyreq->pkt.mode.ld[1] |= ((1 << 22) | (gap_count << 16)); > > Any reason for pulling out the "& 0x3f" ? Yeah it should be redundant > now that there is range checking on the arguments, but as you said, > fwcontrol is dangerous and the mask makes it safer at very little cost. > > > I find a range check to be an easier reference than a bit mask/shift operation. I'd like the next guy who comes through the code to be able to understand the changes and the code path. Also, more comments are probably required. > - for (i = 0; i < 4; i++) { > - snprintf(name, sizeof(name), "%s.%d", devbase, i); > - if ((*fd = open(name, O_RDWR)) >= 0) > - break; > - } > + *fd = open(devname, O_RDWR); > > > Looking at various firewire man pages, I don't find any explanation of > the various /dev filenames, such as what the .%d part was/is for. So I > have no clue why this code was changed. Did I miss a discussion? > I'm going to have to put a big "I have no idea" here. This predates my attempts at stabilization. Let's examine it further in the driver code. Perhaps that will explain it's use. -- Sean Bruno MiraLink Corporation 6015 NE 80th Ave, Ste 100 Portland, OR 97218 Cell 503-358-6832 Phone 503-621-5143 Fax 503-621-5199 MSN: sbruno@miralink.com Google: seanwbruno@gmail.com From sbruno at miralink.com Sun Sep 7 02:20:36 2008 From: sbruno at miralink.com (Sean Bruno) Date: Sun Sep 7 02:20:42 2008 Subject: New and improved? patch In-Reply-To: <200808312005.UAA08072@sopwith.solgatos.com> References: <200808312005.UAA08072@sopwith.solgatos.com> Message-ID: <48C33A73.80504@miralink.com> Dieter wrote: >> 7.0 AMD64 # ./fwcontrol -f -5 >> fwcontrol: main:set_root_node out of range: No such file or directory >> >> "No such file or directory" seems wrong >> > > err(EX_USAGE, "%s:set_root_node out of range", __func__); > > Err() is correct for places where errno would be set, such as > checking the return code from read(2). But for the range checks, > errno does not apply, so err() gives misleading results. > > The err(3) man page isn't clear, but it looks like errx(3) is > the function you want for the range checks. > > Changing err() to errx() gives: > > 7.0 AMD64 # ./fwcontrol -f 70 > fwcontrol: main:set_root_node out of range > Yup. I completely agree here. -- Sean Bruno MiraLink Corporation 6015 NE 80th Ave, Ste 100 Portland, OR 97218 Cell 503-358-6832 Phone 503-621-5143 Fax 503-621-5199 MSN: sbruno@miralink.com Google: seanwbruno@gmail.com From freebsd at sopwith.solgatos.com Sun Sep 7 06:28:51 2008 From: freebsd at sopwith.solgatos.com (Dieter) Date: Sun Sep 7 06:28:57 2008 Subject: New and improved? patch In-Reply-To: Your message of "Sat, 06 Sep 2008 19:19:33 PDT." <48C33A35.6090203@miralink.com> Message-ID: <200809070624.GAA22550@sopwith.solgatos.com> > > - for (i = 0; i < 4; i++) { > > - snprintf(name, sizeof(name), "%s.%d", devbase, i); > > - if ((*fd = open(name, O_RDWR)) >= 0) > > - break; > > - } > > + *fd = open(devname, O_RDWR); > > > > > > > Looking at various firewire man pages, I don't find any explanation of > > the various /dev filenames, such as what the .%d part was/is for. So I > > have no clue why this code was changed. Did I miss a discussion? > > > I'm going to have to put a big "I have no idea" here. This predates my > attempts > at stabilization. Let's examine it further in the driver code. Perhaps > that will explain it's use. I've been working on getting your new fwcontrol to compile and run on NetBSD. Looks like FreeBSD used to use /dev/fw0.0 but now uses fw0, which...is...a symlink to fw0.0. I only have .0 no .[123] NetBSD still uses fw0.0, MAKEDEV doesn't create the symlink. So now you know why I noticed that fwcontrol doesn't tell you what filename it couldn't open. :-) Still no idea what the trailing digit is for, or why the fwcontrol code was changed. From bugmaster at FreeBSD.org Mon Sep 8 02:22:19 2008 From: bugmaster at FreeBSD.org (FreeBSD bugmaster) Date: Mon Sep 8 02:22:54 2008 Subject: Current problem reports assigned to freebsd-firewire@FreeBSD.org Message-ID: <200809080222.m882MIUM006651@freefall.freebsd.org> The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/113785 firewire [firewire] dropouts when playing DV on firewire o kern/74238 firewire [firewire] fw_rcv: unknown response; firewire ad-hoc w 2 problems total. Bugs can be in one of several states: o - open A problem report has been submitted, no sanity checking performed. a - analyzed The problem is understood and a solution is being sought. f - feedback Further work requires additional information from the originator or the community - possibly confirmation of the effectiveness of a proposed solution. p - patched A patch has been committed, but some issues (MFC and / or confirmation from originator) are still open. r - repocopy The resolution of the problem report is dependent on a repocopy operation within the CVS repository which is awaiting completion. s - suspended The problem is not being worked on, due to lack of information or resources. This is a prime candidate for somebody who is looking for a project to do. If the problem cannot be solved at all, it will be closed, rather than suspended. c - closed A problem report is closed when any changes have been integrated, documented, and tested -- or when fixing the problem is abandoned. From bugmaster at FreeBSD.org Mon Sep 15 15:18:47 2008 From: bugmaster at FreeBSD.org (FreeBSD bugmaster) Date: Mon Sep 15 15:19:36 2008 Subject: Current problem reports assigned to freebsd-firewire@FreeBSD.org Message-ID: <200809151518.m8FFIkXp018856@freefall.freebsd.org> Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/113785 firewire [firewire] dropouts when playing DV on firewire o kern/74238 firewire [firewire] fw_rcv: unknown response; firewire ad-hoc w 2 problems total. From bugmaster at FreeBSD.org Mon Sep 22 11:06:52 2008 From: bugmaster at FreeBSD.org (FreeBSD bugmaster) Date: Mon Sep 22 11:07:09 2008 Subject: Current problem reports assigned to freebsd-firewire@FreeBSD.org Message-ID: <200809221106.m8MB6pxQ015344@freefall.freebsd.org> Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/113785 firewire [firewire] dropouts when playing DV on firewire o kern/74238 firewire [firewire] fw_rcv: unknown response; firewire ad-hoc w 2 problems total. From freebsd at sopwith.solgatos.com Thu Sep 25 00:41:23 2008 From: freebsd at sopwith.solgatos.com (Dieter) Date: Thu Sep 25 00:41:29 2008 Subject: patch for fwcontrol Message-ID: <200809250040.AAA28891@sopwith.solgatos.com> The patch below: Fixes several err() vs errx() errors Improves some range checks Improves some messages Supports NetBSD in addition to FreeBSD =================================================================== RCS file: RCS/fwcontrol.c,v retrieving revision 1.1 diff -u -r1.1 fwcontrol.c --- fwcontrol.c 2008/09/24 21:41:13 1.1 +++ fwcontrol.c 2008/09/24 23:55:16 @@ -32,8 +32,10 @@ * SUCH DAMAGE. */ +#if defined(__FreeBSD__) #include __FBSDID("$FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.25 2008/09/10 18:09:52 sbruno Exp $"); +#endif #include #include @@ -42,11 +44,22 @@ #include #include #include +#if defined(__FreeBSD__) #include #include #include #include #include +#elif defined(__NetBSD__) +#include "eui64.h" +#include +#include +#include +#include +#else +#warning "You need to add support for your OS" +#endif + #include #include @@ -66,7 +79,7 @@ usage(void) { fprintf(stderr, - "fwcontrol [-u bus_num] [-prt] [-c node] [-d node] [-o node] [-s node]\n" + "%s [-u bus_num] [-prt] [-c node] [-d node] [-o node] [-s node]\n" "\t [-l file] [-g gap_count] [-f force_root ] [-b pri_req]\n" "\t [-M mode] [-R filename] [-S filename] [-m EUI64 | hostname]\n" "\t-u: specify bus number\n" @@ -78,13 +91,14 @@ "\t-o: send link-on packet to the node\n" "\t-s: write RESET_START register on the node\n" "\t-l: load and parse hex dump file of configuration ROM\n" - "\t-g: broadcast gap_count by phy_config packet\n" - "\t-f: broadcast force_root by phy_config packet\n" + "\t-g: set gap count\n" + "\t-f: force root node\n" "\t-b: set PRIORITY_BUDGET register on all supported nodes\n" "\t-M: specify dv or mpeg\n" "\t-R: Receive DV or MPEG TS stream\n" "\t-S: Send DV stream\n" - "\t-m: set fwmem target\n"); + "\t-m: set fwmem target\n" + , getprogname() ); exit(EX_USAGE); } @@ -488,7 +502,7 @@ int len=1024, i; if ((file = fopen(filename, "r")) == NULL) - err(1, "load_crom"); + err(1, "load_crom %s", filename); for (i = 0; i < len/(4*8); i ++) { fscanf(file, DUMP_FORMAT, p, p+1, p+2, p+3, p+4, p+5, p+6, p+7); @@ -691,7 +705,7 @@ */ len = read(fd, buf, RECV_NUM_PACKET * RECV_PACKET_SZ); if (len < 0) - err(EX_IOERR, "%s: error reading from device\n", __func__); + err(EX_IOERR, "%s: error reading from device", __func__); ptr = (u_int32_t *) buf; ciph = (struct ciphdr *)(ptr + 1); @@ -757,7 +771,7 @@ if (argc < 2) { for (current_board = 0; current_board < MAX_BOARDS; current_board++) { - snprintf(devbase, sizeof(devbase), "%s%d", device_string, current_board); + snprintf(devbase, sizeof(devbase), "%s%d.0", device_string, current_board); if (open_dev(&fd, devbase) < 0) { if (current_board == 0) { usage(); @@ -777,7 +791,7 @@ case 'b': priority_budget = strtol(optarg, NULL, 0); if (priority_budget < 0 || priority_budget > INT32_MAX) - errx(EX_USAGE, "%s: invalid number: %s", __func__, optarg); + errx(EX_USAGE, "%s: priority_budget out of range: %s", __func__, optarg); command_set = true; open_needed = true; display_board_only = false; @@ -787,7 +801,7 @@ if (crom_string == NULL) err(EX_SOFTWARE, "%s:crom_string malloc", __func__); if ( (strtol(crom_string, NULL, 0) < 0) || strtol(crom_string, NULL, 0) > MAX_BOARDS) - err(EX_USAGE, "%s:Invalid value for node", __func__); + errx(EX_USAGE, "%s:Invalid value for node", __func__); strcpy(crom_string, optarg); display_crom = 1; open_needed = true; @@ -808,7 +822,7 @@ #define MAX_PHY_CONFIG 0x3f set_root_node = strtol(optarg, NULL, 0); if ( (set_root_node < 0) || (set_root_node > MAX_PHY_CONFIG) ) - err(EX_USAGE, "%s:set_root_node out of range", __func__); + errx(EX_USAGE, "%s:set_root_node out of range", __func__); open_needed = true; command_set = true; display_board_only = false; @@ -816,7 +830,7 @@ case 'g': set_gap_count = strtol(optarg, NULL, 0); if ( (set_gap_count < 0) || (set_gap_count > MAX_PHY_CONFIG) ) - err(EX_USAGE, "%s:set_gap_count out of range", __func__); + errx(EX_USAGE, "%s:set_gap_count out of range", __func__); open_needed = true; command_set = true; display_board_only = false; @@ -834,12 +848,12 @@ display_board_only = false; if (eui64_hostton(optarg, &target) != 0 && eui64_aton(optarg, &target) != 0) - err(EX_USAGE, "%s: invalid target: %s", __func__, optarg); + errx(EX_USAGE, "%s: invalid target: %s", __func__, optarg); break; case 'o': send_link_on = str2node(fd, optarg); - if ( (send_link_on < 0) || (send_link_on > INT32_MAX) ) - err(EX_USAGE, "%s: node out of range: %s\n",__func__, optarg); + if ( (send_link_on < 0) || (send_link_on > MAX_PHY_CONFIG) ) + errx(EX_USAGE, "%s: node out of range: %s\n",__func__, optarg); open_needed = true; command_set = true; display_board_only = false; @@ -858,8 +872,8 @@ break; case 's': send_reset_start = str2node(fd, optarg); - if ( (send_reset_start < 0) || (send_reset_start > INT32_MAX) ) - err(EX_USAGE, "%s: node out of range: %s\n", __func__, optarg); + if ( (send_reset_start < 0) || (send_reset_start > MAX_PHY_CONFIG) ) + errx(EX_USAGE, "%s: node out of range: %s\n", __func__, optarg); open_needed = true; command_set = true; display_board_only = false; @@ -924,9 +938,9 @@ * */ if(open_needed){ - snprintf(devbase, sizeof(devbase), "%s%d", device_string, current_board); + snprintf(devbase, sizeof(devbase), "%s%d.0", device_string, current_board); if (open_dev(&fd, devbase) < 0) { - errx(EX_IOERR, "%s: Error opening board #%d\n", __func__, current_board); + err(EX_IOERR, "%s: Error opening firewire controller #%d %s", __func__, current_board, devbase); } } /* @@ -996,8 +1010,16 @@ if (set_fwmem_target) { eui.hi = ntohl(*(u_int32_t*)&(target.octet[0])); eui.lo = ntohl(*(u_int32_t*)&(target.octet[4])); +#if defined(__FreeBSD__) sysctl_set_int("hw.firewire.fwmem.eui64_hi", eui.hi); sysctl_set_int("hw.firewire.fwmem.eui64_lo", eui.lo); +#elif defined(__NetBSD__) + sysctl_set_int("hw.fwmem.eui64_hi", eui.hi); + sysctl_set_int("hw.fwmem.eui64_lo", eui.lo); +#else +#warning "You need to add support for your OS" +#endif + } /* @@ -1028,9 +1050,9 @@ recvfn = detect_recv_fn(fd, TAG | CHANNEL); close(fd); } - snprintf(devbase, sizeof(devbase), "%s%d", device_string, current_board); + snprintf(devbase, sizeof(devbase), "%s%d.0", device_string, current_board); if (open_dev(&fd, devbase) < 0) - errx(EX_IOERR, "%s: Error opening board #%d in recv_data\n", __func__, current_board); + err(EX_IOERR, "%s: Error opening firewire controller #%d %s in recv_data\n", __func__, current_board, devbase); (*recvfn)(fd, recv_data, TAG | CHANNEL, -1); free(recv_data); } =================================================================== RCS file: RCS/fwmpegts.c,v retrieving revision 1.1 diff -u -r1.1 fwmpegts.c --- fwmpegts.c 2008/09/06 06:24:16 1.1 +++ fwmpegts.c 2008/09/06 06:25:51 @@ -52,8 +52,16 @@ #include #include +#if defined(__FreeBSD__) #include #include +#elif defined(__NetBSD__) +#include +#include +#else +#warning "You need to add support for your OS" +#endif + #include "fwmethods.h" From bugmaster at FreeBSD.org Mon Sep 29 11:06:50 2008 From: bugmaster at FreeBSD.org (FreeBSD bugmaster) Date: Mon Sep 29 11:07:29 2008 Subject: Current problem reports assigned to freebsd-firewire@FreeBSD.org Message-ID: <200809291106.m8TB6nbK040773@freefall.freebsd.org> Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/113785 firewire [firewire] dropouts when playing DV on firewire o kern/74238 firewire [firewire] fw_rcv: unknown response; firewire ad-hoc w 2 problems total.