Hello
for a class we have a board that talks EPP. I was going to write a driver
for it, until I found the nice "ppdev" module in the 2.3.x kernels. So I
decided to try it out. For whatever reason though it doesn't seem to
work. Data is being sent to the board, but nothing happens. The same
sequences of commands from DOS work perfectly. Am I doing something
wrong? Here is my code. I am using kernel 2.3.47
Feb 18 12:26:49 hal kernel: 0x378: FIFO is 16 bytes
Feb 18 12:26:49 hal kernel: 0x378: writeIntrThreshold is 16
Feb 18 12:26:49 hal kernel: 0x378: readIntrThreshold is 16
Feb 18 12:26:49 hal kernel: 0x378: PWord is 8 bits
Feb 18 12:26:49 hal kernel: 0x378: Interrupts are ISA-Pulses
Feb 18 12:26:49 hal kernel: parport0: PC-style at 0x378
(0x778) [PCSPP,TRISTATE,EPP,ECP]
Feb 18 12:26:49 hal kernel: parport0: irq 7 detected
Feb 18 12:26:49 hal kernel: parport0: cpp_mux: aa55f00f52ad51(0f)
Feb 18 12:26:49 hal kernel: parport0: cpp_daisy: aa5500ff(08)
Feb 18 12:26:49 hal kernel: parport0: assign_addrs: aa5500ff(08)
Feb 18 12:26:49 hal kernel: parport1: PC-style at 0x278 [PCSPP]
Feb 18 12:26:49 hal kernel: parport1: cpp_daisy: aa5500ff(38)
Feb 18 12:26:49 hal kernel: parport1: assign_addrs: aa5500ff(38)
here is my code:
it should send an EPP address of 0, then send a data byte, then send an
EPP address of 1, then send a data byte. This should light up a 7-segment
display [and does under DOS]....
under linux nothing happens at all [but I can verify by other means that
bits on the parallel port are in fact toggling]. Am I missing something
obvious here?
[one curious note.. if after running this program many times, I reboot,
the device lights up in the proper way... but only as it is rebooting...]
thanks for the help,
Vince
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/parport.h>
#include <linux/ppdev.h>
#define DATA_MODE IEEE1284_MODE_EPP /* use mode EPPSWE to do EPP in
software*/
#define ADDR_MODE IEEE1284_MODE_EPP | IEEE1284_ADDR
int main() {
int our_fd;
char addr0=0,addr1=1;
char data0=0xff,data1=8;
int a_mode=ADDR_MODE;
int d_mode=DATA_MODE;
our_fd=open("/dev/parport0",O_NONBLOCK);
ioctl(our_fd,PPCLAIM);
ioctl(our_fd,PPSETMODE,&a_mode);
ioctl(our_fd,PPWDATA,&addr0);
ioctl(our_fd,PPSETMODE,&d_mode);
ioctl(our_fd,PPWDATA,&data0);
ioctl(our_fd,PPSETMODE,&a_mode);
ioctl(our_fd,PPWDATA,&addr1);
ioctl(our_fd,PPSETMODE,&d_mode);
ioctl(our_fd,PPWDATA,&data1);
ioctl(our_fd,PPRELEASE);
close(our_fd);
return 0;
}
____________
\ /\ /\ / Vince Weaver
\/__\/__\/ weave@eng.umd.edu http://www.glue.umd.edu/~weave
-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Thu Feb 24 2000 - 16:12:31 EST