Nagesh A | 28 Jul 2011 11:11
Picon

Read Device ID of a parallel device

Hi,

I am currently implementing ieee1284 compatibility & nibble mode at device side.
My device is connected to DB25 of host.

Currently my driver at device side, supports compatibility mode and nibble mode, and
working fine with data transfers in both directions.

I struck-up where am trying to issue a Device ID request to the host.
Basically, I would like to read the Device ID of my printer (which is of thermal printer).

I have used the below application code to issue a Device ID request on host side:

=========================
mode = IEEE1284_MODE_NIBBLE | IEEE1284_DEVICEID;
if (ioctl(dat.fd, PPNEGOT, &mode)) {
    perror("PPNEGOT (1)");
    close(dat.fd);
    return 1;
}

#define MAX_DEVICEID_LEN  1024
len = MAX_DEVICEID_LEN;
ret = read(dat.fd, dat.buf, len);
if (ret < 0) {
    perror("read");
    close(dat.fd);
    return 1;
}

============================
Here the ioctl (PPNEGOT) is failing  by saying "No such device or address".

I am wondering that it is passing when I try to read the data from host in nibble mode.
I could confirm that nibble mode is working fine, but Device ID request in nibble mode is throwing the above fault.

Please help me in this regards,

--
regards,

-Nagesh A

_______________________________________________
Linux-parport mailing list
Linux-parport <at> lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-parport
Tim Waugh | 28 Jul 2011 12:06
Picon
Favicon
Gravatar

Re: Read Device ID of a parallel device

On Thu, 2011-07-28 at 14:41 +0530, Nagesh A wrote:
> Currently my driver at device side, supports compatibility mode and
> nibble mode, and 
> working fine with data transfers in both directions.

To fetch the Device ID, the host sets bit 2 of the extensibility request
value byte during negotiation (i.e. the byte placed on the data bits
when nSelectIn/nAutoFd are toggled).

Is your device watching for that?

Tim.
*/

_______________________________________________
Linux-parport mailing list
Linux-parport <at> lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-parport
Nagesh A | 28 Jul 2011 13:19
Picon

Re: Read Device ID of a parallel device

Hi Tim,
Thank you for your reply.

Yes our driver is taking care.  Driver supports two ERV values:
1. nibble (0x00) and 2. device ID with nibble mode (0x04).

Actually, the negotiation is passed for the nibble mode (0x00) and is performing rev.
data transfer successfully.

But, for device ID request, it is not the case, though the code execution path is same
for both of them.

I could get the printk of ERV value - 0x04. and doing the following events:

1. set event 5 (Set XFlag, nDataAvail, PError low)
2. set event 6 (Set nAck high)
3. Wait for event 7 (HostBusy go low)
4. Data transfer phase

Above is the same sequence of execution even for the nibble mode data transfer.
Nibble mode data transfer is working fine.

regards,
-Nagesh A

On Thu, Jul 28, 2011 at 3:36 PM, Tim Waugh <twaugh <at> redhat.com> wrote:
On Thu, 2011-07-28 at 14:41 +0530, Nagesh A wrote:
> Currently my driver at device side, supports compatibility mode and
> nibble mode, and
> working fine with data transfers in both directions.

To fetch the Device ID, the host sets bit 2 of the extensibility request
value byte during negotiation (i.e. the byte placed on the data bits
when nSelectIn/nAutoFd are toggled).

Is your device watching for that?

Tim.
*/




--
regards,
-Nagesh A

_______________________________________________
Linux-parport mailing list
Linux-parport <at> lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-parport

Gmane