Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Does anybody know where I can get the source code for a USB mass storage device driver for Linux?
I have been trying to search for it, but have had no luck.
I would have thought it would be easy as Linux is opensource.
Thanks for your reply.
Does this mean that there is no current source code for a USB mass storage device that can be downloaded and modified?
I want to try and understand how USB device drivers read and write.
/usr/src/linux/drivers/usb/usb_skeleton.c is a great start.
It is pretty much de rigeur that the proper way to approach this sort of thing is to look at "prior art." Find something that is very-close to what you are doing and adapt it ... or, quite likely, discover that you actually don't have to. If your purpose is simply to discover how something works: "Use the Source, Luke!"
Last edited by sundialsvcs; 12-02-2009 at 08:44 AM.
Thanks.
I am running the 2.6.28 kernel and when I try and compile a basic "Hello World" device driver. When I try to compile it I get "cannot find module.h".
I have read that I may need to enter the following command
$ sudo apt-get install module-assistant
But this just says "E: Couldn't find package module assistant."
Does anyone know what the problem is and how I can fix it?
I tried:
sudo apt-get update
This seems to run fine, but again when running gcc -c hello.c as on http://www.freeos.com/articles/2677/
I get:
hello.c:2:26: error: linux/module.h: No such file or directory
Does 'sudo apt-get update' command compile the kernel?
"$sudo apt-get update" is designed for package management, and software updating.
Passing the update argument to the Apt-Get command results in a system update process. This process will contact the configured repositories and compare them to existing files on the local system. If an update is possible, the “sudo apt-get upgrade” command will process the respective program upgrade.
I have been looking at the usb-skeleton.c code.
I got this code from http://lxr.free-electrons.com/source...ton.c?v=2.6.28, as it is supposed to be in linux/drivers/usb but I cannot seem to find it on my ubuntu machine.
From what I know, the code from the site above seems to be OK, but the only confusing thing is that the device gets registered at the end, rather than the beginning.
Is this correct? As I thought the first thing that happens is the device is registered???
Can someone please verify if the usb-skeleton.c is correct for USB mass storage devices...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.