+stephena Posted April 4, 2009 Share Posted April 4, 2009 So do either of you guys know anything about serial ports in C? Harmony's software is written in C and working, but since I don't know how to detect ports in Linux/OSX, I capture the output of "ls /dev/tty.*" and it works, but it seems there should be a better way. It would also be nice if there was something that also worked in Windows, as I'd rather know what ports were detected instead of using a list of COMx (as with Win2k and above, x can be 1-255.) I'm actually more familiar with serial port programming in C (well, C++ actually), as I needed to do that when adding AtariVox support to Stella. Unfortunately, I didn't go the 'autodetect' route, but just had the user specify the port to which the AVox is connected. The Java library that does all the heavy lifting of serial port stuff is called rxtx. There are actually two parts to it; the Java side, which is highly abstracted, and system libraries, which are compiled for each platform. It's very likely that the latter are written in C or C++, so perhaps looking at that code will give you some idea to do what you need. That being said, as you mentioned you'd donate a Harmony cart to me when they're ready, I'd be happy to look at your code and help to make it more cross-platform. It would be nice to have out-of-the-box support for Linux and OSX, as well as Windows. Let me know offlist if you prefer to talk about this is more detail. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.