ZyXEL Omni 56K Plus USB/serial modem
Hans Petter Selasky
hselasky at c2i.net
Fri Jan 11 09:50:18 PST 2008
On Friday 11 January 2008, perryh at pluto.rain.com wrote:
> > > > 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
Hi,
It is strange that you cannot open "/dev/ugen0.X". And you are running the
application like root ?
And what happens if you do "cat /dev/ugen0.1 > /dev/null" ?
--HPS
>
> 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);
> }
More information about the freebsd-usb
mailing list