Unsupported — We cannot guarantee that this software will work properly on Mac OS 10.8 and above. Please be careful.

Release: Serial IO, v20080319

Release Type: Beta
Version: 20080319
Release Notes

This update to the SerialIO patch addresses a bunch of bugs with the serial input patch. Break String stuff now works.

It has been tested with our arduino board for simple reception, and appears to handle it well. It's likely for issues to still exist, but now we're in a position to test a bit, so development on this can proceed with more ease than earlier this year.

PreviewAttachmentSize
SerialIOPatch-20080319.zip40.27 KB

franz's picture
workin' great with arduino

thank you so much ! here, it is working great with an arduino, correctly receiving values from an ultrasonic ranger ( SFR05 ).

EDIITEd: thanks again for the overall patch design: so handy and friendly. Kineme rocks the scene !!!

cwright's picture
Punch myself in the face (or, why ftdi sucks)

Way way back when I was in college (2001-2004), I had an epic struggle with FTDI and their unspeakably lousy drivers.

I've mentioned this before on kineme, as well as in other places, but now I'm going to simply post code, and let others confirm this.

Here's the basics: Opening a serial port for reading and writing, and then never reading from the device, eventually causes a buffer overflow in the kernel. at first, it manifests itself as a bunch of spurious key strokes, but eventually, if you let it keep running, it'll peg the CPU and disable the built-in keyboard and track pad (on a macbook at least). I'm not sure if there are any interesting effects after this; I give up and reboot at that point (I've shelled in remotely and killed every process I could, but none released the CPU from its infinite-loop bondage).

What you'll need: an arduino with a program that sends serial port data to the machine all the time. and this program.

The Code:

#include <fcntl.h>
#include <stdio.h>
 
int main(int argc, char**argv)
{
   int serialPort;
 
   if(argc != 2)
   {
      printf("usage: %s [device name]\n",argv[0]);
      return 0;
   }
   printf("Opening [%s]\n",argv[1]);
   serialPort = open(argv[1], O_RDWR | O_NONBLOCK);
   printf("doing nothing... let's see what happens");
   while(1)
   {
      usleep(1000);
   }
   return 0;
}

What the program does: it opens the serial port for reading and writing, non-blocking. It then does nothing (which should run indefinitely).

After it runs for a while (in a terminal), press some keys. In normal terminal mode, you'll see these keypresses, but nothing interesting will happen (until you Ctrl-C to kill the program). Once the bug is triggered, you'll get massively duplicated keypresses (pressing A once will generate a bunch of A's, Ctrl-C will generate a bunch of ^C's, etc).

[I've contacted ftdi about this issue, hopefully we'll get some kind of driver fix or workaround from them shortly...]

Installation Instructions

Place the plugin file in
/Users/[you]/Library/Graphics/Quartz Composer Patches/
(Create the folder if it doesn't already exist.)

Source code is available on GitHub.