Re: MUSCLE Problems with serial communication / cardreader ECO5000

1999-08-20 Thread Frank Thater

Hello,

the problem seems to be solved:
I (just) had to compile a new kernel.
The problems was, that the serial-driver was obviously not correctly
configured.
Some perror()-instructions pointed to that fault (I/O-error).

Thanks for your support.

Frank
-Ursprüngliche Nachricht-
Von: Frank Thater <[EMAIL PROTECTED]>
An: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Datum: Dienstag, 17. August 1999 19:08
Betreff: MUSCLE Problems with serial communication / cardreader ECO5000


>
>Hi,
>
>i'm working on a driver for the ORGA ECO 5000 cardreader.
>
>But the "serial.c" - file (provided with the CT-skeleton sources) doesn't
>seem to work.
>
>I get a handle to "/dev/ttyS0" for example, but other functions (like
>tcgetattr(handle, ...)) shutdown with an error (-1).
>
>Where is the problem ??
>
>I changed some part of the sources (eliminated MAC support), but this is (I
>hope) not the reason.
>
>I also have to set the RTS-Line off to communicate with the cardreader.
>Otherwise i don't get a response. (ACK or NACK) Which parameters do i have
to
>change or set in the termios-structure.
>
>I attached the modified "serial.c"-file. Please take a look at it.
>If there are any questions, please contact me!!
>
>Thank you so much for your support. ;->
>
>Bye, Frank
>
>
>

***
Linux Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/smartcard/index.html
***



Re: MUSCLE Problems with serial communication / cardreader ECO5000

1999-08-19 Thread Frank Thater

Hi,

I already used the "root"-account.

But this doesn´t seem to help...

Bye, Frank
-Ursprüngliche Nachricht-
Von: Michael Renzmann <[EMAIL PROTECTED]>
An: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Datum: Mittwoch, 18. August 1999 18:43
Betreff: Re: MUSCLE Problems with serial communication / cardreader ECO5000


>Hi Frank.
>
>> But the "serial.c" - file (provided with the
>> CT-skeleton sources) doesn't seem to work.
>> I get a handle to "/dev/ttyS0" for example, but other
>> functions (like tcgetattr(handle, ...)) shutdown with
>> an error (-1).
>> Where is the problem ??
>
>Trivial, but is your user allowed to send/receive data
>to/from the port? I eleminated a similar problem this
>way (in my special case I allowed everything to
>everyone).
>
>Hope that helps.
>
>Bye, Mike
>
>
>***
>Linux Smart Card Developers - M.U.S.C.L.E.
>(Movement for the Use of Smart Cards in a Linux Environment)
>http://www.linuxnet.com/smartcard/index.html
>***

***
Linux Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/smartcard/index.html
***



Re: MUSCLE Problems with serial communication / cardreader ECO5000

1999-08-18 Thread Michael Renzmann

Hi Frank.

> But the "serial.c" - file (provided with the
> CT-skeleton sources) doesn't seem to work.
> I get a handle to "/dev/ttyS0" for example, but other
> functions (like tcgetattr(handle, ...)) shutdown with
> an error (-1).
> Where is the problem ??

Trivial, but is your user allowed to send/receive data
to/from the port? I eleminated a similar problem this
way (in my special case I allowed everything to
everyone).

Hope that helps.

Bye, Mike


***
Linux Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/smartcard/index.html
***



MUSCLE Problems with serial communication / cardreader ECO5000

1999-08-17 Thread Frank Thater


Hi,

i'm working on a driver for the ORGA ECO 5000 cardreader.

But the "serial.c" - file (provided with the CT-skeleton sources) doesn't
seem to work.

I get a handle to "/dev/ttyS0" for example, but other functions (like
tcgetattr(handle, ...)) shutdown with an error (-1). 

Where is the problem ??

I changed some part of the sources (eliminated MAC support), but this is (I
hope) not the reason.

I also have to set the RTS-Line off to communicate with the cardreader.
Otherwise i don't get a response. (ACK or NACK) Which parameters do i have to
change or set in the termios-structure.

I attached the modified "serial.c"-file. Please take a look at it.
If there are any questions, please contact me!!

Thank you so much for your support. ;->

Bye, Frank




