Date: Mon, 1 May 2000 18:25:14 +0200 (09:25 PDT) From: Ulrich Schmid To: hpoj-owners@bstc.net Subject: Re: [HPOJ-OWNERS] HP3150? 1. Hi Tigran, > On Sat, 29 Apr 2000, Tigran Aivazian wrote: > > On Sat, 29 Apr 2000, Ulrich Schmid wrote: > > I wrote some (not yet cleaned up) code to print on a HP3100. > > If this is still interesting for you, let me know. > > Very interesting. Yes, please. The Attachment contains following code: lj3100_mux.c: This is a multiplexer-daemon. It creates a socket in /tmp for each subsystem. It must be started before the following commands are used. It requires the ppdev module to be loaded. WARNING: kernels < 2.3.99-pre4 have a bug in the ppdev module, which can cause an OOPS. lj3100_echo.c: Send a Echo packet to the lj3100. lj3100_status.c: Display some status informations from the lj3100. lj3100_print.c: Send STDIN to the printer Subsystem. The input format is the format used when sharing lj3100 under Windows95 or NT. gs_lj3100sw/: This is a GhostScript driver, which generates the format used when sharing lj3100 under Windows95. Some details: 1) Lowlevel protocol The protocol between a host and a HP LaserJet 3100 is based on packets. Nibble mode is used for the 1284 "Request Device ID". ECP mode is used for the rest of the protocol. (Probably byte mode is also available, but I didn't try it.) If data from the printer is available, the lj3100 sets nERROR/nPeriphRequest low. After a packet is read from the printer, the host must negotiate back to the forward mode, before the next packet can be read. Each packet has an 8-byte header: Byte 0: 0x5a Byte 1: 0x10 * subsystem ID + direction flag Bytes 2,3: command Bytes 4,5: length of the body Bytes 6,7: unknown Direction flag: 0 printer -> host 1 host -> printer exception: Subsystem 0 uses allway direction flag = 0 Subsystem 0 Initialization (host -> printer): 0x5a, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 Echo (host -> printer): 0x5a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 'E', 'c', 'h', 'o' The printer echos the packet back. Subsystem 2 (Printer) Open (host -> printer): 0x5a, 0x21, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00 Open ack (printer -> host) 0x5a, 0x20, 0x08, 0x00, 0x00, 0x00, 0x??, 0x?? Data (host -> printer) 0x5a, 0x21, 0x00, 0x00, 0x??, 0x??, 0x00, 0x00, ... Close (host -> printer) 0x5a, 0x21, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00 Subsystem 3 (Scanner) Subsystem 4 (Fax modem) Send (host -> printer) 0x5a, 0x41, 0x00, 0x00, 0x??, 0x??, 0x00, 0x00, ... Receive (printer -> host) 0x5a, 0x40, 0x00, 0x00, 0x??, 0x??, 0x??, 0x??, ... Subsystem 5 (Status) Request status (host -> printer) 0x5a, 0x51, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 Receive status (printer -> host) 0x5a, 0x50, 0x00, 0x00, 0xc4, 0x00, 0x??, 0x??, ... Request phonebook (host -> printer) 0x5a, 0x51, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00 Receive phonebook (printer -> host) 0x5a, 0x50, 0x03, 0x00, 0x00, 0x02, 0x??, 0x??, ... Request version (host -> printer) 0x5a, 0x51, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00 Receive version (printer -> host) 0x5a, 0x50, 0x0b, 0x00, 0x04, 0x00, 0x??, 0x??, ... There are some endianess-convertions necessary before the data can be used. Some Subsystems have some special alignement requirements. 2) Network format The lj3100 drivers on M$-Windows use a special format to share lj3100 printers. To print with smbclient to a lj3100 on a Windows95 box, I wrote a gs driver (lj3100sw) using the network format for Windows95. To separate markets by increasing incompatibility, HP uses slightly different formats for Windows95 resp. Windows NT. The difference is: for Windows NT the String "$$$$$$" is prepended. The network format uses sections defined by 6-byte headers: Bytes 0,1: section ID Bytes 2,3: count Bytes 4,5: unknown section ID 0 Data (continues the previous section) count = number of following data bytes. 1 Initialization 2 End 3 Page to print count = number of copies 4,54 unknown Best regards, Ulrich Schmid -------------------------------------------------------- Ulrich Schmid E-mail: uschmid@mail.hh.provi.de Bendemannstr. 25 Tel: +49/211/3369041 40210 Düsseldorf Fax: +49/211/3369042 Germany -------------------------------------------------------- 2. lj3100.tar.gz This is a application/x-gzip It might be displayable with metamail. (Invoke menu with right button.) name = lj3100.tar.gz disposition = attachment filename = lj3100.tar.gz