Overview
| Artifact ID: | 470a2ba35a0249f33543372b64c9067892be8a00 |
|---|---|
| Ticket: | 219311ffffffffffffffffffffffffffffffffff
[fcopy -command] on serial port floods the event queue |
| User & Date: | schroedter on 2001-09-05 21:48:58 |
Changes
- icomment:
Logged In: YES user_id=99573 Sorry for responding so late - I just returned from vacation. There are a few specialities around serial ports: - A serial fileevent occures when there is at least 1 char available. In the case above this should happen at nearly every event check. - A non-blocking read returns the number of available bytes in the input queue. When there are contineous fileevents obviously no IDLE callbacks will be executed. IMO that's intentional done. I also see, that -pollinterval doesn't change anything (see 3. below). Debugging the script above shows some strangeness when applied to the serial channel. It contineously performs non-blocking reads while resetting the event mask: 1. SerialBlockProc(mode=1) # Set non-blocking mode 2. SerialInputProc() # Returns a few bytes from the serial port # Writes these bytes to output channel (microscopic writes !!!) 3. SerialWatchProc(mask=0) # mask=0 -> Tcl_SetMaxBlockTime() not called # That's why -pollinterval doesn't help. # This also resets the internal watch mask. 4. SerialCheckProc() # Doesn't detect any event, because watch mask has been reset by 3. 5. Repeat steps 2.-5. # Until 8000 bytes have been read 6. SerialBlockProc(mode=0) # Restore original blocking mode It seems to me, that the there is at least 1 problem with fcopy and serial ports. tclIO.c:CopyData() considers only to cases after DoRead(): size < 0: Error size == 0: Install a readable handler But in our case we almost always will have the case that 0 < size < toRead IMO this should at least enable the -pollinterval option to avoid microscopic writes. But I'm not sure, whether installing an event handler for (0 < size < toRead) would help with the IDLE problem. BTW there one more potential problem with fcopy, when writing to a serial port: - The current (Tcl8.2-8.3) implementation of the serial driver doesn't support non-blocking writes. That will be changed with TIP#35. Rolf. - login: "schroedter"
- mimetype: "text/plain"
- username: "schroedter"