- if (parportfd < 0) {
- snprintf(ppdev, sizeof(ppdev), "/dev/parport%lu",
- (unsigned long)cr->Card.Item[0].I.IO.dwAddr / 0x10);
- DPRINTF("opening %s\n", ppdev);
- parportfd = open(ppdev, O_RDWR|O_EXCL);
-
- if (parportfd < 0)
- fprintf(stderr,"Can't open %s: %s\n", ppdev, strerror(errno));
- }
+
+ /* FIXME: Ugly hack which maps amontec JtagKey to 4. parallel port */
+#ifdef JTAGKEY
+ if ((unsigned long)cr->Card.Item[0].I.IO.dwAddr != 0x30)
+#endif
+ {
+ if (parportfd < 0) {
+ snprintf(ppdev, sizeof(ppdev), "/dev/parport%lu",
+ (unsigned long)cr->Card.Item[0].I.IO.dwAddr / 0x10);
+ DPRINTF("opening %s\n", ppdev);
+ parportfd = open(ppdev, O_RDWR|O_EXCL);
+
+ if (parportfd < 0)
+ fprintf(stderr,"Can't open %s: %s\n", ppdev, strerror(errno));
+ }
+
+ if (parportfd >= 0) {
+ int pmode;
+
+ if (ioctl(parportfd, PPCLAIM) == -1)
+ return ret;