Q: XOn/XOff software flow control isn't working. What could I be doing wrong?
A: A quirk in the way Unicode characters are packed into 'char
fields in the endpoint option is preventing the correct flow control characters from being set in the serial driver. The solution is to use the 'byte
symbol rather than the 'char
symbol for these fields, thus avoiding the Unicode-to-ASCII conversion that would normally take place. The Newton Programmer's Guide is incorrect; the correct option frames are as follows:
{ label: kCMOInputFlowControlParms, type: 'option, opCode: opSetRequired, result: nil, form: 'template, data: { arglist: [ unicodeDC1, // xonChar unicodeDC3, // xoffChar true, // useSoftFlowControl nil, // useHardFlowControl 0, // not needed; returned 0, ], // not needed; returned typelist: ['struct, 'byte, // XON character 'byte, // XOFF character 'boolean, // software flow control 'boolean, // hardware flow control 'boolean, // hardware flow blocked 'boolean, ], }, }, // software flow blocked{ label: kCMOOutputFlowControlParms, type: 'option, opCode: opSetRequired, result: nil, form: 'template, data: { arglist: [ unicodeDC1, // xonChar unicodeDC3, // xoffChar true, // useSoftFlowControl nil, // useHardFlowControl 0, // not needed; returned 0, ], // not needed; returned typelist: ['struct, 'byte, // XON character 'byte, // XOFF character 'boolean, // software flow control 'boolean, // hardware flow control 'boolean, // hardware flow blocked 'boolean, ], }, }, // software flow blocked