RC 2013 WW – Software Oops


Project: The Sound of Violence.

Hey, chalk one up – the PedalBox software device-detection now works! About flipping time too!

Sad to say, the problem was a newby programming mistake in my preferred language – C. Oops! Maybe I should have picked SNOBOL 😦

Attempting to set termio option for 7 data-bits per character, this code:

cflag = (cflag | ~CSIZE) | CS7;

ends up setting *nearly all* the bits of cflag (not just the bits-per-character bits) and thus turns on all kinds of wierd and wonderful behavioural options, and *doesn’t* select 7 data-bits per character. It’s such a foolish construct, I’ll soon be off to hide under a rock.

The code should (of course!) be:

cflag = (cflag & ~CSIZE) | CS7;

Doh! Oh well, it’s working now – by sending a variety of unlikely characters at a series of different unlikely baud-rates under several different framing schemes, to itself via the PedalBox loopback serial-recieve/-transmit wiring, the software can distinguish pretty much any active RS-232 device (modem, teletype or glass-teletype, printer, scanner, HP scientific calculator, computer, etc) from the PedalBox.

Win!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s