strezh / VPPSniffer

Virtual Parallel Port (LPT) and sniffer modules
14 stars 3 forks source link

Use without real parallel port? #1

Open Anonymous941 opened 5 days ago

Anonymous941 commented 5 days ago

Would it be possible to use this without a real parallel port, so I can simulate one by writing to /dev/parportsnif0? Also, does this work when userland processes use x86 ASM OUT (via ioctl and outb)?

strezh commented 4 days ago

If my memory serves me correctly (I haven’t opened this project for 9 years), you can use parportvirt instead of a real port. And regarding the second question - most likely not. Can you give me an example of how you would like to do this?

Anonymous941 commented 4 days ago

I appreciate your help on a 9-year-old project :)

I have a program that uses this code to read from an LPT port

#define LPT_PORT    0x378
#define LPT_DATA    LPT_PORT + 0
#define LPT_STATUS  LPT_PORT + 1
#define LPT_CONTROL LPT_PORT + 2
unsigned char inp {
    return inb(port);
}
void outp(unsigned char data, int port)
{
    ioperm(port,1,1);
    outb(data, port);
}

I'm trying to emulate this in a virtual machine, and use a userland program to read/write from the virtual parallel port, but I can't figure out how to do it. QEMU won't let me add a virtual parallel port and I don't know how to have GDB break on access to IO like this (or if it's even possible). Is this even MMIO or just reading it directly from the CPU?

Unfortunately, recompiling it isn't an option, as only some of the source code is there (long story), and I'm kind of lost on how to approach this. Is a custom driver like this the best option?