parport / ppdev problem

From: david blunkett
Date: Tue Feb 01 2005 - 08:07:25 EST


Dear List,

Since upgrading from k2.4 to k2.6 (2.6.5-1.358 and similar) my user space code that utilises the ppdev driver has been broken (code below). I can confirm that this code still works under 2.4.

Under 2.6 the code compiles runs without error but there is no change in the output of the parport. I cannot find any documentation that indicates a change and looking through the ppdev.c code I can't find any clues as to why it shouldn't work.

I do not know if this is a kernel or installation (k2.4 from rh9 vs k2.6 from fedora 2) issue but I have spent a long time looking for information and so far drawn a blank.

Anyone know anything that might help?

Thanks,

SA

working machine:
uname -a
Linux diesel.eee.nottingham.ac.uk 2.4.20-24.9 #1 Mon Dec 1 11:43:36 EST 2003 i68 6 athlon i386 GNU/Linux
lsmod: ...parport 29640 3 ppdev,parport_pc,lp...

not working machine, eg:
uname -a
Linux rug.eee.nott.ac.uk 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 athlon i386 GNU/Linux
lsmod: ...parport 29640 3 ppdev,parport_pc,lp...

user land code in both cases
//----------------------------------------------
int parport=0;
unsigned char parport_data=0;
void open_parport(char *);
void close_parport(void);
void parport_out(unsigned char);

main(){
int i;
open_parport("/dev/parport0");
printf("Counting up\n");
for(i=0;i<255;i++){
parport_out((unsigned char)i);
usleep(10000);
}
close_parport();
}

void open_parport(char * name){
parport=open(name,O_RDWR);
if(parport<0){
printf("parport: fatal error cannot open \"%s\"\n",name);
printf("Error number is %d\n",errno);
perror("open_parport: error");
exit(1);
}
/* set up exclusive rights to the parport */
ioctl(parport,PPEXCL); /* note that robi doesn't use this....*/
ioctl(parport,PPCLAIM);
parport_data=0;
parport_out(parport_data);
}

void close_parport(void){
ioctl(parport,PPRELEASE);
close(parport);
}
//-------------------------------
void parport_out(unsigned char data){
if(ioctl(parport,PPWDATA,&data)==0)
parport_data=data;
}

not working machine:

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar ? get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/