<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML ><HEAD ><TITLE >User-level device drivers</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="The Linux 2.4 Parallel Port Subsystem" HREF="book1.html"><LINK REL="PREVIOUS" TITLE="The printer driver" HREF="c452.html"><LINK REL="NEXT" TITLE="User-level or kernel-level driver?" HREF="x619.html"></HEAD ><BODY CLASS="CHAPTER" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >The Linux 2.4 Parallel Port Subsystem</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="c452.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="x619.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="CHAPTER" ><H1 ><A NAME="PPDEV" ></A >User-level device drivers</H1 ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN589" ></A >Introduction to ppdev</H1 ><P > The printer is accessible through <TT CLASS="FILENAME" >/dev/lp0</TT >; in the same way, the parallel port itself is accessible through <TT CLASS="FILENAME" >/dev/parport0</TT >. The difference is in the level of control that you have over the wires in the parallel port cable. </P ><P > With the printer driver, a user-space program (such as the printer spooler) can send bytes in <SPAN CLASS="QUOTE" >"printer protocol"</SPAN >. Briefly, this means that for each byte, the eight data lines are set up, then a <SPAN CLASS="QUOTE" >"strobe"</SPAN > line tells the printer to look at the data lines, and the printer sets an <SPAN CLASS="QUOTE" >"acknowledgement"</SPAN > line to say that it got the byte. The printer driver also allows the user-space program to read bytes in <SPAN CLASS="QUOTE" >"nibble mode"</SPAN >, which is a way of transferring data from the peripheral to the computer half a byte at a time (and so it's quite slow). </P ><P > In contrast, the <TT CLASS="LITERAL" >ppdev</TT > driver (accessed via <TT CLASS="FILENAME" >/dev/parport0</TT >) allows you to: </P ><P ></P ><UL COMPACT="COMPACT" ><LI ><P > examine status lines, </P ></LI ><LI ><P > set control lines, </P ></LI ><LI ><P > set/examine data lines (and control the direction of the data lines), </P ></LI ><LI ><P > wait for an interrupt (triggered by one of the status lines), </P ></LI ><LI ><P > find out how many new interrupts have occurred, </P ></LI ><LI ><P > set up a response to an interrupt, </P ></LI ><LI ><P > use IEEE 1284 negotiation (for telling peripheral which transfer mode, to use) </P ></LI ><LI ><P > transfer data using a specified IEEE 1284 mode. </P ></LI ></UL ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="c452.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="book1.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x619.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >The printer driver</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >User-level or kernel-level driver?</TD ></TR ></TABLE ></DIV ></BODY ></HTML >