Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Nov 2002 14:01:54 -0800 (PST)
From:      Buzz Slye <buzz@gaia.arc.nasa.gov>
To:        freebsd-firewire@freebsd.org
Subject:   Howto send inquiry orb
Message-ID:  <Pine.GSO.4.44.0211121359250.1154-200000@mono.arc.nasa.gov>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hi,

I am trying to run a Kodak camera from the firewire with the attached program.
(I am currently debugging the packet sending using an Oxford disk).
The attached progam is attempting to send a command orb inquiry to the
device.

da4 at sbp0 bus 0 target 0 lun 0
da4: <Oxford S (null) 0000> Fixed Simplified Direct Access SCSI-4 device
sbp0:0:0 XPT_GET_TRAN_SETTINGS:.
sbp0:0:0 XPT_PATH_INQ:.
da4: 50.000MB/s transfers
da4: 28615MB (58605120 512 byte sectors: 255H 63S/T 3648C)

After the login, running the program, the response I get is:

fw_rcv: unknown response tcode=2 src=0xffc1 tl=20 rt=1 data=0x84516ce3
try ad-hoc work around!!
no use...

Apparently, the response destination does not agree with the original source.

Questions.

    What to use for ---.mode.wreqb.src ?

    What about dest_lo ?

    Is wreqb the correct mode ?

    Where does the response go ?

Thanx,

        Robert Slye   MS 242-4
        NASA/Ames Research Center
        Moffett Field, CA 94035

        buzz@gaia.arc.nasa.gov



[-- Attachment #2 --]
/*
 * $Id Firewire test program - res  10/30/02
 */
/* Kodak */
/* #define  DEVICE_EUI_HI 0x00e0263d */
/* #define  DEVICE_EUI_LO 0x000065e2 */

/* Oxford */
#define  DEVICE_EUI_HI 0x0030e000
#define  DEVICE_EUI_LO 0x0000019e

#include <sys/param.h>
#include <sys/malloc.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/uio.h>
#include "/sys/dev/firewire/firewire.h"

#include <fcntl.h>
#include <stdio.h>
#include <err.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>

int
main(int argc, char **argv)
{
	int fd;
	char *fwdev;
        struct fw_asyreq *asyreq;
	int buf[32];
	int *response;

	fwdev = "/dev/fw1";
	printf("  Opening device %s\n", fwdev);
	if ((fd = open(fwdev, O_RDWR)) < 0)
		err(1, "Can't open fwdev");

	printf("  Allocating %d bytes for asyreq\n", sizeof(struct fw_asyreq));
        asyreq = (struct fw_asyreq *) malloc(sizeof(struct fw_asyreq));
	memset(asyreq, 0, sizeof(struct fw_asyreq));

	asyreq->req.type = FWASREQEUI;
	asyreq->req.sped = FWSPD_S400;
	asyreq->req.len = 120;
	asyreq->req.dst.eui.hi = DEVICE_EUI_HI;
	asyreq->req.dst.eui.lo = DEVICE_EUI_LO;

	response = &buf[0];
	asyreq->pkt.mode.common.tcode = FWTCODE_WREQB;
	asyreq->pkt.mode.wreqb.len = htons(24);
	asyreq->pkt.mode.wreqb.dest_lo = htonl((int)response);
	asyreq->pkt.mode.wreqb.payload[0] = htonl(1 << 31);
	asyreq->pkt.mode.wreqb.payload[3] = 0;
	asyreq->pkt.mode.wreqb.payload[4] = htonl(0x8a900000);
	asyreq->pkt.mode.wreqb.payload[5] = htonl(0x12000000);
	asyreq->pkt.mode.wreqb.payload[6] = htonl(0x24000000);

	printf("  Calling ioctl with eui inquire\n");
        if (ioctl(fd, FW_ASYREQ, asyreq) < 0)
		err(1, "Can't exec ioctl");

	printf("  FW response:\n");
	printf("  %08x, %08x, %08x, %08x, %08x, %08x\n",
	    buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
	printf("  %08x, %08x, %08x, %08x, %08x, %08x\n",
	    buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);

	close(fd);
	free(asyreq);
	return 0;
}

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.44.0211121359250.1154-200000>