个人工具

UbuntuHelp:Firewire

来自Ubuntu中文

跳转至: 导航, 搜索


There are three entries for 'FireWire'

  1. https://help.ubuntu.com/community/Firewire deals with 1394 video devices
  2. UbuntuStudioPreparation in the section Firewire (ieee1394 / raw1394) sound cards and cameras
  3. FireWire (FireWire Audio in Ubuntu Studio)

<<Include(Tag/ContentCleanup)>> There are two entries for 'Firewire/Wire' The second entry is here https://help.ubuntu.com/community/FireWire and deals with 1394 audio devices.

Capturing video over Firewire

Introduction

This page explains how to capture a Digital Video (DV) stream over IEEE1394 (Firewire) hardware with the Kino Video Editor.

Disclaimer

This section on using IEEE1394 is not written by a hardware expert. It probably contains mistakes. If you know something is wrong or missing please help improve this page for the next person by correcting it. DuncanLithgow

Requirements

Hardware

(The notes below were checked as valid on Ubuntu 9.10 Karmic.) Many more recent motherboards have one or more Firewire ports built-in. In order that the ports will actually function, they sometimes have to be enabled in the BIOS setup - look for a BIOS menu similar to "Configure Devices". If your computer has no Firewire port you can buy a PCI expansion card or PC Card. To check that the card is visible to the system, start a terminal and enter the lspci command; you should get output similar to:

joe@daedra:~$ lspci
...
02:00.0 FireWire (IEEE 1394): Agere Systems FW322/323 (rev 70)
02:02.0 FireWire (IEEE 1394): VIA Technologies, Inc. VT6306 Fire II IEEE 1394 OHCI Link Layer Controller (rev 46)
...

(The above motherboard has both a built-in Firewire port and a plug-in PCI Firewire card, each based on a different brand of chipset.) The Linux kernel also has to recognize that the chipset used in the installed device is supported and load the relevant drivers - if all is well this should happen automatically at boot time. To check that this has happened, look for messages containing "firewire" or "1394" in the kernel log. For example, from the terminal command line:

joe@daedra:~$ grep 1394 /var/log/kern.log
Mar 28 21:09:23 daedra kernel: [    3.472255] ohci1394 0000:02:00.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19
Mar 28 21:09:23 daedra kernel: [    3.529223] ohci1394: fw-host0: OHCI-1394 1.0 (PCI): IRQ=[19]  MMIO=[d3100000-d31007ff]  Max Packet=[2048]  IR/IT contexts=[8/8]
Mar 28 21:09:23 daedra kernel: [    3.541342] ohci1394 0000:02:02.0: PCI INT A -> GSI 20 (level, low) -> IRQ 20
Mar 28 21:09:23 daedra kernel: [    3.596058] ohci1394: fw-host1: OHCI-1394 1.0 (PCI): IRQ=[20]  MMIO=[d3101000-d31017ff]  Max Packet=[2048]  IR/IT contexts=[4/8]
Mar 28 21:09:23 daedra kernel: [    4.808048] ieee1394: Host added: ID:BUS[0-00:1023]  GUID[00902700022b5854]
Mar 28 21:09:23 daedra kernel: [    4.861202] ieee1394: Host added: ID:BUS[1-00:1023]  GUID[00110600000061ab]
Mar 28 21:09:23 daedra kernel: [    9.113163] ieee1394: raw1394: /dev/raw1394 device initialized

Messages similar to the above show that the Firewire interface has initialized and is ready for use.

Software

