Documentation of Parallel and Serial port configuration?

Paul Millar p.millar at physics.gla.ac.uk
Thu Oct 6 12:40:07 CDT 2005


Hi all,

If the bit-wise manipulation of the parallel port is exposed as some kind of 
interface under Win9x, we can probably do better than inb() / outb().  Under 
Linux, there's ppdev (a user-land bit-twiddling interface since 2.4-series 
kernels).  

Advantages of using ppdev over simple inb() / outb() are:
  should support [*] cross-architecture (arm, alpha, powerpc, ...)
  should support [*] some esoteric devices (USB-parallel converters, ...)
  only need permission to open /dev/parport0 (not necessarily root or 
CAP_SYS_RAWIO).

[*] - I've not tested either of these, though.

The overhead in doing a syscall isn't significant as any outb() operation 
takes ~1us anyway.  There may be an increased risk of context-switching after 
the syscall (please correct me if I'm wrong here), which would lead to the 
ppdev being apparently slower.  But this, in itself, shouldn't be a problem.

I suspect most programs designed to work under Win98 just hit the hardware, so 
obtaining permissions (doing ioperm() as root, for example) should work.  If 
we have some mechanism for catching the program doing either inb() or outb(), 
then we could provide a better implement via the ppdev interface.

I believe (from limited exposure) that under Win2k, accessing the parallel 
port is "more difficult".  Applications may use some kind of .sys driver to 
expose a bit-wise interface to the parallel port, which may be part of some 
"standard".  I guess this could be implemented using ppdev by some 
enthusiastic person.

Cheers,

Paul.

On Thursday 06 Oct 2005 14:14, Kuba Ober wrote:
> >     >> Several years ago I had my programmer and one other device working
> >     >> with dosemu and or bochs but after I updated from Mandrake 8.2 I
> >     >> think I have not been able to get it working again. I think the
> >     >> kernel has changed on hardware access and will require special
> >     >> driver to allow simulated direct hardware access.
> >
> >     Kuba> man ioperm 2
> >
> >     Kuba> You can use it via a suid-root wrapper program that acquires
> > the Kuba> port access, drops privileges and executes your wine
> >     Kuba> programs. Works for me. Of course it doesn't work if the
> > windows Kuba> program needs the special driver to talk to the device. It
> > does Kuba> work for those old-style windows95 applications that expect to
> > be Kuba> able to talk to the ports directly.
> >
> > For both the serial and the parallel port, direct port access can be
> > handled by ioctl() to the devices. So doing direct port access via in()
> > and out() while running as root is only the last resort...
>
> The ioperm() method is more general (works for any port, not only for
> serial/parallel devices) and also faster (doesn't do a syscall). It
> requires no changes to the win95-style applications. Also, ioperm() doesn't
> imply running as root. You only need a trivial (couple lines long)
> suid-root wrapper written in C, that then invokes your regular windows
> application using wine.
>
> Cheers, Kuba
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20051006/b6551d85/attachment-0001.pgp


More information about the wine-devel mailing list