Slashdot Mirror


Writing Kernel Drivers

There's a pretty cool article running on Linux.com about the how-to for writing kernel drivers - in this case, the PC speaker. Interesting case and it's interesting to see what's going on in there.

11 of 72 comments (clear)

  1. Rediscovered a 20-year-old Technique by dschuetz · · Score: 5
    This is way cool, and it's coolness is not in the least diminished by the fact that something very much like this was used on my old TRS-80 Model I computer, back in, oh, 1981.

    There was no audio (hell, there was barely video) on that machine, and the original data storage medium was cassette tapes. Stored at about 300 baud, or so. The output of the cassette port was about the same +5v / 0v range, and people used the same approach to store data on the tape (I think it's called Frequency Shift Keying, but I'm not sure).

    Anyway, people also realized early on that you could hook an audio amplifier to the output, and do some rudimentary sound effects. People played with it more, got some very nicely done 'drivers' (as it were) that were easy to call from BASIC, and, volia!, you've added laserbeam sound effects to your Android Nim program.

    Then someone really got good with sound (I think it was Leo Christopherson's Ride of the Valkyries program, but it might have been Dancing Demon, too), with a lot more advanced and cool-sounding effects. Then it got really out of hand when someone figured out how to to speech synthesis. Still, to this day, some of the best speech I've heard from a computer.

    And this, ladies and gentlemen, was on a 1.77 MHz Z-80.

    This is yet another example of how, with all the advanced hardware we've got today, we've lost sight of how to "do more with less." Everyone could learn from this...

  2. Sovelein, Hannu Solvelein... by vherva · · Score: 5

    Come on, Savolainen can't be that hard to type... You could even cut'n'paste these days.

    Also there has already been one pcspeaker patch for ages - it would've been nice if that had been mentioned.

    Other than that, nice article.

    --
    -- v --
  3. Hmmm... by Tower · · Score: 5

    From the article:
    "Suppose that you want to publish a Phd thesis on how to wash clothes using your brand of washing machine. You'd write a sequence of steps starting from:

    1) Insert the power cord into the wall socket and switch on the power"

    Now, if you happened to be writing a PhD thesis, wouldn't you make 'insert the power cord into the wall socket' and 'switch on the power' two separate methods, possibly expounding for at least half a page as to the meaning of 'switch on the power', which is rather vague - is that the circuit breaker, or is there some power switch on the washer that I haven't seen yet? (hint: there isn't). Granted, a graduate thesis doesn't need to state the obvious as often as undergrad work, but it sure doesn't hurt. Of course, why someone would write a PhD thesis about the operation (rather than the design) of a new washing machine is beyond me... that might be better covered in the patent ;-)

    --

    --
    "It's tough to be bilingual when you get hit in the head."
  4. Excellent Books from guess who by selectspec · · Score: 5

    There are 2 awesome books on kernel and driver development from our friends at O'Reilly.

    Understanding the Linux Kernel

    and

    Linux Device Drivers

    --

    Someone you trust is one of us.

  5. Re:PC Speaker driver... by 13013dobbs · · Score: 4

    RIAA found out and sued over it.

    --

    No replies made to AC posts. Please log in.

  6. Re:Not that there's anything wrong with it... by The+Night+Watchman · · Score: 5

    Are you kidding? There's a HUGE market for PC speaker drivers! Personally, I'm waiting for Linux drivers for (1) dot matrix printers, (2) lightpens, (3) Laserdisc players, and (4) the human appendix. Come on, programmers, let's get coding! :-)

    /* Steve */

    --
    "Every jumbled pile of person has a thinking part that wonders what the part that isn't thinking isn't thinking of"-TMBG
  7. The kernel will tell you if anything went wrong... by djocyko · · Score: 4
    "The kernel will tell you if anything went wrong. In many cases, it'll reboot the system for you."

    well...that's one way of telling you something went wrong....

  8. Why do they think it's about the speaker? by Spinality · · Score: 5

    Quite a few comments below seem to think this article was cited because of providing information about the speaker as a device. Sheesh! Obviously, it was instead seen as interesting because it was a simple example of driver implementation issues, without all the gory complexity of BitBlts or nasty interrupts or odd data structures. It's a simple example, using a hardware component every user already knows.

    I at least was happy to see it listed here. I like simple examples.

    /rant

    --
    -- We all have enough strength to endure the misfortunes of other people. La Rochefoucauld
  9. Re:He's in India; hardware limited by markom · · Score: 5

    Living in a economically disturbed environment when salaries often range around the price of a decent sound card (or equally fun device) teaches you one rather important lesson in life. Being a young engineer coming from an environment like that (Belgrade, Yugoslavia), taught me to do my best to solve the problems with the only thing I had - my brains. Not my wallet. When I moved out to one economically rather different and technically advanced place (Iceland), my hard time in doing so payed off.

    Effort to make working PC speaker kernel driver is not a waste, although it can be solved with a little bit of cash more eleganlty.

    Marko.

  10. Re:Not that there's anything wrong with it... by RareHeintz · · Score: 5
    Well, there's always the fact that when you're writing a how-to for a novice audience (and many seasoned programmers would be novices when approaching the task of writing a kernel driver), you write an example that covers the necessary material, and as little else as possible. Doing an AWE64 or a 3Com 10/100 network card or a USB gadget driver might be a neat project, but would also involve a lot of particulars about the manufacturer's hardware that wouldn't have anything to do with what he's trying to teach.

    Anyway, it seems a fine approach to me. Between the knowledge in the article, available source code, and appropriate hardware specs, I imagine a determined hacker could start writing his first real device driver with this article as a starting point.

    OK,
    - B
    --

  11. If only my college instructors had taken the time by Gruneun · · Score: 5

    I'd be interested to see this guy as a teacher in a university. To tackle subjects like audio, hardware, and device drivers in one, relatively short article is impressive. To make it sound simple and easy-to-follow is astounding.

    If we had more instructors take the time to explain this way, we would have more people stay and graduate in Engineering and Computer Science. This would result in more capable new hires, fewer unfilled positions, less demand for tech people -- Hey, wait a minute! -- get that article down! Where's the /. effect when you need it?