]> git.zerfleddert.de Git - usb-driver/commitdiff
Add hack to force the detection of a parallel cable by Stefan Ziegenbalg.
authormichael <michael>
Mon, 2 Apr 2007 08:22:08 +0000 (08:22 +0000)
committermichael <michael>
Mon, 2 Apr 2007 08:22:08 +0000 (08:22 +0000)
This hack is activated by preloading libusb-driver-trenz.so.

Makefile
README
usb-driver.c

index 4ef6abaddc493bf1a81fda7b43ae5c2a82368458..3325a89f5b026de9a160f90d68e72b97fbdd92c0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,19 @@
-CFLAGS=-Wall
+CFLAGS=-Wall -fPIC
 
 
-all: libusb-driver.so libusb-driver-DEBUG.so
+SOBJECTS=libusb-driver.so libusb-driver-DEBUG.so libusb-driver-trenz.so
+
+all: $(SOBJECTS)
 
 libusb-driver.so: usb-driver.c usb-driver.h
 
 libusb-driver.so: usb-driver.c usb-driver.h
-       gcc -fPIC $(CFLAGS) $< -o $@ -ldl -lusb -lpthread -shared
+       gcc $(CFLAGS) $< -o $@ -ldl -lusb -lpthread -shared
+
+libusb-driver-trenz.so: usb-driver.c usb-driver.h
+       gcc -DTRENZ $(CFLAGS) $< -o $@ -ldl -lusb -lpthread -shared
 
 libusb-driver-DEBUG.so: usb-driver.c usb-driver.h
 
 libusb-driver-DEBUG.so: usb-driver.c usb-driver.h
-       gcc -fPIC -DDEBUG $(CFLAGS) $< -o $@ -ldl -lusb -lpthread -shared
+       gcc -DDEBUG $(CFLAGS) $< -o $@ -ldl -lusb -lpthread -shared
 
 clean:
 
 clean:
-       rm -f libusb-driver.so libusb-driver-DEBUG.so
+       rm -f $(SOBJECTS)
 
 .PHONY: clean all
 
 .PHONY: clean all
diff --git a/README b/README
index 13737b53039f8a816b70561d28ea0a20ea8518fa..fcf211a6450369653ae4ee429d1f8538c18c096e 100644 (file)
--- a/README
+++ b/README
@@ -72,6 +72,11 @@ ppdev
 To use the device as an ordinary user, put the user in the group 'lp'
 
 
 To use the device as an ordinary user, put the user in the group 'lp'
 
 
+If you have an almost compatible cable which works with other software but not
+with Impact, try preloading libusb-driver-trenz.so instead of libusb-driver.so.
+It includes a hack by Stefan Ziegenbalg to force detection of a parallel cable.
+
+
 Parallel Cable IV is currently only supported in 'compatibility mode', as no
 attempt to configure the ECP registers is done by this library.
 
 Parallel Cable IV is currently only supported in 'compatibility mode', as no
 attempt to configure the ECP registers is done by this library.
 
index fa2611e8c3ea19c9261a4f4488fa083554076aec..c497b506a86634edfa46f781c0a809ac0a63ae53 100644 (file)
@@ -241,6 +241,7 @@ int pp_transfer(WD_TRANSFER *tr, int fd, unsigned int request, unsigned char *wd
        int ret = 0;
        unsigned long port = (unsigned long)tr->dwPort;
        unsigned char val;
        int ret = 0;
        unsigned long port = (unsigned long)tr->dwPort;
        unsigned char val;
+       static int last_pp_write = 0;
 
        DPRINTF("dwPort: 0x%lx, cmdTrans: %lu, dwbytes: %ld, fautoinc: %ld, dwoptions: %ld\n",
                        (unsigned long)tr->dwPort, tr->cmdTrans, tr->dwBytes,
 
        DPRINTF("dwPort: 0x%lx, cmdTrans: %lu, dwbytes: %ld, fautoinc: %ld, dwoptions: %ld\n",
                        (unsigned long)tr->dwPort, tr->cmdTrans, tr->dwBytes,
@@ -268,6 +269,7 @@ int pp_transfer(WD_TRANSFER *tr, int fd, unsigned int request, unsigned char *wd
 
                        case PP_WRITE:
                                ret = ioctl(parportfd, PPWDATA, &val);
 
                        case PP_WRITE:
                                ret = ioctl(parportfd, PPWDATA, &val);
+                               last_pp_write = val;
                                break;
 
                        default:
                                break;
 
                        default:
@@ -276,10 +278,17 @@ int pp_transfer(WD_TRANSFER *tr, int fd, unsigned int request, unsigned char *wd
                                break;
                }
        } else if (port == ppbase + PP_STATUS) {
                                break;
                }
        } else if (port == ppbase + PP_STATUS) {
-               DPRINTF("status port\n");
+               DPRINTF("status port (last write: %d)\n", last_pp_write);
                switch(tr->cmdTrans) {
                        case PP_READ:
                                ret = ioctl(parportfd, PPRSTATUS, &val);
                switch(tr->cmdTrans) {
                        case PP_READ:
                                ret = ioctl(parportfd, PPRSTATUS, &val);
+#ifdef TRENZ
+                               val &= 95;
+                               if (last_pp_write & 64)
+                                       val |= 32;
+                               else
+                                       val |= 128;
+#endif
                                break;
 
                        case PP_WRITE:
                                break;
 
                        case PP_WRITE:
Impressum, Datenschutz