(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

 

3.2. Printer Connection - IrLPT, IrTTP, IrCOMM?

IrLPT seems to be replaced by IrCOMM. Sorry I don't have tested this yet. So this is only the remaining part from former IrLPT support. Please see mailing list archive for further information.

  • Edit /etc/conf.modules, as described above.

  • Remove any current print jobs with lprm "*".

  • Run depmod -a .

  • (If you don't use kerneld do a modprobe irtty. Probably obsolet.)

  • su to root, and do mknod /dev/irlpt0 c 161 10. Note: Something like ./MAKEDEV irlpt0 is not possible yet.

  • Try to write a small file to /dev/irlpt0 by cat FILE >/dev/irlpt0 (do not wonder about a bad format this is just a first check). For me this didn't always work, but I couldn't find out why not.

  • The better way is to change your /etc/printcap to use /dev/irlpt0 in addition or instead of /dev/lp1. See Printing-HOWTO for detailed information.

  • For easy printer setup you may use a printing software like APSFILTER, MagicFilter EZ-Magic (with RedHat there should also be a GUI for this purpose). Make a copy of /etc/printcap before.

  • Example for APSFILTER with a HP 6P (non-postscript, HP 6MP is with postscript). The two relevant questions are: "Do you have a (s)serial or a (p)arallel printer interface?" Answer "p" "What's the device name for your parallel printer interface?" Answer "/dev/irlpt0"

  • Restart the print daemon with kill -HUP <PID of lpd>. If you use another print daemon choose the according command.

  • Watch whether the connection indicator of your printer shows activity, e.g. the green light above the IR port of a HP 6P/MP comes on (lower left hand corner, near the paper tray).

  • I couldn't get to manage printjobs larger than approximately 10 pages yet. But maybe this depends on the memory size of my hardware, which is 16MB. There seems to be a problem with the software too, Thomas Davis wrote: "I will ... limit the irlpt, so it won't eat memory when you send a large print file.".

Takahide Higuchi reported: " I have been debugging IrCOMM with a printer ( Canon BJC-80v ) with IrDA port and IrCOMM protocol (not IrLPT). I can print a short e-mail text though, it easily causes dead lock when I try to print a postscript with gs."

From the page of Thomas Davis http://www.jps.net/tadavis/irda : To use the IrLPT server, you need to perform the following steps:

/sbin/modprobe irlpt_server
/sbin/mknod /dev/irlptd c 10 `grep irlptd /proc/misc|cut -f 1`
At this point, the IrLPT server is ready to recieve print jobs; now; all you need is this simple shell script
#/bin/sh
#
while (true)
do
cat /dev/irlptd | lpr
done
Dag Brattli: I hope that this will make it easier for all you that prefer to live in user-space, to make your own IrDA applications and try it out. Some printers actually use IrTTP (because of the limitations of IrLPT), so now you can write your own small user-space printer client so you can talk to it:
int discover_devices(int fd)
{
    struct irda_device_list *list;
    unsigned char buf[sizeof(struct irda_device_list) +
          sizeof(struct irda_device_info) * MAX_DEVICES];
    int len;
    int daddr;
    int i;

    len = sizeof(struct irda_device_list) +
      sizeof(struct irda_device_info) * MAX_DEVICES;
    list = (struct irda_device_list *) buf;

    if (getsockopt(sfd, SOL_IRLMP, IRLMP_ENUMDEVICES, buf, &len)) {
    perror("getsockopt");
    exit(-1);
    }
    if (len > 0) {
    /*

Just pick the first one, but we should really ask the user

     */
    daddr = list->dev[0].daddr;

    printf("Discovered: (list len=%d)\n", list->len);

    for (i=0;i<list->len;i++) {
        printf("  name:  %s\n", list->dev[i].info);
        printf("  daddr: %08x\n", list->dev[i].daddr);
        printf("  saddr: %08x\n", list->dev[i].saddr);
        printf("\n");
    }
    }
    return daddr;
}

void client()
{
    struct sockaddr_irda peer;
    int addrlen = sizeof(struct sockaddr_irda);
    int daddr, actual;
    char buf[1024];

    fd = socket(AF_IRDA, SOCK_STREAM, 0);

    daddr = discover_devices(fd);

    peer.sir_family = AF_IRDA;
    strcpy(peer.sir_name, "P1284");
    peer.sir_addr = daddr;

    connect(fd, (struct sockaddr *) &daddr, sizeof(struct sockaddr_irda));

    /* Try to send something */
    actual = send(fd, "Testing", 8, 0);

    /* Try to read reply */
    actual = recv(fd, buf, 1024, 0);
}