Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Aug 2007 11:55:38 +0900
From:      "Hidetoshi Shimokawa" <simokawa@FreeBSD.ORG>
To:        "Daniel O'Connor" <doconnor@gsoft.com.au>
Cc:        freebsd-current@freebsd.org, Harald Schmalzbauer <h.schmalzbauer@omnisec.de>
Subject:   Re: firewire problem (root node is not cycle master capable)
Message-ID:  <626eb4530708221955p3dd65df6h31e5b7cc79e8ced6@mail.gmail.com>
In-Reply-To: <200708182340.00680.doconnor@gsoft.com.au>
References:  <200708100010.46487.h.schmalzbauer@omnisec.de> <200708100052.39861.h.schmalzbauer@omnisec.de> <626eb4530708091703j18bd2cd7w99f9b96a3f3c402c@mail.gmail.com> <200708182340.00680.doconnor@gsoft.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Sure, please find attached a patch.

On 8/18/07, Daniel O'Connor <doconnor@gsoft.com.au> wrote:
> On Fri, 10 Aug 2007, Hidetoshi Shimokawa wrote:
> > On 8/10/07, Harald Schmalzbauer <h.schmalzbauer@omnisec.de> wrote:
> > > Am Freitag, 10. August 2007 00:23:41 schrieb Hidetoshi Shimokawa:
> > > > Basically, you don't need the cycle master for sbp devices.
> > > > Try the following.
> > > >
> > > > 1. fwcontrol -r
> > > > 2. fwcontrol -f 0 -r
> > >
> > > Hm, I think that's a typo, the man page doesn't show "-f" nor does
> > > my fwcontrol understand it.
> >
> > Oops, it was an uncommited option in my repository which sends
> > force_root packets.
>
> Any chance you can post a diff? I see this on a remote machine and would
> like to try it.
>
> --
> Daniel O'Connor software and network engineer
> for Genesis Software - http://www.gsoft.com.au
> "The nice thing about standards is that there
> are so many of them to choose from."
>   -- Andrew Tanenbaum
> GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
> _______________________________________________
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
>


-- 
/\ Hidetoshi Shimokawa
\/  simokawa@FreeBSD.ORG

