[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: Ancient Parallel Port PIC Programmer - support under newer versions of Wine?
From:       Alex Henrie <alexhenrie24 () gmail ! com>
Date:       2016-09-25 20:25:50
Message-ID: CAMMLpeSHheUaVvPiXzjzxjcNM5TAxPxTG2RpF_-Z-mevMRyFPA () mail ! gmail ! com
[Download RAW message or body]

2016-09-24 20:18 GMT-06:00 Bob Wya <bob.mt.wya@gmail.com>:
> Can anyone help out with this user question on the WineHQ Forums?
> forum.winehq.org/viewtopic.php?f=8&t=27503
>
> Since the programmer used to work - with older versions of Wine - I presume
> that it might still be possible to get it working?
> Perhaps starting with parallel port device symlinks in
> "${WINEPREFIX}/dosdevices" ...
>
> Any thoughts?

If the program is calling CreateFile("COM1", ...) then symlinks should
work fine. If the program is trying to read from or write to the
address of the parallel port in memory, you can write a small wrapper
to call ioperm and execvp. For example, the following "ioperm" program
grants access to the system speaker and calls the "beep" program which
plays a tone for 1 second:

---ioperm.c---
#include <stdio.h>
#include <sys/io.h>
#include <unistd.h>

int main(int argc, char* argv[])
{
    if (ioperm(0x42, 0x61 - 0x42 + 1, 1) == -1)
    {
        perror("ioperm");
        return 1;
    }

    if (execvp(argv[1], argv + 1) == -1)
    {
        perror("execvp");
        return 1;
    }

    return 0;
}

---beep.c---
#include <stdio.h>
#include <unistd.h>

int main()
{
    __asm__("movb $0xB6, %al\n"
            "outb %al, $0x43\n"
            "inb $0x61, %al\n"
            "orb $0x03, %al\n"
            "outb %al, $0x61\n"
            "movb $0x64, %al\n"
            "outb %al, $0x42\n"
            "movb $0x01, %al\n"
            "outb %al, $0x42\n");
    sleep(1);
    __asm__("inb $0x61, %al\n"
            "andb $0xFC, %al\n"
            "outb %al, $0x61\n");
    return 0;
}

---compile and run---
cc ioperm.c -o ioperm
i686-w64-mingw32-cc beep.c -o beep.exe
sudo setcap cap_sys_rawio=ep ioperm
./ioperm wine beep.exe

I hope this helps.

-Alex



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic