From owner-freebsd-firewire@FreeBSD.ORG Fri Aug 29 16:28:33 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 D4E941065675 for ; Fri, 29 Aug 2008 16:28:33 +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 1C2C88FC16 for ; Fri, 29 Aug 2008 16:28:29 +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 m7TGS9a82586; Fri, 29 Aug 2008 09:28:09 -0700 (PDT) (envelope-from freebsd@sopwith.solgatos.com) Received: from localhost by sopwith.solgatos.com (8.8.8/6.24) id QAA13259; Fri, 29 Aug 2008 16:26:53 GMT Message-Id: <200808291626.QAA13259@sopwith.solgatos.com> To: Sean Bruno In-reply-to: Your message of "Thu, 28 Aug 2008 16:49:05 PDT." <48B73971.90706@miralink.com> Date: Fri, 29 Aug 2008 09:26:53 +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: Fri, 29 Aug 2008 16:28:33 -0000 I looked at the changes NetBSD made to fwcontrol.c with the idea of tweaking FreeBSD's version so it would compile on both OSes. Below is a patch that might be enough. They made more changes than this. Some are clearly not essential (whitespace, putting the usage message into alphabetical order, ...), some I'm not sure about so I left them out for now. The full set of changes they did can be viewed by diffing FreeBSD cvs 1.23 with NetBSD cvs 1.7. It still compiles fine on FreeBSD 7.0 amd64, (and the getprogname() thing works) I haven't tried NetBSD yet. =================================================================== RCS file: RCS/fwcontrol.c,v retrieving revision 1.2.2.2 diff -u -r1.2.2.2 fwcontrol.c --- fwcontrol.c 2008/08/29 15:50:16 1.2.2.2 +++ fwcontrol.c 2008/08/29 16:00:48 @@ -32,8 +32,10 @@ * SUCH DAMAGE. */ +#if defined(__FreeBSD__) #include __FBSDID("$FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23.2.1 2008/05/02 06:15:58 simokawa 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" @@ -84,7 +97,8 @@ "\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); } @@ -981,8 +995,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 + } /*