Re: Some information on USB API

Meher <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Hi,

On 4/30/07, Curran, Dominic <[email protected]> wrote:
>
> > Hi,
> >      I would like to know if there is any specific API that will be
> > used by the Applications that read/write to USB devices. For example
> > if a flash device is plugged into a system then the HCD will enumerate
> > the device and load the appropriate device driver for that flash
> > device to handle the device. Now say if the USB flash drive is mounted
> > as /dev/flashd. Then application will not even bother if he is a USB
> > device or  on board flash and just do the normal read/write from
> > /dev/flashd?
>
> Correct.
>
>
> >     When application does a read or even mount of the flash device how
> > is that information passed on to the device driver so that it can
> > convert that to specific Ctrl/Bulk transfer types and pass it on to
> > HCD?
>
> I believe the driver stack will look something like this:
>
> App that calls read()                       USERMODE
> ------------------------------------------
> File system driver (like ext3, fat32)       KERNEL MODE
> SCSI driver
>USB-Storage
> usbcore
> USB Host controller driver (like EHCI)
> PCI driver
> ------------------------------------------
> HARDWARE

I have a doubt here. I am not much familiar with USB-storage API but,
does this mean USB-Storage driver registers with the SCSI driver and
the information flow happens that way? I am confused because if we see
normal devices like serial port which have a device files like
/dev/ttyS0 they have a specific major, minor number which the driver
specifies while registering the I can see how the system calls get
routed through to the specific driver. But in the case of USB, when
the class specific driver registers with the respective subsystem
(USB-storage with SCSI/file system layer) how does the USB-Storage
driver specify to SCSI driver that it is taking care of the flash
device?

>

>
>
> >    Does the same process happen for all of the devices? Like if a USB
> > keyboard is connected and if I want to read from USB keyboard, I will
> > still read from standard keyboard interface?
>
> Yes, but obviously the driver stack looks a little different.
> In the case of HID I think it looks something like this...
>
> App like X                                  USERMODE
> ------------------------------------------
> HID                                         KERNEL MODE
> usbcore
> USB Host controller driver (like EHCI)
> PCI driver
> ------------------------------------------
> HARDWARE
>
>


Here how will HID layer differentiate between USB and PS2
mouse/keyboard? Will it read from both the interfaces?


> >    If I use libusb, can I get develop the driver in the user space and
> > get rid of the driver at kernel level?
>
> Yes.
> As long as you unload the driver or make sure it doesn't load to start
> with.
>
> >Also does libusb work on all
> > HCD's(
> >UHCI
>
> yes
>
> > EHCI
>
> yes
>
> > Mentor graphics MUSBHDRC etc.,)?
>
> Maybe.  Is there a linux driver for this ?
>
>

Yes, there is a driver for this..

>


-- 
Regards,
Meher

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.