[fpc-devel] serial under linux, SerOpen blocks

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Thu Aug 18 10:22:21 CEST 2011


Armin Diehl wrote:
> I need some hint regarding opening a serial (ttyUSB) port using the unit 
> serial. Minicom works fine under my user id. When i call 
> SerOpen('/dev/ttyUSB0'), fpopen blocks forever. When i first start 
> minicom on that port, SerOpen and all other functions of serial.pp works 
> fine.
> 
> ttyUSB0 is:
> crw-rw---- 1 root dialout 188, 0 Aug 18 09:37 /dev/ttyUSB0
> 
> changing it to
> crw-rw-rw- 1 root dialout 188, 0 Aug 18 09:38 ttyUSB0
> 
> makes no difference. (my user id has the supplemental group "dialout" 
> added) SerOpen will always block if minicom is not started on the same 
> port, the same applies if i try it wit root.
> 
> stty with minicom started:
> speed 19200 baud; rows 0; columns 0; line = 0;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^A; eol = <undef>; 
> eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S;
> susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; 
> time = 5;
> -parenb -parodd cs8 hupcl -cstopb cread clocal crtscts
> ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl ixon 
> ixoff -iuclc -ixany -imaxbel -iutf8
> -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 
> bs0 vt0 ff0
> -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop 
> -echoprt -echoctl -echoke
> 
> stty without mnicom started:
> speed 19200 baud; rows 0; columns 0; line = 0;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^A; eol = <undef>; 
> eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S;
> susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; 
> time = 0;
> -parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl 
> -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
> -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 
> bs0 vt0 ff0
> -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop 
> -echoprt -echoctl -echoke
> 
> diff
> time = 0; -clocal -crtscts -ixon -ixof
> 
> Fedora 14, 64 Bit
> 2.6.35.13-92.fc14.x86_64 #1 SMP Sat May 21 17:26:25 UTC 2011 x86_64 
> x86_64 x86_64 GNU/Linux

Assuming that you mean the standard serial.pp, that's not something I've 
seen here /but/ I'm using a 32-bit kernel. I think that the first thing 
I'd explore is whether you need the incoming control lines (cts, dsr, 
cd) to be asserted before the function completes, but quite frankly if 
I'm reading your

 > When i first start minicom on that port, SerOpen and all other
 > functions of serial.pp works fine.

correctly then it sounds like a kernel or driver issue.

Anybody: I've modified serial.pp to support Win-32 and fix a couple of 
issues. Bug http://62.166.198.202/view.php?id=18946

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-devel mailing list