Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Dec 2003 18:25:55 +0100
From:      Steve O'Hara-Smith <steve@sohara.org>
To:        "Steve O'Hara-Smith" <steve@sohara.org>
Cc:        current@FreeBSD.ORG
Subject:   Re: X10 Wireless Technology Inc USB Receiver
Message-ID:  <20031214182555.52690e67.steve@sohara.org>
In-Reply-To: <20031213194940.44073338.steve@sohara.org>
References:  <3F57B0A0.2040508@isi.edu> <20030905072228.3def6a8b.steve@sohara.org> <3F63E246.8030801@isi.edu> <20030915190350.3e0fe0ec.steve@sohara.org> <20030918165710.GB19984@genius.tao.org.uk> <3F69FFC9.80308@isi.edu> <20030918231742.GB41432@genius.tao.org.uk> <3F6DE165.1020404@isi.edu> <20031213194940.44073338.steve@sohara.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Sat, 13 Dec 2003 19:49:40 +0100
"Steve O'Hara-Smith" <steve@sohara.org> wrote:

SOS> 	Ideas anyone ??

	Talking to myself - I added the 0x80s to init1 and init2 (which I
thought was just protocol fluff) and I got output - it even responds to a
button press on the remote for a while and then it stops working :(
Killing the program, waiting a couple of minutes and trying again makes
it work for a bit again,

	There's something smelly and intermittent going on which may be
my USB hardware.

	New code attached - somebody please give it a whirl.

-- 
C:>WIN                                      |     Directable Mirrors
The computer obeys and wins.                |A Better Way To Focus The Sun
You lose and Bill collects.                 |  licenses available - see:
                                            |   http://www.sohara.org/

[-- Attachment #2 --]
#include <fcntl.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <stdio.h>
#include <usb.h>
#include <sys/ioctl.h>
#include <dev/usb/usb.h>

#define USB_ERROR -1

static char init1[]={ 0x80, 0x01, 0x00, 0x20, 0x14 };
static char init2[]={ 0x80, 0x01, 0x00, 0x20, 0x14, 0x20, 0x20, 0x20 };

main (int argc, char **argv)
{
	int fd;
	int rfd, wfd;
	int err;
	int iov;
	int n;
	char c[255];
	usb_device_descriptor_t usbdd;

	fd = open ("/dev/ugen0", O_RDWR);
	if (fd  == -1)
		{ perror ("Open ugen0"); exit(1); }

	err = ioctl(fd, USB_GET_DEVICE_DESC, &usbdd);
	if (err == -1)
		{ perror ("Get device descriptor"); exit(1); }

	rfd = open ("/dev/ugen0.1", O_RDONLY|O_NONBLOCK);
	if (rfd == -1)
		{ perror ("Open ugen0.1"); exit(1); }
	iov = 1;
	err = ioctl (rfd, USB_SET_SHORT_XFER, &iov);
	if (err == -1)
		{ perror ("Set short XFER"); exit(1); }

	iov = 5000;
	err = ioctl (rfd,  USB_SET_TIMEOUT, &iov);
	if (err == -1)
		{ perror ("Set Timeout"); exit(1); }

	wfd = open ("/dev/ugen0.2", O_WRONLY);
	if (wfd == -1)
		{ perror ("Open ugen0.2"); exit(1); }

	err = write (wfd, init1, sizeof(init1));
	if (err != sizeof(init1))
		{ perror ("Write init1"); exit(1); }
	err = write (wfd, init2, sizeof(init2));
	if (err != sizeof(init2))
		{ perror ("Write init2"); exit(1); }

	while (n = read (rfd, c, 255)) write (1, c, n);
}
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031214182555.52690e67.steve>