On Tue, Jun 17, 2008 at 06:11:53PM -0700, Skadge wrote:
A better workaround, for us, would to define a new Squeak primitive in SerialPlugin to open the serial port which takes the full device string ("dev/ttyUSBx") as argument (in this case, the cross-plateform compatibility will have to be ensured in the Squeak code). Do you think it would be feasible? or do you have any other idea?
Severin,
Certainly it is feasible. However, it would be difficult to actually get the changes implemented and released in the "official" VM, simply because of the time it would take to coordinate. So if you can build and release the plugin yourself, then it can be done.
or do you have any other idea?
If you are concerned with Unix/Linux platforms, you can probably just do a change to these two lines in the sqUnixSerial.c support code:
#define PORT_NAME_SIZE 11 static const char serialPortBaseName[] = "/dev/ttyS0";
If you change the serialPortBaseName to the right value for your USB device names, and modify PORT_NAME_SIZE to match, then the plugin will probably do what you want without further modification. No, I have not tested this, and yes it's a hack ;)
A slightly more difficult change would be to add an optional primitive for Unix/Linux that sets the serialPortBaseName string. That would let you control it from Squeak, and would not require any changes to the existing primitives. If you did the changes to implement this for Unix, you would have a reasonable chance of getting them included in future VM releases, because the changes would be backward-compatible and would require testing only for Unix based platforms.
Note, I have no experience programming USB ports, so I'm assuming from your original question that the SerialPlugin actually works when connected to a USB device rather than to a traditional serial port.
Dave