Hi,
I'm fighting to establish bidirectional communication between a HP
LaserJet 4M printer and a Linux machine. I tested the whole thing under
Windows 95 with the enclosed HP Explorer software, namely with RCP4: the
Remote Control Panel runs all right and performs as expected.
Under Linux, it's not so good... The IEEE 1284 negotiation protocol is
included in the Linux parport driver (I'v checked it against
http://www.fapo.com/negoti8.htm; hope that's reliable). After some
debugging I found that the problem arises at Step 6 (according to the
above webpage): when Ack goes high, the status register reads 0xef, that
is: Busy low, nAck high, PE high, Select low, nError high. According to
the standard, PE should be low, but that I don't care. But Select being
low means ``mode not available'', which is impossible for nibble mode,
isn't it? I forgot to say that I sent 4 as Extensibility Data Byte; but it
hardly matters: the result is the same for everything, I tried.
The BIOS setting for the parallel port is SPP. What can be the problem?
I've even tried several different timing schemes for the length of the
Strobe pulse; it didn't help... Perhaps this printer just won't send me a
Device ID... but is there a way then get some info back? My aim is to
read back the page counter, anyway.
Thanks: Feri.
PS: I modified the 2.2.12-20 kernel's parport module to get some more
debugging output. All the changes were made in
drivers/misc/parport_ieee1284.c, function parport_ieee1284_nibble_mode_ok.
Here it is:
/* Test if the peripheral is IEEE 1284 compliant.
* return values are:
* 0 - handshake failed; peripheral is not compliant (or none present)
* 1 - handshake OK; IEEE1284 peripheral present but no data available
* 2 - handshake OK; IEEE1284 peripheral and data available
*/
int parport_ieee1284_nibble_mode_ok(struct parport *port, unsigned char
mode)
{
printk (KERN_INFO "%s: checking for nibble_mode 0x%02x\n",
port->name,mode);
/* make sure it's a valid state, set nStrobe & nAutoFeed high */
parport_frob_control (port, (1|2), 0);
udelay(1);
parport_write_data(port, mode);
udelay(400);
/* nSelectIn high, nAutoFd low */
parport_frob_control(port, (2|8), 2);
if (parport_wait_peripheral(port, 0x78, 0x38)) {
printk (KERN_INFO "%s: handshake failed, status=0x%02x\n",
port->name, parport_read_status (port));
parport_frob_control(port, (2|8), 8);
return 0;
}
printk (KERN_INFO "%s: handshake OK\n", port->name);
/* nStrobe low */
parport_frob_control (port, 1, 1);
udelay(1); /* Strobe wait */
/* nStrobe high, nAutoFeed low, last step before transferring
* reverse data */
parport_frob_control (port, (1|2), 0);
udelay(1);
/* Data available? */
if (parport_wait_peripheral (port, PARPORT_STATUS_ACK,
PARPORT_STATUS_ACK))
printk (KERN_INFO "%s: timed out waiting for ACK go
high\n", port->name);
else
printk (KERN_INFO "%s: response OK\n", port->name);
printk (KERN_INFO "%s: status=0x%02x\n", port->name,
parport_read_status (port));
return (parport_read_status(port) & PARPORT_STATUS_ERROR)?1:2;
}
And after this the kernel log reads:
Sep 2 19:21:07 bolyai1 kernel: parport0: PC-style at 0x378 [SPP,PS2]
Sep 2 19:21:07 bolyai1 kernel: parport0: checking for nibble_mode 0x04
Sep 2 19:21:07 bolyai1 kernel: parport0: handshake OK
Sep 2 19:21:07 bolyai1 kernel: parport0: response OK
Sep 2 19:21:07 bolyai1 kernel: parport0: status=0xef
Sep 2 19:21:07 bolyai1 kernel: parport0: no IEEE-1284 device present.
-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Sun Sep 03 2000 - 07:58:17 EDT