/*
 * NAME:
 * 	serial.c -- Copyright (C) 1998 David Corcoran
 *
 * DESCRIPTION:
 *  This provides Unix/Mac serial driver support
 * 
 * AUTHOR:
 *	David Corcoran, 7/22/98
 *
 *	Modified by Mark Hartman for Macintosh support, 7/15/98
 *
 * LICENSE: See file LICENSE.
 *
 */

#include/* Standard Includes */
#include 
#include 
#include 
#include 
#include 

#include "serial.h"

#include 
#include 
#include 
#include 

struct IO_Specs {
	HANDLE handle;
	BYTE   baud;
	BYTE   bits;
	char   parity;
	long   blocktime;
} ioport;


static char _rcsid[] UNUSED = "$Id$";

/*
 * InititalizePort -- initialize a serial port
 *	This functions opens the serial port specified and sets the
 *	line parameters baudrate, bits per byte and parity according to the
 *	parameters.  If no serial port is specified, the Communications
 *	Manager's dialog is invoked to permit the user to select not only
 *	the port, but all the other (baud/bits/parity) details as well.
 *	Selections made by the user in this case will override the
 *	parameters passed.
 */

bool
IO_InitializePort(int baud, int bits, char parity, char* port)
{
 /* UNIX SERIAL SUPPORT */

  HANDLE handle; 
  struct termios newtio;
  
  handle = open(port, O_RDWR);   /* Try user input depending on port */

if (handle < 0) {   /* Problems with /dev/smartcard */
  return -1;
}

  
  if(tcgetattr(handle, &newtio)<0) {
  close(handle);
  return -100;
  };

  /*
   * Set the baudrate
   */

  switch (baud) {

  case 9600:   /* Baudrate 9600  */
newtio.c_cflag = B9600;
break;
  case 19200:  /* Baudrate 19200 */
newtio.c_cflag = B19200;
break;
  default:
close(handle);
return -2;

  }
  
  /*
   * Set the bits.
   */
	switch (bits) {
	case 5:  /* Five bits */
	  newtio.c_cflag |= CS5;
	  break;
	case 6:  /* Six bits  */
	  newtio.c_cflag |= CS6;
	  break;
	case 7:  /* Seven bits*/
	  newtio.c_cflag |= CS7;
	  break;
	case 8:  /* Eight bits*/
	  newtio.c_cflag |= CS8;
	  break;
	default:
	  close(handle);
	  return -3;
	}

	/*
	 * Set the parity (Odd Even None)
	 */

	switch (parity) {

	case 'O':  /* Odd Parity   */
	  newtio.c_cflag |= PARODD | PARENB | INPCK;
	  break;
	  
	case 'E':  /* Even Parity */ 
	  newtio.c_cflag &= (~PARODD); 
	  newtio.c_cflag |= PARENB | INPCK;
	  break;
		
	case 'N':  /* No Parity   */
	  break;
	  
	default:
	  close(handle);
	  return -4;
	}
	
	/*
	 * Setting Raw Input and Defaults
	 */

	newtio.c_cflag |= CREAD|HUPCL|CLOCAL;
	newtio.c_iflag &= ~(IGNPAR|PARMRK|INLCR|IGNCR|ICRNL);
	newtio.c_iflag |= BRKINT;  
	newtio.c_lflag &= ~(ICANON|ECHO|ISTRIP); 
	newtio.c_cflag |=CRTSCTS;
	newtio.c_iflag &= ~(IXON | IXOFF | IXANY);
	newtio.c_oflag  = 0;  
	newtio.c_lflag  = 0;
	
	newtio.c_cc[VMIN]  = 1;
	newtio.c_cc[VTIME] = 0;
	
	if (tcflush(handle, TCIFLUSH) < 0) { /* Flush the serial port*/
	  close(handle);
	  return -5;
	};
	
	if(tcsetattr(handle, TCSANOW, &newtio) < 0) {
	close(handle);
	return -6;
	};
	
	ioport.handle = handle;   /* Record the handle */
	ioport.baud   = baud; /* Record the baudrate   */
	ioport.bits   = bits; /* Record the bits   */
	ioport.parity = parity;   /* Record the parity */
	ioport.blocktime = 1;/* Default Beginning Blocktime   */
	
	return TRUE;

}

HANDLE
IO_ReturnHandle() {
  return ioport.handle;   /* Return the current used handle*/
}

int 
IO_UpdateReturnBlock(int blocktime) {