From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Budik Date: Mon, 01 May 2006 15:39:11 +0000 Subject: Re: Accessing usb devices with USBDEVFS Message-Id: <44562B9F.3020403@ist-traffic.com> List-Id: References: <44525468.5030106@ist-traffic.com> In-Reply-To: <44525468.5030106@ist-traffic.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org Kay Sievers wrote: > On Fri, Apr 28, 2006 at 01:44:08PM -0400, Danny Budik wrote: > >> I have a question that may or may not be related to hotplugging. I have >> noticed that when I plug in a USB device, it takes about 5 seconds for >> it to show up in /proc/bus/usb/001/xxx. I am using HAL to recognize when >> a USB device is plugged in and USBDEVFS to communicate with my device. >> >> When I plug it in, dbus/HAL instantly recognizes it and sends me a >> message. But when I make the function call to open it (using fopen on >> the file above) I get an error that the device is not found. In fact, it >> takes about 5 seconds for the device to show up in the /proc/bus/usb/ >> directory so I have to place a sleep(5) line in my C code before I am >> able to open the device. >> >> My test machine is a PIII 733 with FC4, latest kernel, so it is a >> relatively slow machine. Is there a way to predict the time that it >> takes for the device to be accessible with USBDEVFS so that I don't have >> to hardcode the sleep statement? >> > > Recent systems don't use /proc for usb access anymore and real device > nodes in /dev/bus/usb instead. HAL sends "usbraw" device anouncements with > "linux.device_file" as a property when the device is created. > > Kay So is there a way then to read from the /dev/bus/usb? Like I mentioned in the parent post, I am just using fopen, and the functions provided in usbdevice_fs.h and usb.h to read data from the usb device. The device is a proprietary sensor that my company makes. Is there a manual/documentation about how to do this the more "modern" way? Thanks, Danny ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel