delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/11/01/08:45:27

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Terra-Karma: 0%
X-Terra-Hash: 5f0028b43c146c0b4de5e05ac293563c
Received-SPF: pass (enugu.terra.com.br: domain of terra.com.br designates 200.176.10.9 as permitted sender) client-ip=200.176.10.9; envelope-from=pppd AT terra DOT com DOT br; helo=terra.com.br;
Date: Tue, 1 Nov 2005 10:45:12 -0300
Message-Id: <IPA3JC$FB80DA22EFA7D1B8A9C326D0A1719BC0@terra.com.br>
Subject: Question / Fiscal Printer device.
MIME-Version: 1.0
X-Sensitivity: 3
From: "Douglas Schilling Landgraf" <pppd AT terra DOT com DOT br>
To: "cygwin" <cygwin AT cygwin DOT com>
X-XaM3-API-Version: 4.1 (B108)
X-SenderIP: 200.248.254.100
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id jA1DjP3m007595

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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019