On Sat, Apr 29, 2006 at 06:32:17AM +0000, [EMAIL PROTECTED] wrote:
> >On Fri, Apr 28, 2006 at 05:01:32AM +0000, [EMAIL PROTECTED] wrote:
> >> Hi,
> >>
> >> I have question.
> >>
> >> I have written a Skelton driver for Mass-Storage device (init,exit, 
> >probe,
> >> disconnect,release,and open). When I tried to test (by open 
> >("/dev/sda5",
> >> read-only)) my Skelton driver by writing an application, i failed to 
> >open.
> >> I noticed that I have to mount the memory stick after doing insmod
> >> my_driver.ko.
> >
> >Yes, that's the way that block devices work.
> >
> >> my questions are...
> >
> >Our first one is, why write another mass-storage driver when the kernel
> >already has 2?
> 
> Greg I agree with you. There is no need to write a driver. But What I am 
> trying to do is, I am learning, I am trying to learn how to write a USB 
> driver in linux on my own, with the help of this group. So I just wrote a 
> skelton driver and want to test.

A mass-storage driver is NOT the thing to start out with to "just test".
I suggest something much simpler that doesn't involve the SCSI spec :)

Like a USB thermometer.  That's what I use in a "how to write a real
working driver" class that I give, and it can be done in 2 hours.

> >> 1) Do I have to mount the stick like "mount -t vfat /dev/sda5 
> >/mnt/storage"
> >> before doing open in the application?
> >
> >You don't ever call "open" on a block device when dealing with a file
> >system.
> 
> Without calling "open( "/dev/usb/<node>", R_ONLY )" how can I access node 
> for read/write in future when I will write them in my driver?
> 
> If you don't mind could be more clear?

Please read up on how block devices work, they are not like char
devices.  If you need more information, the book, "Linux Device Drivers,
third edition" is a good place to start.  It's free online if you don't
want to purchase it.

> >> 2) If I mount with the above mentioned command, from my test application
> >> can I able to access the device with the open call?
> >
> >No.
> 
> What should I do inorder to acess the device from my application by using 
> by skelton driver?

It all depends on what type of device you have.  Try reading the USB
chapter in the above mentioned book for more details.

> >> 3) Otherwise do I have to write any piece of code in the driver itself 
> >for
> >> mounting?
> >
> >You just have to use the standard block driver or scsi interface.  You
> >are doing that, right?
> 
> :(......do you mean to say that the scsi commands like Inquiry, 
> Test_unit_ready, Request_sense?

You did read the USB storage spec, right?

good luck,

greg k-h


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to