Just tried it on a 32 bit system (Linux t41.armin.d
2.6.35.13-92.fc14.i686 #1 SMP Sat May 21 17:39:42 UTC 2011 i686 i686
i386 GNU/Linux) as root
uses baseunix;
var handle : longint;
begin
writeln('Start: fpopen');
handle := fpopen('/dev/ttyUSB0',O_RDWR or O_NOCTTY);
writeln ('Result: ',Handle);
if handle <> 0 then fpclose(handle);
end.
and exactly the same problem. fpopen blocks if minicom is not started on
the same port. I think i have to figure out how minicom (or stty) opens
the port.
btw, ttyUSB0 is a Prolific pl2303:
Aug 18 11:47:18 t41 kernel: [ 599.994081] usb 3-2: new full speed USB
device using uhci_hcd and address 2
Aug 18 11:47:18 t41 kernel: [ 600.140165] usb 3-2: New USB device
found, idVendor=067b, idProduct=2303
Aug 18 11:47:18 t41 kernel: [ 600.140180] usb 3-2: New USB device
strings: Mfr=1, Product=2, SerialNumber=0
Aug 18 11:47:18 t41 kernel: [ 600.140191] usb 3-2: Product: USB-Serial
Controller
Aug 18 11:47:18 t41 kernel: [ 600.140200] usb 3-2: Manufacturer:
Prolific Technology Inc.
Aug 18 11:47:18 t41 mtp-probe: checking bus 3, device 2:
"/sys/devices/pci0000:00/0000:00:1d.1/usb3/3-2"
Aug 18 11:47:18 t41 mtp-probe: bus: 3, device: 2 was not an MTP device
Aug 18 11:47:18 t41 kernel: [ 600.329041] usbcore: registered new
interface driver usbserial
Aug 18 11:47:18 t41 kernel: [ 600.329070] USB Serial support registered
for generic
Aug 18 11:47:18 t41 kernel: [ 600.329948] usbcore: registered new
interface driver usbserial_generic
Aug 18 11:47:18 t41 kernel: [ 600.329953] usbserial: USB Serial Driver core
Aug 18 11:47:18 t41 kernel: [ 600.345812] USB Serial support registered
for pl2303
Aug 18 11:47:18 t41 kernel: [ 600.346655] pl2303 3-2:1.0: pl2303
converter detected
Aug 18 11:47:18 t41 kernel: [ 600.358507] usb 3-2: pl2303 converter now
attached to ttyUSB0
Aug 18 11:47:18 t41 kernel: [ 600.359439] usbcore: registered new
interface driver pl2303
Aug 18 11:47:18 t41 kernel: [ 600.359445] pl2303: Prolific PL2303 USB
to serial adaptor driver
On 08/18/2011 10:22 AM, Mark Morgan Lloyd wrote:
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
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel