Re: USB API, ioctl's and libusb

From: Johannes Erdfelt (johannes_at_erdfelt.com)
Date: 01/26/05

  • Next message: Sytse Wielinga: "Re: thoughts on kernel security issues"
    Date:	Wed, 26 Jan 2005 13:24:11 -0800
    To: Oliver Neukum <oliver@neukum.org>, Linux-kernel <linux-kernel@vger.kernel.org>, linux-usb-users@lists.sourceforge.net
    
    

    On Wed, Jan 26, 2005, DervishD <lkml@dervishd.net> wrote:
    > * Oliver Neukum <oliver@neukum.org> dixit:
    > > Am Mittwoch, 26. Januar 2005 13:20 schrieb DervishD:
    > > > ? ? My question is: which interface should be used by user space
    > > > applications, <linux/usb.h> or ioctl's? Is the ioctl interface
    > > > deprecated in any way? In the "Programming guide for Linux USB Device
    > > > Drivers", located in http://usb.in.tum.de/usbdoc/, I can't find ioctl
    > > > interface references :?
    > > You are supposed to use libusb.
    >
    > That's irrelevant, the program I was trying to fix uses libusb.
    > My question is about the preferred kernel interface, 'cause I don't
    > know if it's the ioctl one or the URB one (well, I'm calling 'URB'
    > interface the API that is implemented using URB's inside the kernel).

    ioctl() calls are for userspace only.

    It just so happens there is an ioctl() call that provides an URB like
    interface and an ioctl() call that provides a synchronous call to do
    a control message.

    > BTW, and judging from the program I've read, there are lots of
    > operations that must be done using 'usb_control_msg', and libusb
    > implements that function with exactly the same interface as the
    > kernel. The only difference is that libusb uses ioctl and the kernel
    > implements the function using URB's. IMHO libusb doesn't provide a
    > cleaner API, the only advantage of libusb is portability. Anyway,
    > I've not used it enough to judge, I'm more concerned about kernel USB
    > interface, not libusb one.

    I think you're looking at this incorrectly. You use the kernel API for
    kernel modules. You can use either the ioctl() API or libusb for
    userspace applications.

    JE

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Sytse Wielinga: "Re: thoughts on kernel security issues"

    Relevant Pages

    • Re: [Linux-usb-users] Re: USB API, ioctls and libusb
      ... The only difference is that libusb uses ioctl and the kernel ... >> cleaner API, the only advantage of libusb is portability. ... > a user API. ...
      (Linux-Kernel)
    • Re: [Linux-usb-users] Re: USB API, ioctls and libusb
      ... > interface the API that is implemented using URB's inside the kernel). ... The only difference is that libusb uses ioctl and the kernel ...
      (Linux-Kernel)
    • it was usb problem (was 2 core dumps)
      ... libusb and kernel usb. ... As I have libusb installed (came to my system because of hplip/sane ... GNU gdb 6.1.1 ...
      (freebsd-current)
    • Which version of libusb to use ?
      ... I am working on developing a driver based on libusb for a custom ... product on Redhat 7.1 (kernel 2.4.2). ... AND support short bulk ...
      (comp.os.linux.development.system)
    • Re: USB API, ioctls and libusb
      ... > You are supposed to use libusb. ... interface the API that is implemented using URB's inside the kernel). ... The only difference is that libusb uses ioctl and the kernel ...
      (Linux-Kernel)