Date: Wed, 11 Oct 2006 09:57:53 -0700 (PDT) From: Buzz Slye <buzz@gaia.arc.nasa.gov> To: mi+kde@aldan.algebra.com Cc: firewire@freebsd.org Subject: Libraw1394 on FreeBSD Message-ID: <Pine.GSO.4.62.0610110954010.28549@tioga.arc.nasa.gov>
next in thread | raw e-mail | index | archive | help
Mikhail: We have been using the libraw1394 and libdc1394 successfully on FreeBSD for several years now. Libdc1394 is easily ported from Linux to FreeBSD. However, the Linux libraw1394 should be completely scrapped as the ioctl's and underlying support are completely different. Main.c, iso.c, and readwrite.c must be rewritten. Fortunately, this is much easier to do on BSD. For example, the incoming packets may handled with (suprise) a read. Following is an example of iso.c. Robert Slye Code: SGE / 242-4 NASA - Ames Research Center Moffett Field, CA 94035 (650) 604-3329 /* * libraw1394 - library for raw access to the 1394 bus with the Linux subsystem. * * Copyright (C) 1999,2000,2001,2002 Andreas Bombe * new ISO API by Dan Maas * * This library is licensed under the GNU Lesser General Public License (LGPL), * version 2.1 or later. See the file COPYING.LIB in the distribution for * details. * * Rewritten for FreeBSD - R E Slye - 6/23/04 * Most of the original code for Linux is not supported and is deleted. * This code may be used for receiving the iso stream download of a single * image from a digital camera. Stream xmit is not supported. */ #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <unistd.h> #include <string.h> #include <fcntl.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/poll.h> #include "raw1394.h" #include "kernel-raw1394.h" #include "raw1394_private.h" extern int _dc1394_video_iso_handler(raw1394handle_t handle, int channel, size_t length, quadlet_t *data); /** * raw1394_start_iso_rcv - enable isochronous receiving * @channel: channel number to start receiving on * * Enables the reception of isochronous packets in @channel on @handle. * Isochronous packets are then passed to the callback specified with * _dc1394_video_iso_handler(). **/ int raw1394_start_iso_rcv(struct raw1394_handle *handle, unsigned int channel) { int size, rc; quadlet_t fwbuf[1026]; while (1) { if ((size = read(handle->fd, fwbuf, sizeof(fwbuf))) < 0) { printf(" rv = %d errno = %d\n", size, errno); return (-1); } rc = _dc1394_video_iso_handler(handle, channel, size, fwbuf); if (rc < 0) return (-1); else if (rc > 0) break; } return 0; } /** * raw1394_stop_iso_rcv - stop isochronous receiving * @channel: channel to stop receiving on * * Stops the reception of isochronous packets in @channel on @handle. **/ int raw1394_stop_iso_rcv(struct raw1394_handle *handle, unsigned int channel) { /* I don't know how to stop receiving on channel */ return 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.62.0610110954010.28549>