From: Keith S. <ks...@cs...> - 2006-10-06 03:29:49
|
Hi all, Many others and I figured out how to control a Pioneer with a Mac. It involved changing terminal control flags. Here is the patch: --- player-2.0.3/server/drivers/mixed/p2os/p2os.cc 2006-04-12 18:01:42.000000000 -0400 +++ player-2.0.3.new/server/drivers/mixed/p2os/p2os.cc 2006-10-05 23:18:28.000000000 -0400 @@ -628,7 +628,44 @@ this->psos_fd = -1; return(1); } - +#if defined (__APPLE__) + /* CLOCAL: Local connection (no modem control) */ + /* CREAD: Enable the receiver */ + term.c_cflag |= (CLOCAL | CREAD); + + /* PARENB: Use NO parity */ + /* CSTOPB: Use 1 stop bit */ + /* CSIZE: Next two constants: */ + /* CS8: Use 8 data bits */ + term.c_cflag &= ~PARENB; + term.c_cflag &= ~CSTOPB; + term.c_cflag &= ~CSIZE; + term.c_cflag |= CS8; + + /* IGNPAR: Ignore bytes with parity errors */ + /* ICRNL: Map CR to NL (otherwise a CR input on the other computer will not terminate input) */ + term.c_iflag |= (IGNPAR | IGNBRK); + + /* No flags at all for output control */ + term.c_oflag = 0; + + /* IXON: Disable software flow control (incoming) */ + /* IXOFF: Disable software flow control (outgoing) */ + /* IXANY: Disable software flow control (any character can start flow control */ + term.c_iflag &= ~(IXON | IXOFF | IXANY); + + /* NO FLAGS AT ALL FOR LFLAGS */ + term.c_lflag = 0; + + /* Clean the modem line and activate new port settings */ + tcflush(this->psos_fd, TCIOFLUSH); + if (tcsetattr(this->psos_fd, TCSANOW, &term) < 0) { + perror("P2OS::Setup():tcsetattr()"); + close(this->psos_fd); + this->psos_fd = -1; + return(1); + } +#else cfmakeraw( &term ); cfsetispeed(&term, bauds[currbaud]); cfsetospeed(&term, bauds[currbaud]); @@ -657,7 +694,7 @@ this->psos_fd = -1; return(1); } - +#endif // radio modem initialization code, courtesy of Kim Jinsuck // <jin...@cs...> if(this->radio_modemp) |