LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-31-2011, 05:25 AM   #1
apanimesh061
Member
 
Registered: Sep 2010
Posts: 51

Rep: Reputation: 0
Smile Writing a driver program in Linux !


Is it possible to get source code of a Linux USB driver form somewhere ...... ????
I searched but could not find.
I am reading a book on Linux Device Drivers - III edition
But still I need something to start with !!!!

Please help !
 
Old 07-31-2011, 05:34 AM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Well, you'll have to look at the kernelsources. Download the sources, extract the archive and enter the directory ./linux-2.6.??.?/drivers/usb/
There you will hopefully find what you're searching for.

Markus
 
Old 08-01-2011, 08:36 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
If you install the Kernel Source packages for your particular Linux, you'll find plenty of existing examples of drivers ... including, no doubt, one that is quite close to what you're looking for. (Heck, it's entirely possible that you will stumble upon exactly what(!) you are looking for!)

"Use the Source, Luke!!"

Carefully browse the source-code of the driver. Compare it, at your leisure, to similar drivers in the neighborhood. These are, after all, the actual source-code files of deployed drivers that, as far as anyone and everyone knows, actually work! And they're written for the Linux distro that you are currently using! (Cool, huh?)

If there is any possible better-place to begin your studies than that, I do not know what it could possibly be.

"Use the Source, Luke!!"
 
Old 08-02-2011, 11:54 AM   #4
apanimesh061
Member
 
Registered: Sep 2010
Posts: 51

Original Poster
Rep: Reputation: 0
Exclamation

I checked whole folder of Linux.
I found the driver folder and the USB folder in which there were around 14-15 folders all containing "Kconfig" and Makefiles !

I want to know where can I find the C codes or Perl Codes or Pyhton Codes or the Object files included in the Makefiles .....
I could not find any ????!!!!
Am I going wrong somewhere ?

Please help !
 
Old 08-02-2011, 08:01 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
You might well find source-files that refer to files that are not in any package that you have yet installed on your computer.

Kernel source-code will be in one package or another, and it will be an "optional" package.
 
Old 08-02-2011, 08:57 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,981

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
You are asking many things here.

Yes, some source code may be found somewhere.

If it is open sourced and there is a driver then it may be on the web.

If it is closed then you'd have to have access to it by some agreement. You can't easily decompile a driver to get source code.

If you have source for a similar make or know enough to get a close match you can take some other source code and work on it. Debug it if you know the differences in the hardware.


In some cases a windows driver or even windows source could be used.
 
Old 08-03-2011, 04:35 AM   #7
apanimesh061
Member
 
Registered: Sep 2010
Posts: 51

Original Poster
Rep: Reputation: 0
I have Ubuntu 10.10 and Linux Mint !
I did not find any thing in them .... !

Could you suggest me other open source linux or non-linux OSs where I could find the USB Driver full source code ?

I also have Minix 3.0, but I am having problems in installing it .... !
 
Old 08-03-2011, 05:42 AM   #8
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Not sure what Perl or Python have to do with anything, as the kernel is written in C (with some Assembly).

You can browse the kernel sources online, at http://kernel.org. Use the "Gitweb" link for a given release and then the link that says "tree" (at the top) will give you the latest version of the source tree for that release.

Last edited by Nylex; 08-03-2011 at 05:44 AM.
 
Old 08-03-2011, 03:39 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,981

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
Minix is in a class of it's own.

What exactly is this device?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help in writing a program with C in Linux anuzephyr Programming 5 11-15-2010 06:35 AM
writing c program to shutdown linux system curiousMe Linux - Newbie 1 09-12-2010 12:21 PM
[SOLVED] what info to be considered from given data sheet while writing driver program. suresh.perumal Linux - Embedded & Single-board computer 6 06-24-2010 10:31 AM
writing a c program in linux which plays an'.wav' file stephenwalter Programming 8 07-08-2005 11:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration