Writing an Intelligent Serial Card Driver

Every wonder what it's like to write a driver under Linux? Here's a summary of one hacker's experiences.
Capabilities
  • auto-detects card and uses assigned IRQ for given address

  • presents DTR as function of open/close status

  • can send/receive data on all eight ports

  • works for login session from terminal problems

  • reception of character before transmitting first character is seen as a “hangup” by something; once first character is sent, reception works fine shortcomings

  • speed is fixed at 9600 baud

  • mode is fixed at 8 bits, No parity, 1 stop bit

  • modem status is ignored

  • wait-on-open doesn't wait

  • break is ignored

  • written for release 0.99p12 testing

  • haven't tested simultaneous send/receive

  • haven't tested simultaneous multi-port operation

And a few days later I added:

It appears the problem I reported for the Cyclodes driver is actually deeper within the kernel and appears with the other asynchronous drivers, i.e., it was there to begin with. Therefore I will ignore this problem for the moment, since the other ports work for all applications I know, and focus on getting the rest of the features right. First will be speed and line mode stuff, then the modem control.

and then:

I've dropped in the speed setting code and tested it at speeds up to 19200. Once I rig some kind of loop-back cable, I'll check higher speeds.

It now recognizes parity errors and break, the wait-on-open feature works, and multiple simultaneous sends and receives have been tested. The upgrade to kernel 1.1.8 is done and I'm working with some other folks on testing it more rigorously.

Checking back in my log one can see how I worked in spurts. I spent a bit over a week overall on this, mostly in day-long chunks. This was after a lot of hour-long periods reading the documentation.

So what did I gain and would I do it again?

I got a chance to pay my debt to the community. I got to play inside the kernel. I'm more confident that I can write drivers for this system and get them to work. I also got a mux board.

I'm not sure I would do it again. Not that it was that demanding, but it did take time. I don't think the gains would be as great the second time around. Still, if an interesting-enough device was offered to me, I'd be tempted.

Randolph Bentson can be reached at: (bentson@grieg.seaslug.org)

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState