Old workaround is to create symlink from /dev/ttyUSB0 to /dev/ttySx and open the port by number (x), not by the name. But use the fixed VM ;-) -- Pavel On Wed, Nov 7, 2012 at 3:54 PM, Friedrich Dominicus <frido@q-software-solutions.de> wrote:
I'm stuck. I try to open a serial Port on Linux using Pharo.
The code is as simple as:
port := SerialPort new. portName := '/dev/ttyUSB0'. port openPort: portName.
Now this opening fails for "whatever" reason. Anyway in the console I got the following "messages":
PluggableTextMorph>>handleEdit: in Block: [result := editBlock value] Error while opening the serial port (/dev/ttyUSB0# 4 ). Error: Cannot open '/dev/ttyUSB0'
It seems after the USB0 there is not the "end" of the string but some gibberish.
I tried to extract the code for the SerialPlugin and use it stand-alone in C andwrote the following:
#include <stdio.h> #include "SerialPlugin.h"
int main(void) { char *portName = "/dev/ttyUSB0"; int baudRate = 9600; int stopBitsType = 1; int parityType = 0; int dataBits = 8; int inFlowControlType = 0; int outFlowControlType = 0; int xOnByte = 19; int xOffByte = 24; int iRval;
iRval = serialPortOpenByName (portName, baudRate, stopBitsType, parityType, dataBits, inFlowControlType, outFlowControlType, xOnByte, xOffByte); iRval = serialPortCloseByName (portName); return 0; }
And there is no error while using it this way in C. So what is broken?
Regards Friedrich