Posted: Sat Aug 14, 2010 6:26 am
Excellent. Are you going to try compiling the jp12serial interface code next?
Code: Select all
.SUFFIXES:
.SUFFIXES: .jnilib .cpp .hpp
GPP = g++
ARCH = x86_64
JAVA_INCLUDE=/System/Library/Frameworks/JavaVM.framework
INCLUDE = -I$(JAVA_INCLUDE)/Libraries -I$(JAVA_INCLUDE)/Headers
all: libjp12serial.jnilib
libjp12serial.jnilib: jp12serial.cpp jp12serial.hpp
$(GPP) $(INCLUDE) -shared -arch $(ARCH) -fPIC -o libjp12serial.jnilib jp12serial.cppCode: Select all
#ifdef __apple-darwin //AKA Mac OS X
"/dev/ttyp0", "/dev/ttyp1", "/dev/ttyp2", "/dev/ttyp3", "/dev/ttyp4", "/dev/ttyp5", "/dev/ttyp6", "/dev/ttyp7", "/dev/ttyp8", "/dev/ttyp9", "/dev/ttypa", "/dev/ttypb", "/dev/ttypc", "/dev/ttypd", "/dev/ttype", "/dev/ttypf",
"/dev/ttyq0", "/dev/ttyq1", "/dev/ttyq2", "/dev/ttyq3", "/dev/ttyq4", "/dev/ttyq5", "/dev/ttyq6", "/dev/ttyq7", "/dev/ttyq8", "/dev/ttyq9", "/dev/ttyqa", "/dev/ttyqb", "/dev/ttyqc", "/dev/ttyqd", "/dev/ttyqe", "/dev/ttyqf",
"/dev/ttyr0", "/dev/ttyr1", "/dev/ttyr2", "/dev/ttyr3", "/dev/ttyr4", "/dev/ttyr5", "/dev/ttyr6", "/dev/ttyr7", "/dev/ttyr8", "/dev/ttyr9", "/dev/ttyra", "/dev/ttyrb", "/dev/ttyrc", "/dev/ttyrd", "/dev/ttyre", "/dev/ttyrf",
"/dev/ttys0", "/dev/ttys1", "/dev/ttys2", "/dev/ttys3", "/dev/ttys4", "/dev/ttys5", "/dev/ttys6", "/dev/ttys7", "/dev/ttys8", "/dev/ttys9", "/dev/ttysa", "/dev/ttysb", "/dev/ttysc", "/dev/ttysd", "/dev/ttyse", "/dev/ttysf",
"/dev/ttyt0", "/dev/ttyt1", "/dev/ttyt2", "/dev/ttyt3", "/dev/ttyt4", "/dev/ttyt5", "/dev/ttyt6", "/dev/ttyt7", "/dev/ttyt8", "/dev/ttyt9", "/dev/ttyta", "/dev/ttytb", "/dev/ttytc", "/dev/ttytd", "/dev/ttyte", "/dev/ttytf",
"/dev/ttyu0", "/dev/ttyu1", "/dev/ttyu2", "/dev/ttyu3", "/dev/ttyu4", "/dev/ttyu5", "/dev/ttyu6", "/dev/ttyu7", "/dev/ttyu8", "/dev/ttyu9", "/dev/ttyua", "/dev/ttyub", "/dev/ttyuc", "/dev/ttyud", "/dev/ttyue", "/dev/ttyuf",
"/dev/ttyv0", "/dev/ttyv1", "/dev/ttyv2", "/dev/ttyv3", "/dev/ttyv4", "/dev/ttyv5", "/dev/ttyv6", "/dev/ttyv7", "/dev/ttyv8", "/dev/ttyv9", "/dev/ttyva", "/dev/ttyvb", "/dev/ttyvc", "/dev/ttyvd", "/dev/ttyve", "/dev/ttyvf",
"/dev/ttyw0", "/dev/ttyw1", "/dev/ttyw2", "/dev/ttyw3", "/dev/ttyw4", "/dev/ttyw5", "/dev/ttyw6", "/dev/ttyw7", "/dev/ttyw8", "/dev/ttyw9", "/dev/ttywa", "/dev/ttywb", "/dev/ttywc", "/dev/ttywd", "/dev/ttywe", "/dev/ttywf",
#endifCode: Select all
g++ -I/System/Library/Frameworks/JavaVM.framework/Libraries -I/System/Library/Frameworks/JavaVM.framework/Headers -shared -arch x86_64 -fPIC -o libjp12serial.jnilib jp12serial.cpp
jp12serial.cpp:242:79: error: termio.h: No such file or directory
jp12serial.cpp:296: error: ‘HINSTANCE’ does not name a type
jp12serial.cpp: In function ‘int jp12EscapeComm(int)’:
jp12serial.cpp:384: error: ‘ioctl’ was not declared in this scope
jp12serial.cpp: In function ‘int jp12Init(char*)’:
jp12serial.cpp:521: error: ‘IUCLC’ was not declared in this scope
jp12serial.cpp:525: error: ‘OLCUC’ was not declared in this scope
jp12serial.cpp:543: error: ‘XCASE’ was not declared in this scope
jp12serial.cpp: In function ‘bool openPort(const char*)’:
jp12serial.cpp:1026: error: ‘port’ was not declared in this scope
jp12serial.cpp: In function ‘const char* openRemote(const char*)’:
jp12serial.cpp:1122: error: ‘OutputDebugString’ was not declared in this scope
jp12serial.cpp:1169: error: ‘OutputDebugString’ was not declared in this scope
make: *** [libjp12serial.jnilib] Error 1Code: Select all
#ifdef IUCLC
options.c_iflag &= ~IUCLC;
#endifCode: Select all
strcpy(new_portName,portName);
Greg didn't answer you on this one. I think you do need to keep it. It is machine generated, but by Java to provide the hooks needed to link the native dll to the java RemoteMaster. My understanding is that you did keep the corresponding header for DecodeIR.alex750 wrote:The file com_hifiremote_jp1_io_JP12Serial.h states that it's machine generated. Do I need to keep this?
Alex, I suggest instead that you surround each of them with a #ifdef WIN32. These output to a MS debugger called DbgView and only have a significance when that program is open on the desktop.gfb107 wrote:I think you can change the outputDebugString calls to printf calls
Code: Select all
int jp12EscapeComm( int func )
{
#ifdef WIN32
if ( !EscapeCommFunction( hSerial, func ))
// FIXME: Call to ioctl fails in __APPLE__
#else
int status;
ioctl( hSerial, TIOCMGET, &status );
switch ( func )
{
case CLRDTR:
status &= ~TIOCM_DTR;
break;
case SETDTR:
status |= TIOCM_DTR;
break;
case CLRRTS:
status &= ~TIOCM_RTS;
break;
case SETRTS:
status |= TIOCM_RTS;
break;
case CLRBREAK:
return (ioctl(hSerial, TIOCCBRK, 0) == 0);
case SETBREAK:
return (ioctl(hSerial, TIOCSBRK, 0) == 0);
default:
printf( "Unknown function %i\n", func );
return 0;
}
if ( ioctl( hSerial, TIOCMSET, &status ) != 0 )
#endif
{
printf( "EscapeCommFunction( %i ) failed: ", func );
jp12PrintLastError();
return 0;
}
return 1;
}I don't agree with removing the #define and #ifdef, as they enable someone without the Java SDK to work on it and to test it in the Windows environment. Last year, WagonMaster did exactly that. He made good improvements but did not have, and did not want to install, the Java SDK. It seems helpful to me to keep this flexibility.gfb107 wrote:You definitely need to use com_hifiremote_jp1_io_JP12Serial.h. ... I think we should take out the #define and #ifdef that makes it seem optional.
This one:What exactly is the ioctl related error you are getting?
Code: Select all
jp12serial.cpp: In function ‘int jp12EscapeComm(int)’:
jp12serial.cpp:384: error: ‘ioctl’ was not declared in this scope in reply to whichI don't agree with removing the #define and #ifdef, as they enable someone without the Java SDK to work on it and to test it in the Windows environment.
The jp12serial.dll source code currently says:gfb107 wrote:At the very least add comments warning about the side effects of building without the JDK, and to be careful not to release binaries for general consumption that do not include Java support. I would take out the #define and #ifdef, and provide instructions to those who really want to build without the Java SDK on how to do add them back in.
Code: Select all
//
// Define this whenever the Java SDK/JDK is available. By undefining it (or
// simply commenting it out), it is possible to build this library without the
// Java header files.
//
#define JAVA_SDK_AVAILABLECode: Select all
//
// Define this whenever the Java SDK/JDK is available. By undefining it (or
// simply commenting it out), it is possible to build this library without the
// Java header files, but if you do so it will NOT work with RMIR and the
// compiled binary SHOULD NOT BE ISSUED FOR GENERAL USE.
//
#define JAVA_SDK_AVAILABLEYep. It's all good. I made some additional changes to the makefile, #ifdef'd out some other stuff that cropped up, et voilá--libjp12serial.jnilib.alex750, any luck with Kevin's suggestion?