1a7a73b95SHidetoshi Shimokawa.\" Copyright (c) 2002 Hidetoshi Shimokawa 2a7a73b95SHidetoshi Shimokawa.\" All rights reserved. 3a7a73b95SHidetoshi Shimokawa.\" 4a7a73b95SHidetoshi Shimokawa.\" Redistribution and use in source and binary forms, with or without 5a7a73b95SHidetoshi Shimokawa.\" modification, are permitted provided that the following conditions 6a7a73b95SHidetoshi Shimokawa.\" are met: 7a7a73b95SHidetoshi Shimokawa.\" 1. Redistributions of source code must retain the above copyright 8a7a73b95SHidetoshi Shimokawa.\" notice, this list of conditions and the following disclaimer. 9a7a73b95SHidetoshi Shimokawa.\" 2. Redistributions in binary form must reproduce the above copyright 10a7a73b95SHidetoshi Shimokawa.\" notice, this list of conditions and the following disclaimer in the 11a7a73b95SHidetoshi Shimokawa.\" documentation and/or other materials provided with the distribution. 12a7a73b95SHidetoshi Shimokawa.\" 13a7a73b95SHidetoshi Shimokawa.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14a7a73b95SHidetoshi Shimokawa.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15a7a73b95SHidetoshi Shimokawa.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16a7a73b95SHidetoshi Shimokawa.\" DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 17a7a73b95SHidetoshi Shimokawa.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18a7a73b95SHidetoshi Shimokawa.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19a7a73b95SHidetoshi Shimokawa.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20a7a73b95SHidetoshi Shimokawa.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 21a7a73b95SHidetoshi Shimokawa.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 22a7a73b95SHidetoshi Shimokawa.\" ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23a7a73b95SHidetoshi Shimokawa.\" POSSIBILITY OF SUCH DAMAGE. 24a7a73b95SHidetoshi Shimokawa.\" 252cdb71a9SDaniel Gerzo.Dd September 12, 2008 26a7a73b95SHidetoshi Shimokawa.Dt FWCONTROL 8 27a7a73b95SHidetoshi Shimokawa.Os 28a7a73b95SHidetoshi Shimokawa.Sh NAME 29a7a73b95SHidetoshi Shimokawa.Nm fwcontrol 30a7a73b95SHidetoshi Shimokawa.Nd FireWire control utility 31a7a73b95SHidetoshi Shimokawa.Sh SYNOPSIS 32a7a73b95SHidetoshi Shimokawa.Nm 33abd538f2SHidetoshi Shimokawa.Op Fl u Ar bus_num 34a8587980SHidetoshi Shimokawa.Op Fl prt 35a7a73b95SHidetoshi Shimokawa.Op Fl c Ar node 36a7a73b95SHidetoshi Shimokawa.Op Fl d Ar node 37b92d9b2bSHidetoshi Shimokawa.Op Fl o Ar node 38b92d9b2bSHidetoshi Shimokawa.Op Fl s Ar node 39a7a73b95SHidetoshi Shimokawa.Op Fl l Ar file 40302176c7SHidetoshi Shimokawa.Op Fl f Ar node 41a7a73b95SHidetoshi Shimokawa.Op Fl g Ar gap_count 42a7a73b95SHidetoshi Shimokawa.Op Fl b Ar pri_req 436d815a7dSWarner Losh.Op Fl M Ar mode 44937bcaa8SHidetoshi Shimokawa.Op Fl R Ar filename 45937bcaa8SHidetoshi Shimokawa.Op Fl S Ar filename 461be7387cSHidetoshi Shimokawa.Op Fl m Ar EUI64 | hostname 47a7a73b95SHidetoshi Shimokawa.Sh DESCRIPTION 48a7a73b95SHidetoshi ShimokawaThe 49a7a73b95SHidetoshi Shimokawa.Nm 50a7a73b95SHidetoshi Shimokawautility is designed to provide a way for users to access and control the 51a7a73b95SHidetoshi Shimokawa.Fx 52a7a73b95SHidetoshi ShimokawaFireWire subsystem. 53e6aaafcdSHidetoshi ShimokawaWithout options, 54e6aaafcdSHidetoshi Shimokawa.Nm 55f937c268SRuslan Ermilovwill output a list of devices that are/were connected to the bus. 56a7a73b95SHidetoshi Shimokawa.Pp 57f937c268SRuslan ErmilovThe following options are available: 58a7a73b95SHidetoshi Shimokawa.Bl -tag -width indent 59abd538f2SHidetoshi Shimokawa.It Fl u Ar bus_num 602cdb71a9SDaniel GerzoSpecify the FireWire bus number to be operated on. 612cdb71a9SDaniel GerzoThe default is bus 0. 62a7a73b95SHidetoshi Shimokawa.It Fl r 63a7a73b95SHidetoshi ShimokawaInitiate bus reset. 64a7a73b95SHidetoshi Shimokawa.It Fl t 65a7a73b95SHidetoshi ShimokawaShow the topology map. 66a8587980SHidetoshi Shimokawa.It Fl p 67800b8436SRuslan ErmilovDump PHY registers. 68a7a73b95SHidetoshi Shimokawa.It Fl c Ar node 69a7a73b95SHidetoshi ShimokawaShow the configuration ROM on the node. 70a7a73b95SHidetoshi Shimokawa.It Fl d Ar node 71a7a73b95SHidetoshi ShimokawaHex dump of the configuration ROM. 72b92d9b2bSHidetoshi Shimokawa.It Fl o Ar node 7307958659SRuslan ErmilovSend a link-on PHY packet to the node. 74b92d9b2bSHidetoshi Shimokawa.It Fl s Ar node 7502704554SChristian BruefferWrite to the 76f937c268SRuslan Ermilov.Dv RESET_START 77f937c268SRuslan Ermilovregister on the node. 78a7a73b95SHidetoshi Shimokawa.It Fl l Ar file 79a7a73b95SHidetoshi ShimokawaLoad hex dump file of the configuration ROM and parse it. 80302176c7SHidetoshi Shimokawa.It Fl f Ar node 81302176c7SHidetoshi ShimokawaForce specified 82302176c7SHidetoshi Shimokawa.Ar node 837f1b527cSSean Brunoto be the root node on the next bus reset by sending a PHY config packet. 847f1b527cSSean BrunoValid values are 0 - 63. 85a7a73b95SHidetoshi Shimokawa.It Fl g Ar gap_count 867f1b527cSSean BrunoBroadcast new 87f937c268SRuslan Ermilov.Ar gap_count 887f1b527cSSean Brunoby sending a PHY_config packet. 897f1b527cSSean BrunoBy default this value is 63 on all nodes. 907f1b527cSSean BrunoValid values are 0 - 63. 91a7a73b95SHidetoshi Shimokawa.It Fl i Ar pri_req 9202704554SChristian BruefferSet the 93f937c268SRuslan Ermilov.Dv PRIORITY_BUDGET 94f937c268SRuslan Ermilovregister on all supported nodes. 956d815a7dSWarner Losh.It Fl M Ar mode 966d815a7dSWarner LoshExplicitly specify either 976d815a7dSWarner Losh.Ar dv 986d815a7dSWarner Loshor 996d815a7dSWarner Losh.Ar mpeg 1006d815a7dSWarner Loshmode for the incoming stream. 1019b3d1b02SYaroslav TykhiyOnly meaningful in case of and must precede the 1026d815a7dSWarner Losh.Fl R 1032cdb71a9SDaniel Gerzooption. 1042cdb71a9SDaniel GerzoIf not specified, the program will try to guess. 1052cdb71a9SDaniel GerzoIn case of 1062cdb71a9SDaniel Gerzo.Dq format 0x20 1072cdb71a9SDaniel Gerzoerror, try to force the 1082cdb71a9SDaniel Gerzo.Dq mpeg 1092cdb71a9SDaniel Gerzomode. 110937bcaa8SHidetoshi Shimokawa.It Fl R Ar filename 1116d815a7dSWarner LoshReceive DV or MPEG TS stream and dump it to a file. 1122cdb71a9SDaniel GerzoUse ^C to stop the receiving. 113302176c7SHidetoshi ShimokawaSome DV cameras seem not to send the stream if a bus manager exists. 1142cdb71a9SDaniel GerzoIf it is impossible to get the stream, try the following commands: 115937bcaa8SHidetoshi Shimokawa.Bd -literal -offset indent 116f937c268SRuslan Ermilovsysctl hw.firewire.try_bmr=0 117f937c268SRuslan Ermilovfwcontrol -r 118937bcaa8SHidetoshi Shimokawa.Ed 119013490c5SHidetoshi Shimokawa.Pp 12002704554SChristian BruefferThe resulting file contains raw DV data excluding isochronous header 121f937c268SRuslan Ermilovand CIP header. 122f937c268SRuslan ErmilovIt can be handled by 123f937c268SRuslan Ermilov.Nm libdv 124f937c268SRuslan Ermilovin the 125f937c268SRuslan Ermilov.Fx 1262cdb71a9SDaniel GerzoPorts Collection. 1272cdb71a9SDaniel GerzoResulting MPEG TS stream can be played and sent over a 1286d815a7dSWarner Loshnetwork using the VideoLAN 1296d815a7dSWarner Losh.Nm vlc 1306d815a7dSWarner Loshtool in the 1316d815a7dSWarner Losh.Fx 1322cdb71a9SDaniel GerzoPorts Collection. 1332cdb71a9SDaniel GerzoThe stream can be piped directly to 1346d815a7dSWarner Losh.Nm vlc, 1352cdb71a9SDaniel Gerzosee 1362cdb71a9SDaniel Gerzo.Sx EXAMPLES . 137937bcaa8SHidetoshi Shimokawa.It Fl S Ar filename 13802704554SChristian BruefferSend a DV file as isochronous stream. 1391be7387cSHidetoshi Shimokawa.It Fl m Ar EUI64 | hostname 1401a74e6a1SRuslan ErmilovSet default fwmem target. 1411a74e6a1SRuslan ErmilovHostname will be converted to EUI64 using 1421be7387cSHidetoshi Shimokawa.Xr eui64 5 . 143a7a73b95SHidetoshi Shimokawa.El 14459a3c79dSRuslan Ermilov.Sh FILES 145e1656a88SJoel Dahl.Bl -tag -width "Pa /dev/fw0.0" 14659a3c79dSRuslan Ermilov.It Pa /dev/fw0.0 14759a3c79dSRuslan Ermilov.El 148937bcaa8SHidetoshi Shimokawa.Sh EXAMPLES 14902704554SChristian BruefferEach DV frame has a fixed size and it is easy to edit the frame order. 150f937c268SRuslan Ermilov.Pp 151f937c268SRuslan Ermilov.Dl "fwcontrol -R original.dv" 152937bcaa8SHidetoshi Shimokawa.Pp 1536d815a7dSWarner LoshReceive a DV stream with DV camera attached. 154f937c268SRuslan Ermilov.Pp 155f937c268SRuslan Ermilov.Dl "dd if=original.dv of=first.dv bs=120000 count=30" 156937bcaa8SHidetoshi Shimokawa.Pp 157937bcaa8SHidetoshi ShimokawaGet first 30 frames(NTSC). 158f937c268SRuslan Ermilov.Pp 159f937c268SRuslan Ermilov.Dl "dd if=original.dv of=second.dv bs=120000 skip=30 count=30" 160937bcaa8SHidetoshi Shimokawa.Pp 161937bcaa8SHidetoshi ShimokawaGet second 30 frames(NTSC). 162f937c268SRuslan Ermilov.Pp 163f937c268SRuslan Ermilov.Dl "cat second.dv first.dv | fwcontrol -S /dev/stdin" 164937bcaa8SHidetoshi Shimokawa.Pp 165937bcaa8SHidetoshi ShimokawaSwap first and second 30 frames and send them to DV recorder. 166013490c5SHidetoshi Shimokawa.Pp 167f937c268SRuslan ErmilovFor PAL, replace 168f937c268SRuslan Ermilov.Dq Li bs=120000 169f937c268SRuslan Ermilovwith 170f937c268SRuslan Ermilov.Dq Li bs=144000 . 1716d815a7dSWarner Losh.Pp 172c2965cd1SJoel Dahl.Dl "fwcontrol -R file.m2t" 1736d815a7dSWarner Losh.Pp 1742cdb71a9SDaniel GerzoReceive an MPEG TS stream from a camera producing MPEG transport stream. 1752cdb71a9SDaniel GerzoThis has been tested with SONY HDR-FX1E camera that produces HD MPEG-2 1762cdb71a9SDaniel Gerzostream at 25 Mbps bandwidth. 1776d815a7dSWarner Losh.Pp 1782cdb71a9SDaniel GerzoTo send the stream from the camera over the network using TCP (which 179d4352d29SJoel Dahlsurprisingly works better with vlc), you can use 180c2965cd1SJoel Dahl.Dl "fwcontrol -R - | nc 192.168.10.11 9000" 1816d815a7dSWarner Loshwith 1826d815a7dSWarner Losh.Nm netcat 1836d815a7dSWarner Loshfrom ports and to receive the stream, use 1846d815a7dSWarner Losh.Dl nc -l -p 9000 | vlc - 1856d815a7dSWarner Losh.Pp 1866d815a7dSWarner LoshTo netcast via UDP, you need to use 1876d815a7dSWarner Losh.Nm buffer 1886d815a7dSWarner Loshprogram from ports, since vlc is not fast enough to read UDP packets from 1892cdb71a9SDaniel Gerzobuffers and thus it experiences dropouts when run directly. 1902cdb71a9SDaniel GerzoThe sending side can use 191c2965cd1SJoel Dahl.Dl "fwcontrol -R - | nc 192.168.10.11 9000" 1926d815a7dSWarner Loshand to receive the stream, use 1936d815a7dSWarner Losh.Dl nc -l -u -p 9000 | buffer -s 10k -b 1000 -m 20m -p 5 | vlc - 1946d815a7dSWarner Losh.Pp 1956d815a7dSWarner LoshFor more information on how to work with 1966d815a7dSWarner Losh.Nm vlc 1976d815a7dSWarner Loshsee its docs. 198a7a73b95SHidetoshi Shimokawa.Sh SEE ALSO 1990297fef0SChristian Brueffer.Xr mplayer 1 , 2000297fef0SChristian Brueffer.Xr vlc 1 , 201a7a73b95SHidetoshi Shimokawa.Xr firewire 4 , 202f937c268SRuslan Ermilov.Xr fwe 4 , 203eb1b84feSChristian Brueffer.Xr fwip 4 , 204a7a73b95SHidetoshi Shimokawa.Xr fwohci 4 , 2050297fef0SChristian Brueffer.Xr sbp 4 206a7a73b95SHidetoshi Shimokawa.Sh HISTORY 207a7a73b95SHidetoshi ShimokawaThe 208a7a73b95SHidetoshi Shimokawa.Nm 209a7a73b95SHidetoshi Shimokawautility first appeared in 210a7a73b95SHidetoshi Shimokawa.Fx 5.0 . 211a7a73b95SHidetoshi Shimokawa.Sh AUTHORS 212*01c2b8acSBaptiste Daroussin.An Hidetoshi Shimokawa Aq Mt simokawa@FreeBSD.org 213*01c2b8acSBaptiste Daroussin.An Petr Holub Aq Mt hopet@ics.muni.cz 214*01c2b8acSBaptiste Daroussin(MPEG TS mode) 215a7a73b95SHidetoshi Shimokawa.Sh BUGS 21602704554SChristian BruefferThis utility is still under development and provided for debugging purposes. 2176d815a7dSWarner LoshEspecially MPEG TS reception support is very rudimental and supports only 2186d815a7dSWarner Loshhigh-bandwidth MPEG-2 streams (fn field in CIP header equals 3). 219