From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 13 11:02:14 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 281D037B401 for ; Sun, 13 Jul 2003 11:02:14 -0700 (PDT) Received: from smtp.web.de (smtp02.web.de [217.72.192.151]) by mx1.FreeBSD.org (Postfix) with ESMTP id 62EC543F3F for ; Sun, 13 Jul 2003 11:02:13 -0700 (PDT) (envelope-from nakal@web.de) Received: from [217.81.254.228] (helo=[217.81.254.228]) by smtp.web.de with esmtp (TLSv1:DES-CBC3-SHA:168) (WEB.DE 4.98 #244) id 19blAo-00068a-00 for freebsd-hackers@freebsd.org; Sun, 13 Jul 2003 20:02:10 +0200 From: Martin To: freebsd-hackers@freebsd.org Content-Type: text/plain Message-Id: <1058119316.547.22.camel@klotz.local> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.3 Date: 13 Jul 2003 20:01:57 +0200 Content-Transfer-Encoding: 7bit Sender: nakal@web.de Subject: USB device programming with ugen X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jul 2003 18:02:14 -0000 Hi all, I have started to write a small video capture application for my webcam (the first few steps). I am using /dev/ugen0 to talk to the webcam and it seems to work. I can reset the webcam and hear a beep. It is correct so far. The problem is, I can only start my application on the text terminal. If I try to access it through xterm, gnome-terminal or konsole, it will freeze the whole system. While experimenting on the text terminal, I noticed that the commands (ioctls) are being sent correctly (don't return -1), but it takes long time till they return (approx 5 seconds). While an ioctl-command is being executed the system is not responding until it finishes successfully. Perhaps I am doing something wrong that's why I want to show you what I send to the webcam. Here a small part (there are 5 or 6 ioctls, but they look all same; I will not paste the error checking code, only the essential part): /* *** */ fdout=open("/dev/ugen0", O_RDWR, 0); memset(&ur, 0, sizeof(struct usb_ctl_request)); /* paranoid */ ur.ucr_addr=0; /* ignored */ ur.ucr_data=NULL; ur.ucr_actlen=0; ur.ucr_flags=0; ur.ucr_request.bmRequestType=UT_WRITE_VENDOR_DEVICE; ur.ucr_request.bRequest=0; USETW(ur.ucr_request.wValue,0xff00); USETW(ur.ucr_request.wIndex,0x00); USETW(ur.ucr_request.wLength,0); ioctl(fdout,USB_DO_REQUEST,&ur); ... close(fdout); /* *** */ I am executing it on current (compiled yesterday). I have same behavior on older 5.1-kernels and it's freezing stable no matter if I start it in X or on text terminal (even in single-user). Further details about my system: P3 500MHz, Intel 440BX, 256MB, only 1 USB device attached (Creative Video Blaster Webcam Go) dmesg: uhci0: port 0xc000-0xc01f at device 7.2 on pci0 pci_cfgintr: 0:7 INTD routed to irq 11 usb0: on uhci0 usb0: USB revision 1.0 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 2 ports with 2 removable, self powered ugen0: WINBOND W9967CF, rev 1.10/1.10, addr 2 I would like to know if I am doing something wrong accessing the USB-device. In my opinion, it should not freeze the system at least. Thanks in advance, Martin