-int pp_transfer(WD_TRANSFER *tr, int fd, unsigned int request, unsigned char *wdioctl) {
- int ret = 0;
- unsigned char val;
-
- DPRINTF("dwPort: 0x%lx, cmdTrans: %lu, dwbytes: %ld, fautoinc: %ld, dwoptions: %ld\n",
- (unsigned long)tr->dwPort, tr->cmdTrans, tr->dwBytes,
- tr->fAutoinc, tr->dwOptions);
-
- val = tr->Data.Byte;
-
-#ifdef DEBUG
- if (tr->cmdTrans == 13)
- DPRINTF("write byte: %d\n", val);
-#endif
-
-#ifndef NO_WINDRVR
- ret = (*ioctl_func) (fd, request, wdioctl);
-#else
- if (parportfd < 0)
- return ret;
-
- switch(tr->cmdTrans) {
- case 10: /* Read Byte */
- if ((unsigned long)tr->dwPort == ppbase) { /* Data Port */
- ret = 0; /* We don't support reading of the data port */
- } else if ((unsigned long)tr->dwPort == ppbase + 1) { /* Status Port */
- DPRINTF("status port\n");
- ret = ioctl(parportfd, PPRSTATUS, &val);
- } else if ((unsigned long)tr->dwPort == ppbase + 2) { /* Control Port */
- DPRINTF("control port\n");
- ret = ioctl(parportfd, PPRCONTROL, &val);
- }
- break;
- case 13: /* Write Byte */
- if ((unsigned long)tr->dwPort == ppbase) { /* Data Port */
- DPRINTF("data port\n");
- ret = ioctl(parportfd, PPWDATA, &val);
- } else if ((unsigned long)tr->dwPort == ppbase + 1) { /* Status Port */
- ret = 0; /* Status Port is readonly */
- } else if ((unsigned long)tr->dwPort == ppbase + 2) { /* Control Port */
- DPRINTF("control port\n");
- ret = ioctl(parportfd, PPWCONTROL, &val);
- }
- break;
- default:
- fprintf(stderr,"!!!Unsupported TRANSFER command: %lu!!!\n", tr->cmdTrans);
- ret = -1;
- break;
- }
-
- tr->Data.Byte = val;
-#endif
-
- DPRINTF("dwPortReturn: 0x%lx, cmdTrans: %lu, dwbytes: %ld, fautoinc: %ld, dwoptions: %ld\n",
- (unsigned long)tr->dwPort, tr->cmdTrans, tr->dwBytes,
- tr->fAutoinc, tr->dwOptions);
-#ifdef DEBUG
- if (tr->cmdTrans == 10)
- DPRINTF("read byte: %d\n", tr->Data.Byte);
-#endif
-
- return ret;
-}
-