<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>mtinkd</title> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> </head> <body bgcolor="white"> <h2>Mtinkd</h2> <br> <b>Mtinkd</b> is a little server which allow to use the status monitor <b>mtink</b> or <b>ttink</b> while a job is printed. <br> Mtinkd work only with <b>EPSON</b> printers which support the <b>EPSON-D4</b> protocol. The first devices supporting this protocol was probably the <i>Stylus Color 740</i> and the<i> Stylus Scan 2000/2500</i>.<br> <h4>Content:</h4> <a href="#Syntax">Syntax</a><br> <a href="#Printing">Printing with mtinkd</a><br> <a href="#Configuration">Configuration of start script</a><br> <a href="#CallTtink">Call of ttink</a><br> <a href="#CallMtink">Call of mtink</a><br> <a href="#mtinkdStart">Start of mtinkd at boot time</a><br> <a href="#Theory">Theory of operation</a><br> <a href="#Bugs">Bugs</a><br> <a href="#SeeAlso">See also</a><br> <h4><a name="Syntax">Syntax:</a></h4> <a name="Syntax"> <i><b>mtink [start|stop|status] -dev <device file> [-nodaemon]</b><b> [-model <model name>] [-name <modelname] [-usbbase <path and device file base>] </b></i><span style="font-weight: bold; font-style: italic;"> [-debug] [-L]</span><br> <br> </a> <table cellpadding="2" cellspacing="2" border="0" width="100%" bgcolor="#ffffff"> <tbody> <tr> <td valign="top" colspan="3"><b>Special option for the SYS V start / stop scripts</b></td> </tr> <tr> <td valign="top"><b>start</b><br> </td> <td valign="top"><br> </td> <td valign="top">The server will be started. start may be ommited<br> </td> </tr> <tr> <td valign="top"><b>stop</b><br> </td> <td valign="top"><br> </td> <td valign="top">An running server will be stopped<br> </td> </tr> <tr> <td valign="top"><b>status</b><br> </td> <td valign="top"><br> </td> <td valign="top">This allow to ask if a server is running.<br> </td> </tr> <tr> <td valign="top"> <br> </td> <td valign="top"><br> </td> <td valign="top"><br> </td> </tr> <tr> <td valign="top" colspan="3">Normal options</td> </tr> <tr> <td valign="top"><b>-dev</b><br> </td> <td valign="top" nowrap="true">device file<br> </td> <td valign="top">This option is mandatory and is also used in order to get the status or to stop a running server. <br> Device file is the name of the character device on which the printer is attached (/dev/lp0, /dev/usb/lp0, /dev/ecpp0, ...) <br> </td> </tr> <tr> <td valign="top"><b>-nodaemon</b><br> </td> <td valign="top"><br> </td> <td valign="top">This option is for test purpose, without this option mtink start in the background.<br> </td> </tr> <tr> <td valign="top"><b>-model</b><br> </td> <td valign="top" nowrap="true">model name<br> </td> <td valign="top">If the printer don't return it identity you may tell which printer is attached. The name is derived from the official name and space characters are to be replaced by the "_ " character. This will be the case for the <i>Stylus Scan 2500</i> (model anme is<i>Scan_2500</i>). <br> This option may also be usefull for multifunction device as the <i>Stylus Photo 895</i> under Linux. If the printer is powered off and then on, the usb kernel will not detect the printer properly and mtinkd must be at least stopped and started again.<br> </td> </tr> <tr> <td valign="top"><b>-name</b><br> </td> <td valign="top" nowrap="true">name<br> </td> <td valign="top">The name of the named pipe will be set according to this name. If the <b>-model</b> option is not given, <b>mtinkd</b> will terminate if the identification returned don't comply with passed name<br> </td> </tr> <tr> <td valign="top"><i><b>-usbbase</b></i><br> </td> <td valign="top">path and device file base<br> </td> <td valign="top"><b>ONLY FOR LINUX</b> This option require a special system call which is only implemented into newer kernels. <br> <b>The -type <name> option is required !</b> <br> <i><b>path and device file base</b></i> may be <i>/usr/usblp</i> or <i>/usr/usl/lp</i>. All device files matching whith the passed name will be scanned for the wanted printer, the device file will then be used later. <br> If the kernel don't support the special call, scanning will fail and if the -dev <device file> option was given, the given device file name will then be used. <br> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">-debug</span><br> </td> <td style="vertical-align: top;"><br> </td> <td style="vertical-align: top;">print out a few debug messages<br> </td> </tr> <tr> <td style="vertical-align: top;"><span style="font-weight: bold;">-L</span><br> </td> <td style="vertical-align: top;"><br> </td> <td style="vertical-align: top;">debug for D4 protocol<br> </td> </tr> </tbody> </table> <a name="Syntax"> </a> <h4><a name="Printing">Printing with mtinkd</a></h4> <a name="Printing"> The usb or parallel ports can't be used by more as one process at the same time. Mtink supply a named pipe for this purpose and you will have to reconfigure the print service accordingly. <br> <br> The named pipes are all installed under the directory /var/lib/mtink. The file name is derived from the device file name and path. <br> </a> <table cellpadding="2" cellspacing="2" border="0" width="100%"> <tbody> <tr> <td valign="top"> <table cellpadding="2" cellspacing="2" border="0" width="100%"> <tbody> <tr> <th valign="top" colspan="3" nowrap="true" align="left">Example of file name<br> </th> </tr> <tr> <td valign="top" width="25%"><b>Device file</b><br> </td> <td valign="top" width="25%"><b>Named pipe name</b><br> </td> <td valign="top"><b>Remark</b><br> </td> </tr> <tr> <td valign="top">/dev/lp0<br> </td> <td valign="top">/var/lib/mtink/lp0<br> </td> <td valign="top"><br> </td> </tr> <tr> <td valign="top">/dev/usb/lp0<br> </td> <td valign="top">/var/lib/mtink/usb_lp0<br> </td> <td valign="top">The "/" is replaced by a "_"<br> </td> </tr> <tr> <td valign="top">/dev/printer/0<br> </td> <td valign="top">/var/lib/mtink/printer_0<br> </td> <td valign="top"><br> </td> </tr> <tr> <td valign="top"><br> </td> <td valign="top"><br> </td> <td valign="top"><br> </td> </tr> <tr> <td valign="top"><b>Name given with -type</b><br> </td> <td valign="top"><br> </td> <td valign="top"><br> </td> </tr> <tr> <td valign="top">Photo 890<br> </td> <td valign="top">/var/lib/mtink/Photo_890<br> </td> <td valign="top">The " " are replaced by "_" characters<br> </td> </tr> </tbody> </table> <br> <b><i>If you configure your print systeme you must choose the file /var/lib/mtink/xxx.<br> If you don't use cups you must make sure that the print system will not write at the same time on the named pipe !</i></b> <h4><a name="CallTtink">Call of ttink</a></h4> <a name="CallTtink"> Normally you have to call ttink with for example the option -d /dev/lp0. If you use the mtinkd server you must launch ttink with the option -d /var/lib/mtink/lp0 <br> </a> <h4><a name="CallMtink">Call of mtink</a></h4> <a name="CallMtink"> Mtink can be called as usual. If the choosed device is locked, mtink will allow you to choose the /var/lib/mtink/* files.<br> </a> <h4><a name="Theory">Theory of operation</a></h4> <a name="Theory"> <b>Mtinkd</b> and <b>mtink</b> / <b>ttink</b> communicate via shared memory. The shared memory will be created by the server process and this memory has a key which is calculated from the file name <i>/var/lib/mtink/<name></i>. The print jobs are to be send to the file <i>/var/lib/mtink/<name>.</i> If datas are recognized by <b>mtinkd</b> on this file, these datas are packed into the <b>D4</b> protocol and sent to the printer via a <i>data channel</i>. Queries or commands from <b>mtink</b> / <b>ttink</b> are written into the shared memory and send via the <b>D4</b> <i>control channel</i>. Both channel <i>data</i> and <i>control</i> channel are independant so you will be able to get information while a print job is running. <br> <br> In order to prevent problems, only one frontend (<b>mtink</b> or <b>ttink</b>) can attach it to the server <b>mtinkd</b>. <br> <br> <b>Linux specific:</b><br> <br> Powering the printer on / off / on will normally be handled by mtinkd however the usb driver may be the cause of problems id the attached device contain more as one device as printer and storage. In this case you will have to stop the daemon and restart it. If this don't help you must delete the printer module and insert it again. <br> <br> </a> <h4><a name="mtinkdStart">Start of mtinkd at boot time</a></h4> <a name="mtinkdStart"> In order to allow an easy integration of the daemon to different systems the options <i>start</i>, <i>status</i> and <i>stop</i> was added to the daemon <b>mtinkd</b>. This allow a dramatic simplification of the start script. An example script is provided in the source subdirectory etc: <br> <br> </a> <hr width="100%" size="2"><a name="mtinkdStart"> </a> <pre><a name="mtinkdStart"><font size="-1"><br># define the device file, adapt this<br>#DEV_FILE=/dev/usb/lp0<br><br># Special options, adapt this<br><br>SPEC="-name $NAME -usbbase /dev/usb/lp"<br><br># where the program is located<br><br>PROG=/usr/local/sbin/mtinkd<br><br>case $1 in<br> start|stop|status)<br> names=""<br> if [ -f /etc/mtinkd.conf ]<br> then<br> while read opt1 name opt2 dev; do<br> if [ $opt1 = -name ]<br> then<br> echo -n "$1 `basename $0` for $name " <br> if $PROG $1 $opt1 $name $opt2 $dev<br> then<br> echo RUN<br> else<br> echo STOP<br> fi<br> fi<br> done < /etc/mtinkd.conf<br> else<br> for f in /dev/usb/lp* /dev/lp; do<br> name=`askPrinter $f | grep '[:,]D4[,;]' | sed -n '/Stylus/s/.*:EPSON Stylus \(.*\);/\1/pg' | tr ' ' '_'`<br> if [ ! -z $name ]; then<br> echo -n "$1 `basename $0` for $name "<br> if echo $f | grep usb > /dev/null; then<br> $PROG $1 -name $name -usbbase /dev/usb/lp<br> else<br> $PROG $1 -name $name -dev $f<br> fi<br> if [ $? -eq 0 ]<br> then<br> echo RUN<br> else<br> echo STOP<br> fi<br> fi<br> done<br> fi<br> RETVAL=$?;;<br> restart)<br> $0 stop<br> sleep 2<br> $0 start<br> RETVAL=$?;;<br> *)<br> echo "Syntax `basename $0` start|stop|status|restart"<br> RETVAL=1;;<br>esac<br><br></font></a></pre> <a name="mtinkdStart"><font size="-1"> </font></a></td> </tr> </tbody> </table> <a name="Printing"> </a> <hr width="100%" size="2"><a name="Printing"><br> Please take in account that the you need a server for each EPSON printer, if you have the luck to own more such devices. <br> In this case you will have to provide start/stop scripts with different name, for example mtink.lp0 mtink.usblp0 and correct the line DEV_FILE=/dev/usb/lp0 in the script. <br> </a> <h4><a name="Printing">Warning</a></h4> <a name="Printing"> The server is not able to detect printer from other manufacturers and using this server with an unsupported printer may cause garbage. <br> <br> </a> <h4><a name="Configuration">Configuration of start script:</a></h4> <a name="Configuration"> Under Linux the script /usr/sbin/mtink-installInitScript generate all necessaries links in the /etc/rc.d/* directories and generate the configurations file /etc/mtinkd.conf. The printer must ne attached on the computer and powered on while launching mtink-installInitScript.<br> <br> </a> <h4><a name="Bugs">Bugs</a></h4> <a name="Bugs"> Probably a lot. <br> </a> <h4><a name="SeeAlso">See also</a></h4> <a name="SeeAlso"> </a><a href="mtink.html"><b>mtink</b></a><br> <a href="mtinkc.html"><b>mtinkc</b></a><br> <a href="ttink.html"><b>ttink</b></a><br> <a href="gimp-installInitScript.html"><b>gimp-installInitScript</b></a><br> <br> <h4>Author:</h4> Jean-Jacques Sarton<br> jj.sarton@t-online.de<br> http://xwtools.automatix.de<br> <br> </body> </html>