1.\" $NetBSD: fwctl.8,v 1.17 2014/03/18 18:20:46 riastradh Exp $ 2.\" 3.\" Copyright (c) 2005 KIYOHARA Takashi 4.\" All rights reserved. 5.\" 6.\" Copyright (c) 2002 Hidetoshi Shimokawa 7.\" All rights reserved. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 22.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 26.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 27.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.\" $FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.8,v 1.21 2007/10/31 05:59:17 brueffer Exp $ 31.\" 32.Dd August 24, 2010 33.Dt FWCTL 8 34.Os 35.Sh NAME 36.Nm fwctl 37.Nd IEEE1394 control utility 38.Sh SYNOPSIS 39.Nm 40.Op Fl prt 41.Op Fl b Ar pri_req 42.Op Fl c Ar node 43.Op Fl d Ar node 44.Op Fl g Ar gap_count 45.Op Fl l Ar file 46.Op Fl M Ar mode 47.Op Fl m Ar EUI64 | hostname 48.Op Fl o Ar node 49.Op Fl R Ar filename 50.Op Fl S Ar filename 51.Op Fl s Ar node 52.Op Fl u Ar bus_num 53.Sh DESCRIPTION 54The 55.Nm 56utility is designed to provide a way for users to access and control 57the 58.Nx 59IEEE1394 subsystem. 60Without options, 61.Nm 62will output a list of devices that are/were connected to the bus. 63.Pp 64The following options are available: 65.Bl -tag -width XmXEUI64XhostnameXX -offset indent 66.It Fl b Ar pri_req 67Set the 68.Dv PRIORITY_BUDGET 69register on all supported nodes. 70.It Fl c Ar node 71Show the configuration ROM on the node. 72.It Fl d Ar node 73Hex dump of the configuration ROM. 74.It Fl f Ar node 75Force specified 76.Ar node 77to be the root node on the next bus reset by sending a PHY config packet. 78Valid values are 0 - 63. 79.It Fl g Ar gap_count 80Broadcast new 81.Ar gap_count 82by phy_config packet. 83By default this value is 63 on all nodes. 84Valid values are 0 - 63. 85.It Fl i Ar pri_req 86Set the 87.Dv PRIORITY_BUDGET 88register on all supported nodes. 89.It Fl l Ar file 90Load hex dump file of the configuration ROM and parse it. 91.It Fl M Ar mode 92Explicitly specify either 93.Ar dv 94or 95.Ar mpeg 96mode for the incoming stream. 97Only meaningful in case of and must precede the 98.Fl R 99option. 100If not specified, the program will try to guess. 101In case of 102.Dq format 0x20 103error, try to force the 104.Ar mpeg 105mode. 106.It Fl m Ar EUI64 | hostname 107Set default fwmem target. 108Hostname will be converted to EUI64. 109.It Fl o Ar node 110Send a link-on PHY packet to the node. 111.It Fl p 112Dump PHY registers. 113.It Fl R Ar filename 114Receive DV or MPEG TS stream and dump it to a file. 115Use Ctrl-C to stop receiving. 116Some DV cameras seem not to send the stream if a bus manager exits. 117If you cannot get the stream, try the following commands: 118.Bd -literal -offset indent 119sysctl hw.ieee1394if.try_bmr=0 120fwctl -r 121.Ed 122.Pp 123The resulting file contains raw DV data excluding isochronous header 124and CIP header. 125It can be handled by the 126.Pa pkgsrc/multimedia/libdv 127package. 128The resulting MPEG TS stream can be played and sent over a network using 129the VideoLAN tool 130.Pa ( pkgsrc/multimedia/vlc ) . 131The stream can be piped directly to 132.Nm vlc , 133see 134.Sx EXAMPLES . 135.It Fl r 136Initiate bus reset. 137.It Fl S Ar filename 138Send a DV file as isochronous stream. 139.It Fl s Ar node 140Write to the 141.Dv RESET_START 142register on the node. 143.It Fl t 144Show the topology map. 145.It Fl u Ar bus_num 146Specify the IEEE1394 bus number to be operated on. 147The default is bus 0. 148.El 149.Sh FILES 150.Bl -tag 151.It Pa /dev/fw0.0 152.El 153.Sh EXAMPLES 154Each DV frame has a fixed size and it is easy to edit the frame order. 155.Pp 156.Dl "fwctl -R original.dv" 157.Pp 158Receive a DV stream with DV camera attached. 159.Pp 160.Dl "dd if=original.dv of=first.dv bs=120000 count=30" 161.Pp 162Get first 30 frames (NTSC). 163.Pp 164.Dl "dd if=original.dv of=second.dv bs=120000 skip=30 count=30" 165.Pp 166Get second 30 frames (NTSC). 167.Pp 168.Dl "cat second.dv first.dv | fwctl -S /dev/stdin" 169.Pp 170Swap first and second 30 frames and send them to DV recorder. 171.Pp 172For PAL, replace 173.Dq Li bs=120000 174with 175.Dq Li bs=144000 . 176.Pp 177.Dl "fwctl -R file.m2t" 178.Pp 179Receive an MPEG TS stream from a camera producing MPEG transport stream. 180This has been tested with SONY HDR-FX1E camera that produces HD 181MPEG-2 stream at 25 Mbps bandwidth. 182.Pp 183To send the stream from the camera over the network using TCP (which 184surprisingly works better with vlc), you can use 185.Dl "fwctl -R - | nc 192.168.10.11 9000" 186with 187.Pa pkgsrc/net/netcat 188and to receive the stream, use 189.Dl nc -l -p 9000 | vlc - 190.Pp 191To netcast via UDP, you need to use 192.Pa pkgsrc/misc/buffer , 193since vlc is not fast enough to read UDP packets from 194buffers and thus it experiences dropouts when run directly. 195The sending side can use 196.Dl "fwctl -R - | nc 192.168.10.11 9000" 197and to receive the stream, use 198.Dl nc -l -u -p 9000 | buffer -s 10k -b 1000 -m 20m -p 5 | vlc - 199.Pp 200For more information on how to work with 201.Nm vlc 202see its documentation. 203.Sh SEE ALSO 204.Xr mplayer 1 , 205.Xr vlc 1 , 206.Xr fwip 4 , 207.Xr fwohci 4 , 208.Xr ieee1394if 4 , 209.Xr sbp 4 210.Sh HISTORY 211The 212.Nm 213command first appeared in 214.Fx 5.0 , 215as 216.Ic fwcontrol . 217It was added to 218.Nx 4.0 219under its present name. 220.Sh AUTHORS 221.An Hidetoshi Shimokawa Aq Mt simokawa@FreeBSD.org 222.An Petr Holub Aq Mt hopet@ics.muni.cz 223- MPEG TS mode. 224.An KIYOHARA Takashi Aq Mt kiyohara@NetBSD.org 225.Sh BUGS 226This utility is still under development and provided for debugging 227purposes. 228Especially MPEG TS reception support is very rudimental and supports only 229high-bandwidth MPEG-2 streams (fn field in CIP header equals 3). 230