Hi Jarod,

since only mplay_init is "new" i paste my code instead of a "real" diff hope that is ok
and please forgive me if my coding here is pure crap i'm not very familar with C.

int mplay_init(void)
{
    int result = 1;
    struct termios portset;
    signed int len;
    char buf = 0x96;
    char psResponse [11];
          
    LOGPRINTF(1, "Entering mplay_init()");
    /* Creation of a lock file for the port */
    if (!tty_create_lock(hw.device)) {
                logprintf(LOG_ERR,   "Could not create the lock file");
                LOGPRINTF(1, "Could not create the lock file");
                result = 0;
    }
    LOGPRINTF(0, "open serial port");
    /* Try to open serial port (Monueal Moncaso 312 device doesn't like O_NONBLOCK */
    if ((hw.fd = open(hw.device, O_RDWR | O_NOCTTY )) < 0) {
           logprintf(LOG_ERR,   "Could not open the serial port");
           LOGPRINTF(1, "Could not open the serial port");
           tty_delete_lock();
           result = 0;
     }
        /* Get serial device parameters */
    if (tcgetattr(hw.fd, &portset) < 0) {
            logprintf(LOG_ERR, "Could not get serial port attributes");
            LOGPRINTF(1, "Could not get serial port attributes");
            mplay_deinit();
            result = 0;
     }
    /* use own termios struct instead of using tty_reset , Moncaso doesn't like TCSAFLUSH */
     portset.c_cflag &= ~PARENB;
     portset.c_cflag &= ~CSTOPB;
     portset.c_cflag &= ~CSIZE;
     portset.c_cflag = B57600 | CS8;
     portset.c_cflag |= (CLOCAL | CREAD);
     portset.c_iflag |= (IXON | IXOFF | IXANY);
     portset.c_oflag &= ~OPOST;
     portset.c_lflag &= ~(ICANON|ECHOE| ECHO|ISIG );
     portset.c_cc[VSTART] = 0x11;   
     portset.c_cc[VSTOP]  = 0x13; 
     portset.c_cc[VEOF]   = 0x20;                           
     portset.c_cc[VMIN]     = 1;
     portset.c_cc[VTIME]     = 3;             

     if (tcsetattr(hw.fd, TCSANOW, &portset) < 0) {
            logprintf(LOG_ERR, "Error setting TCSANOW mode of serial device");
            LOGPRINTF(1, "Error setting TCSANOW mode of serial device");
            mplay_deinit();
            result = 0;   
     }   
   
     len = write(hw.fd, &buf, 1);
     if (len < 0) {
             LOGPRINTF(LOG_ERR,"couldn't write to device");   
             mplay_deinit();
             result = 0;   
     }   
     len = read(hw.fd, &psResponse,11);
     if (len < 0) {
              LOGPRINTF(1,"No data recieved during reading");   
              mplay_deinit();
              result = 0;   
     }
     else
     {
             LOGPRINTF(1,"read chars: %s", psResponse);
     }
     if (tcgetattr(hw.fd, &portset) < 0) {
             logprintf(LOG_ERR, "Could not get serial port attributes");
             LOGPRINTF(1, "Could not get serial port attributes");
             mplay_deinit();
             result = 0;
      }   
     portset.c_cflag &= ~PARENB;
     portset.c_cflag &= ~CSTOPB;
     portset.c_cflag &= ~CSIZE;
     portset.c_cflag = B57600 | CS8;
     portset.c_cflag |= (CLOCAL | CREAD);
     portset.c_iflag |= (IXON | IXOFF | IXANY);
     portset.c_oflag &= ~OPOST;
     portset.c_lflag &= ~(ICANON|ECHOE| ECHO|ISIG );
     portset.c_cc[VSTART] = 0x11;   
     portset.c_cc[VSTOP]  = 0x13; 
     portset.c_cc[VEOF]   = 0x1C;                           
     portset.c_cc[VMIN]     = 1;
     portset.c_cc[VTIME]     = 3;   

    if (tcsetattr(hw.fd, TCSANOW, &portset) < 0){
          logprintf(LOG_ERR, "Error setting TCSANOW mode of serial device");
          LOGPRINTF(1, "Error setting TCSANOW mode of serial device");  
          mplay_deinit();
          result = 0;   
    }
        return result;
}