Parallel port I/O problems

Hi!
I’ve used QNX 4 & many other OSs for years and used the parallel port
(0x378) for I/O. Under QNX 6 I have tried several programs that are intermittant at best an do not seem to operate at all in other cases.
I’m a newbie with QNX 6 so bear with me…

I have a scope on the outputs.

I have alread slayed devc-par.

Here is a code snippet:

int main( void )
{
if (-1 == ThreadCtl( _NTO_TCTL_IO, 0 ))
{
fprintf(stderr, “Failed to acquire hardware access privity.\n”);
exit (EXIT_FAILURE);
}
printf("\n\tNO mmap_device_io\n" );
out8(0x378, 0xff);
return (EXIT_SUCCESS);
}

The port works with a quick DOS Floppy boot with debug
out 378 1
out 378 0
etc.
so BIOS is OK.

Puzzled, HELP!!!

Thanks

It looks alright (not much can go wrong in 5 lines of code :slight_smile:.

This is x86 right ? (if not you’ll most likely need mmap_device_io).

Are you running as root ?

Didn’t call your program “test” did you ?

X86 is correct.
Running as root, (also setuid)
Compile command is:
qcc rout.cc -o ro
followed by
chmod 4755 ro
Both issued as root.

:confused:

What’s really puzzeling is it occassionally works. This is actually a simplified version that doesn’t work.

I originally had a more complicated version that repeated 20 times with 50ms between outputs of 0xff & 0x00.
Scope is on pins 4 & gnd. DC coupled.

I plan to try on another computer (swap drive).
Computer is a Dell. Port is on motherboard, and as previously stated
works when booted into DOS with debug.

Thanks again for any help.

Not that it should matter, but you could try renaming to rout.c (from rout.cc) in order to compile with the C compiler…

Are you slaying devc-par, or did you remove it from the enumeration (see /etc/system/enum/devices/char) ? It could be that if you are slaying it after it has started that it leaves the port in some funny state.

THANK YOU!!
Life is logical again. :wink:
It was the removal from the enumeration.

I find it VERY useful to use the parallel port. Low overhead, accurate
(real) timing of functions, etc. It’s almost always there, decoded, and hardly ever used for a printer!!

Mostly it was a mental block. It SHOULD work!

Thanks again,
Merle

Sorry to drag up this old thread. But what exactly is “remove it from the enumeration (see /etc/system/enum/devices/char)”

Do I remove the two section starting with devices and have something to do with parallel port or do I just delete the line that says enumerator…?

Thanks