Tricky USB device.

David Gilbert dgilbert at dclg.ca
Sat Apr 9 19:39:48 PDT 2005


>>>>> "Bernd" == Bernd Walter <ticso at 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 at daveg.ca                    |  equal if and only if they |
|http://daveg.ca                              |   are precisely opposite.  |
=========================================================GLO================


More information about the freebsd-hackers mailing list