Testing ExtendedSerialPort on Linux

Samir Saidani saidani at info.unicaen.fr
Thu Jun 9 19:08:57 UTC 2005


Ok, I corrected the structureSize :

For linux :

struct termios
  {
    tcflag_t c_iflag;           /* input mode flags */
    tcflag_t c_oflag;           /* output mode flags */
    tcflag_t c_cflag;           /* control mode flags */
    tcflag_t c_lflag;           /* local mode flags */
    cc_t c_line;                        /* line discipline */
    cc_t c_cc[NCCS];            /* control characters */
    speed_t c_ispeed;           /* input speed */
    speed_t c_ospeed;           /* output speed */
  };

Does it have an impact on the definition of the other classes ? 
I have no error on tcgetattr, but now I get an error on this method 
setispeed: aNumber 
	| error |
	error := self primitiveSerialPortUnixCfsetispeed: self workingSerialTermios speed: aNumber.
	error isZero
		ifFalse: [SerialPortExtendedError signal: error
                asString]

with the signal error : 22

Do you have any idea of what is wrong now ?

Thank you very much to help me to debug this stuff, John !



John M McIntosh <johnmci at smalltalkconsulting.com> writes:

> On Jun 9, 2005, at 10:13 AM, Samir Saidani wrote:
>
>>
>> Ok done, but it seems that my first guess was wrong, the tcgetattr is
>> not involved into the problem...
>> This part fails
>>  if (!((sizeOftermios()) == (interpreterProxy-
>> >sizeOfSTArrayFromCPrimitive(atermios)))) {
>>                 interpreterProxy->primitiveFail();
>>                 return null;
>>         }
>>
>> and the value of sizeOftermios is 40 whereas the other gives
>> 60... what means sizeOfSTArrayFromCPrimitive(atermios) ? Is it maybe
>> related to the problem of char* ?
>>
>> Samir
>
> This means the os-x/FreeBSD/OpenBSD Termios is different size and
> structure that your Linux version,
> sizeOfSTArrayFromCPrimitive gets the size of the bytearray that is
> being passed in. This means the
> SerialPortTermios class is not setting the right size of the bytearray.
>
> See the class comments in SerialPortTermios and SerialPortTermiosOSX
> class>>stuctureSize
>
> See
> SerialPortExtended>defaultExtendedSession
> to decide how to instantiate your custom  extended session class.
>
> Also see
> SerialPortExtendedSessionUnix>>defaultTermiosClass
>
> This is the BSD structure
> struct termios {
>          tcflag_t        c_iflag;        /* input flags */
>          tcflag_t        c_oflag;        /* output flags */
>          tcflag_t        c_cflag;        /* control flags */
>          tcflag_t        c_lflag;        /* local flags */
>          cc_t            c_cc[NCCS];     /* control chars */
>          speed_t         c_ispeed;       /* input speed */
>          speed_t         c_ospeed;       /* output speed */
> };
>
> see
> www.opengroup.org/onlinepubs/ 007908799/xsh/termios.h.html
> & of course you  need to understand the termios structure your unix
> system is using.
>
> --
> ========================================================================
> ===
> John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
> Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
> ========================================================================
> ===
>
>
>

-- 
Samir SAIDANI				
PhD Student in CS / Doctorant en informatique 	web : http://www.info.unicaen.fr/~saidani
Universite de Caen - Laboratoire GREYC          tel : 02-31-56-74-30
Equipe MAD - Campus II - 14032 Caen Cedex       fax : 02-31-56-76-30



More information about the Squeak-dev mailing list