Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Apr 2005 22:39:39 -0400
From:      David Gilbert <dgilbert@dclg.ca>
To:        ticso@cicely.de
Cc:        David Gilbert <dgilbert@dclg.ca>
Subject:   Re: Tricky USB device.
Message-ID:  <16984.37355.901544.774861@canoe.dclg.ca>
In-Reply-To: <20050409215700.GL96690@cicely12.cicely.de>
References:  <16982.46075.115518.130213@canoe.dclg.ca> <4256B5EB.9080506@savvis.net> <16982.47024.135663.645297@canoe.dclg.ca> <20050408190514.GS96690@cicely12.cicely.de> <16983.465.572693.73195@canoe.dclg.ca> <20050408233301.GW96690@cicely12.cicely.de> <16984.17307.804041.502108@canoe.dclg.ca> <20050409212327.GI96690@cicely12.cicely.de> <16984.19899.604657.135854@canoe.dclg.ca> <20050409215700.GL96690@cicely12.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Bernd" == Bernd Walter <ticso@cicely12.cicely.de> writes:

Bernd> Sounds simple.  Tried with lower case characters?  Otherwise I
Bernd> would say sniff a working driver - for windows there is at
Bernd> least one good freeware USB sniffer avaiable.

HA!  Found the problem --- thank-you everyone.  Aparently, this little
device expects a 0x01 as the first byte of any command.  Heh.  Works
now.

So if you need dry contact I/O ... this seems to work for FreeBSD...

/* Test the Ontrack ADU208 */
/* www.ontrak.net */

#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <err.h>
#include <sys/types.h>
#include <sys/uio.h>

int main(int argc, char *argv[])
{
    int bytes, fd;
    char *s1 = "\001MK255", *s2 = "\001MK0", *s = s1, buf[256];

    if((fd = open("/dev/ugen0.1", O_RDWR)) < 0)
        err(1, "Cannot open device");
    
    while(1)
    {
        bytes = write(fd, s, strlen(s));

        printf("wrote %d bytes %s\n", bytes, s);

        sleep(1);
        
        if(s == s1)
            s = s2;
        else
            s = s1;
    }
    
    return 0;
}

Dave.

-- 
============================================================================
|David Gilbert, Independent Contractor.       | Two things can only be     |
|Mail:       dave@daveg.ca                    |  equal if and only if they |
|http://daveg.ca                              |   are precisely opposite.  |
=========================================================GLO================



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