[fpc-devel] serial under linux, SerOpen blocks

Armin Diehl ad at ardiehl.de
Thu Aug 18 09:52:13 CEST 2011


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

Thx
Armin




More information about the fpc-devel mailing list