Panic with ugen

Martin nakal at web.de
Wed Nov 26 11:19:07 PST 2003


Hi,

I'm still trying to write a webcam application for my
"Creative Videoblaster Webcam Go". I have not much luck, but
I accidently discovered how to cause panic with few lines
of code while using ugen.

Here is the code:

>------------------------------------------<
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <dev/usb/usb.h>
#include <sys/ioctl.h>
#include <sys/param.h>
                                                                                
#define DEVNAME "/dev/ugen0"
                                                                                
static char dev_name[MAXPATHLEN];
                                                                                
int main(int argc, char *argv[]) {
 
    int fdout;
    int i;
 
    sprintf(dev_name,"%s",DEVNAME);
 
    fdout=open(dev_name, O_RDWR, 0);
    if (fdout<0) {
      perror("open");
      fprintf(stderr, "Cannot open device: %s\n",DEVNAME);
      exit(-1);
    }
                                                                                
    i=0;

    /* PANIC here in ioctl (during second run) */
    if(ioctl(fdout, USB_SET_CONFIG, &i) < 0) {
      perror("ioctl(USB_SET_CONFIG)");
      exit(-1);
    }
    close(fdout);
                                                                                
    return 0;
}
>------------------------------------------<

Run it once, you'll get an error. The second run
will cause a panic.

Additional info:
5.1-CURRENT FreeBSD 5.1-CURRENT #1: Tue Nov 18 00:30:15 CET 2003 i386
usb0: <Intel 82371AB/EB (PIIX4) USB controller> on uhci0
ugen0: WINBOND W9967CF, rev 1.10/1.10, addr 3

Martin




More information about the freebsd-current mailing list