[-- Attachment #2 --]
Index: fwcontrol.8
===================================================================
RCS file: /home/ncvs/src/usr.sbin/fwcontrol/fwcontrol.8,v
retrieving revision 1.18
diff -u -r1.18 fwcontrol.8
--- fwcontrol.8	29 Dec 2006 13:08:46 -0000	1.18
+++ fwcontrol.8	22 Mar 2007 15:26:40 -0000
@@ -39,6 +39,7 @@
 .Op Fl o Ar node
 .Op Fl s Ar node
 .Op Fl l Ar file
+.Op Fl f Ar node
 .Op Fl g Ar gap_count
 .Op Fl b Ar pri_req
 .Op Fl M Ar mode
@@ -77,6 +78,10 @@
 register on the node.
 .It Fl l Ar file
 Load hex dump file of the configuration ROM and parse it.
+.It Fl f Ar node
+Force specified
+.Ar node
+to be the root node on the next bus reset.
 .It Fl g Ar gap_count
 Broadcast
 .Ar gap_count
@@ -98,7 +103,7 @@
 .It Fl R Ar filename
 Receive DV or MPEG TS stream and dump it to a file.
 Use Ctrl-C to stop the receiving.
-Some DV cameras seem not to send the stream if a bus manager exits.
+Some DV cameras seem not to send the stream if a bus manager exists.
 If you cannot get the stream, try the following commands:
 .Bd -literal -offset indent
 sysctl hw.firewire.try_bmr=0
Index: fwcontrol.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/fwcontrol/fwcontrol.c,v
retrieving revision 1.23
diff -u -r1.23 fwcontrol.c
--- fwcontrol.c	26 Oct 2006 22:33:38 -0000	1.23
+++ fwcontrol.c	22 Mar 2007 15:57:43 -0000
@@ -64,10 +64,12 @@
 usage(void)
 {
 	fprintf(stderr,
-		"fwcontrol [-u bus_num] [-rt] [-g gap_count] [-o node] "
+		"fwcontrol [-u bus_num] [-rt] [-f node] [-g gap_count] "
+		    "[-o node] "
 		    "[-b pri_req] [-c node] [-d node] [-l file] "
 		    "[-R file] [-S file] [-m target]\n"
 		"\t-u: specify bus number\n"
+		"\t-f: broadcast force_root by phy_config packet\n"
 		"\t-g: broadcast gap_count by phy_config packet\n"
 		"\t-o: send link-on packet to the node\n"
 		"\t-s: write RESET_START register on the node\n"
@@ -153,20 +155,23 @@
 	struct fw_devlstreq *data;
 	struct fw_devinfo *devinfo;
 	struct eui64 eui;
-	char addr[EUI64_SIZ];
+	char addr[EUI64_SIZ], hostname[40];
 	int i;
 
 	data = get_dev(fd);
 	printf("%d devices (info_len=%d)\n", data->n, data->info_len);
-	printf("node           EUI64          status\n");
+	printf("node           EUI64          status    hostname\n");
 	for (i = 0; i < data->info_len; i++) {
 		devinfo = &data->dev[i];
 		fweui2eui64(&devinfo->eui, &eui);
 		eui64_ntoa(&eui, addr, sizeof(addr));
-		printf("%4d  %s %6d\n",
+	        if (eui64_ntohost(hostname, sizeof(hostname), &eui))
+			hostname[0] = 0;
+		printf("%4d  %s %6d    %s\n",
 			(devinfo->status || i == 0) ? devinfo->dst : -1,
 			addr,
-			devinfo->status
+			devinfo->status,
+			hostname
 		);
 	}
 	free((void *)data);
@@ -198,7 +203,7 @@
 
 	qld = (u_int32_t *)&asyreq->pkt;
 	if (!readmode)
-		asyreq->pkt.mode.wreqq.data = data;
+		asyreq->pkt.mode.wreqq.data = htonl(data);
 
 	if (ioctl(fd, FW_ASYREQ, asyreq) < 0) {
        		err(1, "ioctl");
@@ -471,16 +476,42 @@
 	printf("crc_len: %d generation:%d node_count:%d sid_count:%d\n",
 		tmap->crc_len, tmap->generation,
 		tmap->node_count, tmap->self_id_count);
-	printf("id link gap_cnt speed delay cIRM power port0 port1 port2"
-		" ini more\n");
+	printf("id  link gap speed delay cIRM power ini more  "
+		"ports          00 01 02\n");
+	printf("    "
+		"                                          "
+		"03 04 05 06 07 08 09 10\n");
+#if 0
+	printf("                                              "
+		"11 12 13 14 15 16 17 18\n");
+	printf("                                              "
+		"19 20 21 22 23 24 25 26\n");
+#endif
+	printf("-----------------------------------"
+		"-----------------------------------\n");
 	for (i = 0; i < tmap->crc_len - 2; i++) {
 		sid = tmap->self_id[i];
 		if (sid.p0.sequel) {
-			printf("%02d sequel packet\n", sid.p0.phy_id);
+			printf("%2d(%d)"
+				"                                      "
+				"%d   "
+				"%s  %s  %s  %s  %s  %s  %s  %s\n",
+				sid.p1.phy_id,
+				sid.p1.sequence_num,
+				sid.p1.more_packets,
+				port_status[sid.p1.porta],
+				port_status[sid.p1.portb],
+				port_status[sid.p1.portc],
+				port_status[sid.p1.portd],
+				port_status[sid.p1.porte],
+				port_status[sid.p1.portf],
+				port_status[sid.p1.portg],
+				port_status[sid.p1.porth]
+			);
 			continue;
 		}
-		printf("%02d   %2d      %2d  %4s     %d    %d   %3s"
-				"     %s     %s     %s   %d    %d\n",
+		printf("%2d    %2d  %2d  %4s     %d    %d   %3s   %d    %d"
+				"                  %s  %s  %s\n",
 			sid.p0.phy_id,
 			sid.p0.link_active,
 			sid.p0.gap_count,
@@ -488,11 +519,11 @@
 			sid.p0.phy_delay,
 			sid.p0.contender,
 			pwr_class[sid.p0.power_class],
+			sid.p0.initiated_reset,
+			sid.p0.more_packets,
 			port_status[sid.p0.port0],
 			port_status[sid.p0.port1],
-			port_status[sid.p0.port2],
-			sid.p0.initiated_reset,
-			sid.p0.more_packets
+			port_status[sid.p0.port2]
 		);
 	}
 	free(tmap);
@@ -676,7 +707,7 @@
 		list_dev(fd);
 	}
 
-	while ((ch = getopt(argc, argv, "M:g:m:o:s:b:prtc:d:l:u:R:S:")) != -1)
+	while ((ch = getopt(argc, argv, "M:f:g:m:o:s:b:prtc:d:l:u:R:S:")) != -1)
 		switch(ch) {
 		case 'b':
 			tmp = strtol(optarg, NULL, 0);
@@ -697,6 +728,11 @@
 			get_crom(fd, tmp, crom_buf, len);
 			dump_crom(crom_buf);
 			break;
+		case 'f':
+			tmp = strtol(optarg, NULL, 0);
+			open_dev(&fd, devbase);
+			send_phy_config(fd, tmp, -1);
+			break;
 		case 'g':
 			tmp = strtol(optarg, NULL, 0);
 			open_dev(&fd, devbase);

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?626eb4530708221955p3dd65df6h31e5b7cc79e8ced6>