All of lore.kernel.org
 help / color / mirror / Atom feed
* Need help to understand USB driver mechanism
@ 2012-06-21 10:39 Vishal Nandanwar
       [not found] ` <CAKB833mPfX2U6_UA0Fr0CTw623gxCvcYPW3HvfVJWE1Xt7v-UQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Vishal Nandanwar @ 2012-06-21 10:39 UTC (permalink / raw)
  To: Linux USB, Linux Docs, Platform driver x86

Hi,

I am trying to understand the USB device driver writing mechanism and
architecture. I have gone through the LDD book as well.

For learning purpose I am trying to write a driver for a pen drive
i.e. USB mass storage. Linux do have the usb-storage driver which is
used for pen drive. I have gone through the ../driver/usb/storage
folder of Linux source code and found there are few drivers(karma,
freecom) which uses usb-storage to achive there functionality.

what is the mechanism to write a driver for pen drive(USB mass
storage)? Is there any guide/help document which describes how to
create a interface driver on top of usb-storage driver, so when my pen
driver is connected it should use my driver?


Vishal N

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Need help to understand USB driver mechanism
       [not found] ` <CAKB833mPfX2U6_UA0Fr0CTw623gxCvcYPW3HvfVJWE1Xt7v-UQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-06-21 14:40   ` Alan Stern
       [not found]     ` <Pine.LNX.4.44L0.1206211036540.1164-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Stern @ 2012-06-21 14:40 UTC (permalink / raw)
  To: Vishal Nandanwar; +Cc: Linux USB, Linux Docs, Platform driver x86

On Thu, 21 Jun 2012, Vishal Nandanwar wrote:

> Hi,
> 
> I am trying to understand the USB device driver writing mechanism and
> architecture. I have gone through the LDD book as well.
> 
> For learning purpose I am trying to write a driver for a pen drive
> i.e. USB mass storage.

That's a terrible way to learn.  The mass-storage driver is one of the 
most complicated ones in the USB subsystem.  You should start with 
something simpler.

> Linux do have the usb-storage driver which is
> used for pen drive. I have gone through the ../driver/usb/storage
> folder of Linux source code and found there are few drivers(karma,
> freecom) which uses usb-storage to achive there functionality.

Yes.  Those sub-drivers are needed because their devices don't use the 
standard USB mass-storage protocol.

> what is the mechanism to write a driver for pen drive(USB mass
> storage)? Is there any guide/help document which describes how to
> create a interface driver on top of usb-storage driver, so when my pen
> driver is connected it should use my driver?

I can tell you in one word how to write a driver for your pen drive: 

	Don't!

If you don't write a special driver then the pen drive should work
perfectly well.  If you did try to write a special interface sub-driver
for it, you'd find that your driver had nothing to do because
usb-storage already handles everything.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Need help to understand USB driver mechanism
       [not found]     ` <Pine.LNX.4.44L0.1206211036540.1164-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
@ 2012-06-22  2:05       ` Vishal Nandanwar
       [not found]         ` <CAKB833k1Q7LoJWxDp6AHdq5H=w=LeeeRQ3sRC_1zXcJ_Lp9mNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2012-06-22 13:48         ` Alan Stern
  0 siblings, 2 replies; 7+ messages in thread
From: Vishal Nandanwar @ 2012-06-22  2:05 UTC (permalink / raw)
  To: Alan Stern; +Cc: Linux USB, Linux Docs, Platform driver x86

Hi Alan,

Thanks for your reply. It really helps.

What approach one should use to learn the device drivers?

Vishal N

