1
0

Add hack to force the detection of a parallel cable by Stefan Ziegenbalg.

This hack is activated by preloading libusb-driver-trenz.so.
This commit is contained in:
michael 2007-04-02 08:22:08 +00:00
parent 7824bbf66e
commit cdc9c5bf09
3 changed files with 25 additions and 6 deletions

View File

@ -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
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
gcc -fPIC -DDEBUG $(CFLAGS) $< -o $@ -ldl -lusb -lpthread -shared
gcc -DDEBUG $(CFLAGS) $< -o $@ -ldl -lusb -lpthread -shared
clean:
rm -f libusb-driver.so libusb-driver-DEBUG.so
rm -f $(SOBJECTS)
.PHONY: clean all

5
README
View File

@ -72,6 +72,11 @@ ppdev
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.

View 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;
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,
@ -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);
last_pp_write = val;
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) {
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);
#ifdef TRENZ
val &= 95;
if (last_pp_write & 64)
val |= 32;
else
val |= 128;
#endif
break;
case PP_WRITE: