Jump to content

Writing a driver - some help ?

- - - - -

  • Please log in to reply
15 replies to this topic

#1
dany74q

dany74q

    Newbie

  • Members
  • Pip
  • 3 posts
Hello there everyone,
I am a new C programmer, I read couple of tutorials , I can say that I`m familiar with the basics of the language and the idea behind it.
I`m working with linux as my main OS for couple of years now ,and I want to write programs , drivers , what ever will make the community happier.
Still ,after the tutorials ,I can`t write a decent program or driver.
I have some USB gadgets ,video cards,etc.. and would like to write drivers to operate them as I like.
Let`s say I have a RGB LED lamp and I would like to control it - how is it possible ? can someone please direct me to the necessary tutorial or book ?
Plus , I`d like to write my own driver to ATI 3870x2 video card,as it is not supported by ATI drivers,how is it possible ?

If the post is not in the correct sub-forum ,please move it where it belongs.
Thank you very much ,
Danny.

#2
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
A couple of tutorials on C aren't going to help you much in the way of writing drivers.

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
I've been programming off and on for over 19 years, and don't know how to write a driver. Learning C will NOT, by itself, teach you how to write drivers. You need to read tutorials on that specific topic, in the context of the specific OS you are writing them for.

Writing a video card driver, in particular, is going to be highly non-trivial, and would not be my first driver project. Start by writing a keyboard or mouse driver!
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#4
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,717 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
I do want to point out, though, that WingedPanther is kinda on the far end as far as length of experience goes. I wrote my first after programming for six years, so it'll take you a while, but it's not impossible. Who knows, maybe you're a faster learner than I am. :)
sudo rm -rf /

#5
instantcake

instantcake

    Learning Programmer

  • Members
  • PipPipPip
  • 63 posts
linux drivers....linux drivers..... WAIT THERE'S A BOOK ON THAT
http://oreilly.com/c.../book/index.csp
it's in pdf format so Idk why they continue to sell it. It just teaches you the functions ect that are available on linux to write drivers. I haven't read it yet(no time, finals in a month) so I can't vouch for it but it's an oreilly book, how bad can it be?
Posted Imagehttps://wiki.ubuntu....t=getubuntu.pngubuntu.com
“Never trust a computer you can’t throw out a window.” -Steve Wozniak

#6
ToMegaTherion

ToMegaTherion

    Newbie

  • Members
  • PipPip
  • 29 posts
Writing drivers for anything is always a highly challenging project. But maybe setting your goals high will help you to achieve this fairly quickly. I recommend familiarising yourself with how drivers actually work and then as it has been pointed out by someone else on here, try something a little easier than graphics driver. Keyboard or mouse are probably the easiest. This is actually something i have been starting to do a little more research in of late. It's not easy!!!

#7
ToMegaTherion

ToMegaTherion

    Newbie

  • Members
  • PipPip
  • 29 posts
Also an intricate understanding of your computers CPU, and how it works will help. C programming will make this possible, but a good understanding of inturupts and calls for you CPU is also necessary. I'm sure there are others here who know a lot more than me about this, and they will all tell you that doing a few tutorials will not make you a good programmer, you need to practice on goals which streatch you but are not beyond your understanding.

#8
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,717 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Port I/O is another thing you should take a look at for the keyboard and mouse drivers. My first driver was a speaker driver, which was relatively easy. I can show you how to do that if you like. Do you know assembly language?
sudo rm -rf /

#9
dany74q

dany74q

    Newbie

  • Members
  • Pip
  • 3 posts
Thank you all so much, it is a privilege to read and learn from your comments.
I understood that there`s a line between programming in C and writing drivers, as they are not the same task,
still, I would like to know the basics of interaction with the hardware.
I see each and every day news about projects that port phones, embedded computers to a linux-enviroment (ie. android),
and I would like to do this too, writing a driver for the system for a specific hardware.

MeTh0Dz - I`m aware, though the mission isn`t impossible, I`ll take that project as a goal,challenge.

WingedPanther - Thank you very much for the clarification, my current project will be writing a simple driver as you suggested, kbd/mouse/sound card.

instantcake - I`ll surely take a look at the book, thank you.

ToMegaTherion - most grateful for the tips.

dargueta - I am familiar with assembly, I would be grateful if you could show me the basics of the process.

#10
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,717 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Alright. I'll try to write an ASM tutorial on writing a motherboard speaker driver this weekend. Depends on when my next exam is. By the way, what assembly language do you know? If it's anything but Intel then I can't help you, unless MIPS has some port I/O instructions I'm not aware of.
sudo rm -rf /

#11
dany74q

dany74q

    Newbie

  • Members
  • Pip
  • 3 posts
x86 assembly.

#12
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,717 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Oh, good. My specialty. :)
sudo rm -rf /




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users