On Thu, Jun 21, 2012 at 8:10 PM, Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org> wrote:
> On Thu, 21 Jun 2012, Vishal Nandanwar wrote:
>
>> Hi,
>>
>> I am trying to understand the USB device driver writing mechanism and
>> architecture. I have gone through the LDD book as well.
>>
>> For learning purpose I am trying to write a driver for a pen drive
>> i.e. USB mass storage.
>
> That's a terrible way to learn.  The mass-storage driver is one of the
> most complicated ones in the USB subsystem.  You should start with
> something simpler.
>
>> Linux do have the usb-storage driver which is
>> used for pen drive. I have gone through the ../driver/usb/storage
>> folder of Linux source code and found there are few drivers(karma,
>> freecom) which uses usb-storage to achive there functionality.
>
> Yes.  Those sub-drivers are needed because their devices don't use the
> standard USB mass-storage protocol.
>
>> what is the mechanism to write a driver for pen drive(USB mass
>> storage)? Is there any guide/help document which describes how to
>> create a interface driver on top of usb-storage driver, so when my pen
>> driver is connected it should use my driver?
>
> I can tell you in one word how to write a driver for your pen drive:
>
>        Don't!
>
> If you don't write a special driver then the pen drive should work
> perfectly well.  If you did try to write a special interface sub-driver
> for it, you'd find that your driver had nothing to do because
> usb-storage already handles everything.
>
> Alan Stern
>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Need help to understand USB driver mechanism
       [not found]         ` <CAKB833k1Q7LoJWxDp6AHdq5H=w=LeeeRQ3sRC_1zXcJ_Lp9mNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-06-22  2:25           ` Greg KH
  2012-06-22  3:03             ` Vishal Nandanwar
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2012-06-22  2:25 UTC (permalink / raw)
  To: Vishal Nandanwar; +Cc: Alan Stern, Linux USB, Linux Docs, Platform driver x86

On Fri, Jun 22, 2012 at 07:35:55AM +0530, Vishal Nandanwar wrote:
> Hi Alan,
> 
> Thanks for your reply. It really helps.
> 
> What approach one should use to learn the device drivers?

"Linux Device Drivers", third edition, free online.  Have you tried
that?

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Need help to understand USB driver mechanism
  2012-06-22  2:25           ` Greg KH
@ 2012-06-22  3:03             ` Vishal Nandanwar
  2012-06-22 13:42               ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Vishal Nandanwar @ 2012-06-22  3:03 UTC (permalink / raw)
  To: Greg KH; +Cc: Alan Stern, Linux USB, Linux Docs, Platform driver x86

Yes, I am reading it simultaneously.

But to do hands on, which driver one should try as mass storage driver
(for pen driver) is very difficult.

Vishal N


On Fri, Jun 22, 2012 at 7:55 AM, Greg KH <greg@kroah.com> wrote:
> On Fri, Jun 22, 2012 at 07:35:55AM +0530, Vishal Nandanwar wrote:
>> Hi Alan,
>>
>> Thanks for your reply. It really helps.
>>
>> What approach one should use to learn the device drivers?
>
> "Linux Device Drivers", third edition, free online.  Have you tried
> that?
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Need help to understand USB driver mechanism
  2012-06-22  3:03             ` Vishal Nandanwar
@ 2012-06-22 13:42               ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2012-06-22 13:42 UTC (permalink / raw)
  To: Vishal Nandanwar; +Cc: Alan Stern, Linux USB, Linux Docs, Platform driver x86


A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Fri, Jun 22, 2012 at 08:33:50AM +0530, Vishal Nandanwar wrote:
> Yes, I am reading it simultaneously.
> 
> But to do hands on, which driver one should try as mass storage driver
> (for pen driver) is very difficult.

Yes, the mass-storage driver is one of the most complex, please stay
away from it unless you understand SCSI very well.

As for what one to pick, I do not know, that is your own choice, not
mine.

good luck,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Need help to understand USB driver mechanism
  2012-06-22  2:05       ` Vishal Nandanwar
       [not found]         ` <CAKB833k1Q7LoJWxDp6AHdq5H=w=LeeeRQ3sRC_1zXcJ_Lp9mNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-06-22 13:48         ` Alan Stern
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Stern @ 2012-06-22 13:48 UTC (permalink / raw)
  To: Vishal Nandanwar; +Cc: Linux USB, Linux Docs, Platform driver x86

On Fri, 22 Jun 2012, Vishal Nandanwar wrote:

> Hi Alan,
> 
> Thanks for your reply. It really helps.
> 
> What approach one should use to learn the device drivers?

Many of the files in drivers/usb/misc would make a good place to start.  
You can also try to figure out the usblp driver.

Alan Stern

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-06-22 13:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-21 10:39 Need help to understand USB driver mechanism Vishal Nandanwar
     [not found] ` <CAKB833mPfX2U6_UA0Fr0CTw623gxCvcYPW3HvfVJWE1Xt7v-UQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-06-21 14:40   ` Alan Stern
     [not found]     ` <Pine.LNX.4.44L0.1206211036540.1164-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-06-22  2:05       ` Vishal Nandanwar
     [not found]         ` <CAKB833k1Q7LoJWxDp6AHdq5H=w=LeeeRQ3sRC_1zXcJ_Lp9mNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-06-22  2:25           ` Greg KH
2012-06-22  3:03             ` Vishal Nandanwar
2012-06-22 13:42               ` Greg KH
2012-06-22 13:48         ` Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.