How to Write a Linux USB Device Driver

Greg shares his USB driver skeleton and shows how it can be customized for your specific device.
______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Not Necessarily a Good Thing

Anonymous's picture

"His free software is being used by more people than any closed-source projects he has ever been paid to develop."

No disrespect to Greg, but that's not necessarily a good tagline to go by. My first reading of that implied that his code is so bad he had to give it away...or that his closed-source projects were unusable.

Perhaps you should try "Greg's software is widely used in the open source community."

Sample code for linux usb device driver

Anonymous's picture

Dear Sir,

I am a student of Computer Engineering, i am studying linux at present and need a linux code for my college code does any body has such code a sample test code for the pen drive....

Regards
Rahul

You can refer to Essential

Anonymous's picture

You can refer to Essential Linux Device Drivers writtennn by Sreekrishnan Venkateswaran. Its a very good book with lots of code examples.

http://www.amazon.com/Essential-Device-Drivers-Sreekrishnan-Venkateswara....

-- Alakesh

Using the devfs_fs_kernel.h

vishy@honeywell's picture

Hi,

I went thru a few comments on the devfs_fs_kernel.h . This header file is included by most of the FS c files .. so only if the CONFIG_DEVFS_FS is enabled(made y) will the method do something. Otherwise the method returns 0 or NULL based on the return type of the func. Thus if a device is to be registered using the DEVFS make sure that the CONFIG_DEVFS_FS is set which causes the right method to be called.

rgds
vishy

Re: Kernel Korner: How to Write a Linux USB Device Driver

Anonymous's picture

I found in kernel2.4.18,the devfs_register() is defined as:
static inline devfs_handle_t devfs_register (devfs_handle_t dir,
const char *name,
unsigned int flags,
unsigned int major,
unsigned int minor,
umode_t mode,
void *ops, void *info)
{
return NULL;
}

file is :devfs_fs_kernel.h
How can I finish register a device file?

Re: Kernel Korner: How to Write a Linux USB Device Driver

Anonymous's picture

good article.

How about "how to write a file system driver" for linux?

Re: Kernel Korner: How to Write a Linux USB Device Driver

Anonymous's picture

I found in kernel2.4.18,the devfs_register() is defined as:
static inline devfs_handle_t devfs_register (devfs_handle_t dir,
const char *name,
unsigned int flags,
unsigned int major,
unsigned int minor,
umode_t mode,
void *ops, void *info)
{
return NULL;
}

file is :devfs_fs_kernel.h
How can I finish register a device file?

Thanx

Sumanta Sathua's picture

Thanx a lot to Greg Kroah-Hartman .Really this article helped me a lot to write a USB device driver.

Please Note, this article was

J.Flores's picture

Please Note, this article was written on 2001, now (jun-2005) a lot of changes has been done on Linux kernel 2.6.x.... just keep it in mind.

Try to download Chapter 13: USB of Linux Device Drivers (3rd Ed.) at http://www.oreilly.com/catalog/linuxdrive3/

Free Dummies Books
Continuous Engineering

Learn:

  • What continuous engineering is
  • How to continuously improve complex product designs
  • How to anticipate and respond to markets and clients
  • How to get the most out of your engineering resources

Get your free book now

Sponsored by IBM

Free Dummies Books
Service Virtualization

Learn to:

  • Define service virtualization
  • Select the most beneficial services to virtualize
  • Improve your traditional approach to testing
  • Deliver higher-quality software faster

Get your free book now

Sponsored by IBM