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