Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jan 2008 22:57:08 -0800
From:      perryh@pluto.rain.com
To:        hselasky@c2i.net
Cc:        freebsd-usb@freebsd.org
Subject:   Re: ZyXEL Omni 56K Plus USB/serial modem
Message-ID:  <47871344.bvH7YPY9QJF3xIgB%perryh@pluto.rain.com>
In-Reply-To: <200801101638.19620.hselasky@c2i.net>
References:  <477a00ea.73gFojnRSqtUufCO%perryh@pluto.rain.com> <200801091945.18256.hselasky@c2i.net> <4785dec5.qxgU3WUBgrj%2BjYS7%perryh@pluto.rain.com> <200801101638.19620.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> > > To me it looks like they are using some kind of propritary
> > > protocol. You could try and see if any of the endpoints,
> > > which appear like /dev/ugen0.x files respond with "OK" when
> > > you send "AT\r\n" to the endpoint ...
> >
> > How would I go about doing that?
>
> I think the best will be to write a small C-program:
>
> Here is the basic:
>
> ...

Either the device doesn't like this sort of thing,
or I did something wrong:

# ls -l /dev/ugen*
crw-r--r--  1 root  operator    1,  15 Nov 24 21:17 /dev/ugen0
crw-r--r--  1 root  operator    1,  16 Nov 24 21:17 /dev/ugen0.1
crw-r--r--  1 root  operator    1,  17 Nov 24 21:17 /dev/ugen0.2
crw-r--r--  1 root  operator    1,  18 Nov 24 21:17 /dev/ugen0.3
crw-r--r--  1 root  operator    1,  19 Nov 24 21:17 /dev/ugen0.4

Not sure where that Nov 24 date comes from --
I just plugged the modem in a couple of days ago.
They do go away when I turn it off, and then come
back (still dated 11/24) when I turn it back on.

# ./usbEpProbe /dev/ugen0.1
usbEpProbe: Cannot open '/dev/ugen0.1': Device not configured
# ./usbEpProbe /dev/ugen0.2
usbEpProbe: Cannot open '/dev/ugen0.2': Device not configured
# ./usbEpProbe /dev/ugen0.3
usbEpProbe: Cannot open '/dev/ugen0.3': Device not configured
# ./usbEpProbe /dev/ugen0.4
usbEpProbe: Cannot open '/dev/ugen0.4': Device not configured
# ./usbEpProbe /dev/ugen0
usbEpProbe: Cannot set short XFER
: Invalid argument

# cat usbEpProbe.c
#include <stdio.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <dev/usb/usb.h>

#define	STIMULUS "AT\r\n"

main(int argc, char *argv[])
{
    int f, error, count;
    char buf[4];

    if (argc != 2) {
        err(1, "Usage: %s /dev/ugen0.[1-4]", argv[0]);
    }

    f = open(argv[1], O_RDWR);
    if (f < 0) {
        err(1, "Cannot open '%s'", argv[1]);
    }

    /* allow short transfers */
    error = 1;
    error = ioctl(f, USB_SET_SHORT_XFER, &error);
    if (error < 0) {
        err(1, "Cannot set short XFER\n");
    }

    error = 1000;
    error = ioctl(f, USB_SET_TIMEOUT, &error);
    if (error < 0) {
        err(1, "Cannot set timeout");
    }

    error = write(f, STIMULUS, sizeof(STIMULUS)-1);

    for ( count = 0 ; ; ++count ) {
        error = read(f, buf, 1);
        if (error > 0)
            printf("%c", buf[0]);
        else
            break;
    }
    printf("\ngot %d bytes\n", count);
}



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