Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 2003 20:19:02 +0100
From:      Martin <nakal@web.de>
To:        freebsd-current@freebsd.org
Subject:   Panic with ugen
Message-ID:  <1069874342.704.18.camel@klotz.local>

next in thread | raw e-mail | index | archive | help

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




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