Re: Some information on USB API

"Curran, Dominic" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>

> >
> > >     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?


I'm not a SCSI guru, but...

Yes, I believe usb-storage registers with the SCSI stack.

And I think it happens here:
http://www.linux-m32r.org/lxr/http/source/drivers/usb/storage/usb.c?v=2.
6.20-rc1;a=i386#L1007






> >
> 
> >
> >
> > >    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?

Again I missed out a driver (hid-core?). This driver should  register
with HID and translation the HID messages to send to usbcore...


 App like X                                  USERMODE
 ------------------------------------------
 HID                                         KERNEL MODE
 hid-core
 usbcore
 USB Host controller driver (like EHCI)
 PCI driver
 ------------------------------------------
 HARDWARE

See:
http://www.linux-m32r.org/lxr/http/source/drivers/usb/input/hid-core.c?v
=2.6.20-rc1;a=i386


dom



-------------------------------------------------------------------------
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.