From: willem ridderhof <willem_ridderhof@ho...> - 2005-09-02 14:55:33
is there anybody who can explain what will happen if libusb calls an ioctl
function? For example with:
ioctl( pointer_to_usbdevice , IOCTL_USB_SUBMITURB, urb_struct )
What exactly is happening under the hood? A link to some documentation is
also appreciated (except for, of course, [man ioctl]...)
From: Peter Stuge <stuge-libusb@cd...> - 2005-09-02 16:11:31
On Fri, Sep 02, 2005 at 04:55:00PM +0200, willem ridderhof wrote:
> is there anybody who can explain what will happen if libusb calls
> an ioctl function?
ioctl() is a general purpose kernel call for userspace programs that
are accessing a kernel driver through a node in the filesystem.
This node can be either a device file or a file in a virtual
filesystem, such as procfs or usbfs.
What happens depends on the code in the kernel. The system switches
to kernelmode and executes the ioctl handler registered by the driver
associated with the open (possibly virtual) file.
Data can be passed to and from the kernel code with pointers or as
simple few-byte values.
For libusb, the most relevant kernel driver is usbfs, the ioctl
handler for usbfs is in /usr/src/linux-2.*/drivers/usb/core/devio.c
and is called proc_ioctl(), in 2.6.13-rc3 it's on line 1215.