- 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);
+ switch((unsigned long)tr->dwPort - ppbase) {
+ case PP_DATA:
+ DPRINTF("data port\n");
+ switch(tr->cmdTrans) {
+ case PP_READ:
+ ret = 0; /* We don't support reading of the data port */
+ break;
+
+ case PP_WRITE:
+ ret = ioctl(parportfd, PPWDATA, &val);
+ break;
+
+ default:
+ fprintf(stderr,"!!!Unsupported TRANSFER command: %lu!!!\n", tr->cmdTrans);
+ ret = -1;
+ break;