From owner-freebsd-firewire@FreeBSD.ORG Thu Aug 28 23:14:35 2008 Return-Path: Delivered-To: freebsd-firewire@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 050F91065691 for ; Thu, 28 Aug 2008 23:14:35 +0000 (UTC) (envelope-from freebsd@sopwith.solgatos.com) Received: from parsely.rain.com (parsely.rain.com [199.26.172.196]) by mx1.freebsd.org (Postfix) with ESMTP id 4DCD58FC0A for ; Thu, 28 Aug 2008 23:14:33 +0000 (UTC) (envelope-from freebsd@sopwith.solgatos.com) Received: from sopwith.solgatos.com (uucp@localhost) by parsely.rain.com (8.11.4/8.11.4) with UUCP id m7SNEQ580567; Thu, 28 Aug 2008 16:14:26 -0700 (PDT) (envelope-from freebsd@sopwith.solgatos.com) Received: from localhost by sopwith.solgatos.com (8.8.8/6.24) id XAA17597; Thu, 28 Aug 2008 23:13:29 GMT Message-Id: <200808282313.XAA17597@sopwith.solgatos.com> To: Sean Bruno In-reply-to: Your message of "Mon, 11 Aug 2008 18:07:03 PDT." <48A0E237.5020702@miralink.com> Date: Thu, 28 Aug 2008 16:13:29 +0100 From: Dieter Cc: freebsd-firewire@freebsd.org Subject: Re: This is where I'm going with fwcontrol X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Aug 2008 23:14:35 -0000 While looking at the code and wondering what "adjust_gap_count" had to do with cyclemaster mode, I noticed that -f was setting the 2nd argument to send_phy_config(int fd, int root_node, int gap_count) which is root_node, not gap_count. I also noticed that send_phy_config() does (root_node & 0x3f), so having the range check be 0x3f rather than INT32_MAX seems to make sense. I haven't yet figured out exactly which 7 bits this stuff is actually setting. So does the following look like an improvement (however minor) to anyone else, or just me? :-) @@ -730,7 +730,7 @@ bool dump_phy_reg = false; int32_t priority_budget = -1; - int32_t adjust_gap_count = -1; + int32_t set_root_node = -1; int32_t reset_gap_count = -1; int32_t send_link_on = -1; int32_t send_reset_start = -1; @@ -790,9 +790,9 @@ display_board_only = false; break; case 'f': - adjust_gap_count = strtol(optarg, NULL, 0); - if ( (adjust_gap_count < 0) || (adjust_gap_count > INT32_MAX) ) - err(EX_USAGE, "%s:adjust_gap_count out of range", __func__); + set_root_node = strtol(optarg, NULL, 0); + if ( (set_root_node < 0) || (set_root_node > 0x3f) ) + err(EX_USAGE, "%s:set_root_node out of range", __func__); open_needed = true; command_set = true; display_board_only = false; @@ -961,8 +961,8 @@ /* * Adjust the gap count for this card/bus to value "-f" */ - if (adjust_gap_count >= 0) - send_phy_config(fd, adjust_gap_count, -1); + if (set_root_node >= 0) + send_phy_config(fd, set_root_node, -1); /* * Reset the gap count for this card/bus "-g"