Several Linux distributions, including Ubuntu, do not support video capture via !FireWire by default, so you will need some extra software. The dvgrab package uses a device file (also known as a node) to act as an interface between your camera and video editor (in this case Kino) over the Firewire port. When you connect your camera and turn it on, the udev package should create one or more of the device files/nodes needed. The device file will be one of the following:

  • /dev/dv1394/0 (gives access to Firewire for video capture but not to the camera's controls)
  • /dev/raw1394 (gives raw access to Firewire and allows access to your cameras controls, but possesses a security risk)

Capturing DV over Firewire

Once Kino is ready to use capture should work as follows: 1.#1 Connect your DV camera via Firewire, turn the camera on and press 'play'. 1.#1 udev detects the change and creates the required device nodes for communication with your camera. 1.#1 Start Kino and switch to the 'Capture' tab. Kino sees the device nodes are created and that you have permission to use them. Once Kino has seen the camera you can rewind your camera to the beginning of the tape again.

Troubleshooting

In order to use a Firewire device successfully under Kino (or other software), all of the following have to happen:

  1. A Firewire interface must be correctly installed and enabled,
  2. the kernel must recognize it as supported and load the appropriate modules to initialise it, and
  3. the initialization must succeed.
  4. When a Firewire camcorder or camera is plugged in and powered up, the resulting hotplug event must be seen by the kernel and the device be identified as supported, and
  5. the software must be running with the appropriate privileges to be granted the necessary device permissions.

For steps 1 - 3, see the above Hardware section notes. If the hotplug step succeeds, you should see messages ending in success in kern.log, similar to:

Mar 28 15:03:10 daedra kernel: [  942.303168] ieee1394: The root node is not cycle master capable; selecting a new root node and resetting...
Mar 28 15:03:11 daedra kernel: [  943.231135] ieee1394: Error parsing configrom for node 1-00:1023
Mar 28 15:03:12 daedra kernel: [  943.901133] ieee1394: Error parsing configrom for node 1-01:1023
Mar 28 15:03:14 daedra kernel: [  946.232094] ieee1394: Node added: ID:BUS[1-00:1023]  GUID[00008500014c65d3]
Mar 28 15:03:14 daedra kernel: [  946.232319] ieee1394: Node changed: 1-00:1023 -> 1-01:1023

If no messages appear on hotplug or camcorder switch-on, check the following points:

  • Is the camcorder set to VCR or playback mode?
  • Is the camcorder's Firewire port (might be labeled IEEE1394, iLink or DV) enabled? Check the camcorder manual carefully and look for a relevant Enable option in the camcorder's settings menu.
  • Is your Firewire lead in good order and firmly plugged in at both ends?
  • Is the firewire port damaged? This is unfortunately not hard to do, this writer has burned out ports both on his camcorder and two different hard disk drives by injudicious hotplugging. Managing to get the 6-way connector even partly inserted the wrong way round is likely to spell immediate death for the port on the other end, as 12V is applied to signal lines. It is highly advisable to attach the cable when the device and PC are both powered down, and power up the camcorder only when you are ready to start capturing.

If Ubuntu doesn't automatically create a device node you can force the creation by typing the following in a Terminal:

gksudo modprobe raw1394
gksudo modprobe dv1394

However, these drivers should already be loaded automatically when the camcorder was plugged in/ switched on. If they were not auto-loaded, and the above tips do not identify the problem, then there is a lower-level problem and it may be time to seek help at the linux1394-user mailing list. For device/ software permissions issues, read on.

Before Ubuntu 7.10 (Gutsy)

/dev/dv1394/0 has been the preferred method in Ubuntu as discussed in Launchpad Bug# 6290. Some versions of Kino from before Ubuntu 7.10 (Gutsy) may try /dev/raw1394 by default though, which will fail for a normal user. You will see the error:

WARNING: raw1394 kernel module not loaded or failure to read/write /dev/raw1394!

This is not a bug, but a security measure which you can read about in an email about firewire security from Scott James Remnant. This email paints an incomplete picture though. The actual risks of user access to raw1394 are:

  • It allows direct control of !FireWire-attached devices. (However, in order to do something really dangerous like overwriting device firmware or reading/modifying data from a !FireWire storage device, the user would need non-trivial purpose-made software.)
  • It may allow read/write access to memory of other PCs which are plugged into the !FireWire bus together with this PC which runs raw1394. Whether such access is possible and to which extent depends on the remote PC's operating system and hardware platform.
  • It may allow read/write access to memory of this PC if you have more than one !FireWire controller and plug them together to a single bus. This depends on settings of the ohci1394 kernel driver and on the hardware platform of this PC.

An easy way around this for a user who is also the administrator of the computer is to run Kino from the command line as root:

gksudo kino

However, running complex application software as root has its own dangers and should be avoided. Therefore, read further below for the steps necessary to allow normal users access to /dev/raw1394. Another note on !FireWire security: If you are afraid that others access your computer by plugging something (another PC) into your PC's !FireWire port and running forensic tools, then you need to unload the ohci1394 driver, at least while you leave your PC unsupervised. !FireWire security will be addressed in future releases by means of new improved kernel drivers: https://blueprints.launchpad.net/ubuntu/+spec/firewire-core

Ubuntu 7.10 (Gutsy Gibbon)

This version of Ubuntu and Kino only works for /dev/raw1394 - only available to root users. Connect and start your camera, start Kino as root and switch to the 'Capture' tab.

Ubuntu 8.04 (Hardy Heron)

For this release Kino has changed their setup so that use of /dev/dv1394/0 is not enabled by default. Instead /dev/raw1394 is prefered. Because of this change Kino has been compiled incorrectly for use in Ubuntu, and only works for /dev/raw1394 - only available to root users. A correctly compiled version is available here: kino_1.3.0-2ubuntu0_i386.deb. This version will not install on Ubuntu 8.10.

Ubuntu 8.10 (Intrepid Ibix)

This version of Ubuntu and Kino has been compiled incorrectly, and only works for /dev/raw1394 - only available to root users. Connect and start your camera, start Kino as root and switch to the 'Capture' tab.

Other methods

Method 1. 'raw1394'

This method makes a new group called firewire with control of the raw1394 device file, and your user a member of that group. The camcoder must be plugged in and turned on at boot time for this to work because udev will only create /dev/raw1394 if the camcoder is present and /dev/raw1394 must be created before bootmisc.sh is run.

  1. Open 'System > Administration > Users and Groups'. Add a new group and call it firewire
  2. Open the firewire group and add your user name to this group.
  3. Open a terminal and type
    sudo gedit /etc/init.d/bootmisc.sh
    
  4. At the end of the file type
    chgrp firewire /dev/raw1394
    
  5. Reboot, or to apply changes now type directly in a terminal
    sudo chgrp firewire /dev/raw1394
    
  6. Insure camcorder is connected and turned on before the system is booted.

Method 2. 'Desktop Launcher'

Create a Desktop launcher named "EnableCamcorderConnection". Set the launcher type to "Application In terminal" and the launcher command to "sudo chmod 666 /dev/raw1394". Execute the launcher after plugging in the camcorder.

Method 3. 'udev rule'

As the most straight-forward method, simply add the raw1394 specific udev rule which was left out by Ubuntu's udev maintainers. Type this in a terminal:

echo 'KERNEL=="raw1394", GROUP="video", MODE="0664"' > /tmp/raw1394.rules
sudo cp /tmp/raw1394.rules /etc/udev/rules.d/
rm /tmp/raw1394.rules

Then unload and reload raw1394,

 modprobe -r raw1394 && modprobe raw1394

and type in a terminal:

sudo /etc/init.d/udev restart

In Ubuntu 10.04

Paste this in your terminal:

echo 'KERNEL=="raw1394", GROUP="video", MODE="0664"' |
sudo tee /etc/udev/rules.d/50-raw1394.rules
&& sudo restart udev

If the tips in this guide do not work please file a bug in launchpad against Kino.

See Also

Page janitor: DuncanLithgow