Question / Fiscal Printer device.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Question / Fiscal Printer device.

Douglas Schilling Landgraf-2
Hi guys,


I have a question, I have a *fiscal* printer connected to a parallel port.
On Linux I can print just doing:

       echo "Hello World" > /dev/lp0

On Cygwin I can't, I need to redirect to /dev/lpt1 ( Windows Parallel Port )

Is it normal ?


Anyway, I have made a program to print and authenticate, on Linux I can print
and authenticate documents without problem.

On Cygwin, when I try to authenticate documents with same program it blocks until
I remove the document. On Linux it works fine and It should print anyway.


Could you help me ?

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/io.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>

#define BASEPORT 0x378
#define BASEPORT_STATUS 0x378 + 1

int main( void ) {

        unsigned char n=0;
        int fd, st;

        // Open Device
        fd = open( "/dev/lpt1", O_RDWR | O_NONBLOCK );

        // String to authenticate
        write( fd, "\x1B\x7D\x01", 3 );

        write( fd, "Teste\n", 6 );

        // Status
        ioperm( BASEPORT, 3, 1 );
        n = inb( BASEPORT_STATUS );
        ioperm( BASEPORT, 3, 0 );

        usleep(500); // wait hardware

        // print status
        printf("0x%x\n", n );

        // New line
        write( fd, "\x0a", 1);
        write( fd, "\x0a", 1);

        // Authenticate
        printf("Put document:\n");
        usleep(500);
        getchar();   // Wait keyboard

        write( fd, "Authenticate", 13 );

        // Status
        ioperm( BASEPORT, 3, 1 );
    n = inb( BASEPORT_STATUS);
    ioperm( BASEPORT, 3, 0 );
        usleep(500); // Wait hardware
        printf("0x%x\n", n );

        close( fd );


return 0;

}


Best Regards,
Douglas Schilling Landgraf



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/