[clue-tech] Parallel port access as non root user?

marcus hall marcus at tuells.org
Thu Sep 21 14:08:30 MDT 2006


On Thu, Sep 21, 2006 at 11:48:24AM -0600, Jim Ockers wrote:
> Hi Ed,
> 
> Can you please recompile your program so it opens the correct device?
> 
> You wrote:
> > > open("/dev/port", O_RDWR)               = -1 EACCES (Permission denied)
> 
> As you can see your process is trying to open /dev/port with major 1
> minor 4 and permissions crw-------.  The open is failing with EACCES.
> It seems you believe that your process is trying to open one of the
> parallel port devices with major 6.  These are not the same device
> class.  Major 1 is for memory devices according to /proc/devices.
... 
> Anyway I think the answer to your problem is that your program is 
> opening /dev/port which is not the device you think it is opening.

Actually, that probably *is* the device it intends to be opening.  I suspect
that this program is attempting to directly manipulate the bits on the
parallel port, and one way to do that is to open /dev/ports, seek to
0x278 (or whatever address for the port you want to fiddle with), and
write a byte.  Re-seek and read/write to perform other inb()/outb()
operations.

This is very unsafe, since a botched seek could have you performing i/o
to any hardware in the system.  But, it is one way to get direct access
to the hardware I/O ports.

-- 
Marcus Hall
marcus at tuells.org



More information about the clue-tech mailing list