Re: [fpc-pascal] Using built-in serial instead of synaser and the like for Linux console app?
On Fri, 21 Aug 2020 20:06:04 +0200, Christo Crause via fpc-pascal wrote: >In my limited experience the FPC serial unit is a bit more low level than >the components such as synaser etc. There is a bit more of a learning >curve and one needs to decide whether to go blocking or not and how to >handle async reads etc. I needed to use custom baud rates with auto baud >for an application (debugwire-gdb-bridge) so I took the time to figure out >some of the details. >Since then I've re-used it in other serial based >applications - once you get past the learning curve of how things fit >together it is relatively easy (I guess like most things). I prefer it now >because it reduces external dependencies in a project. This is what I am also looking for after having dealt with AsyncPro on Delphi for many years in the beginning of this century. It was never possible to figure out how many of the units one really needed to talk serial... And LazSerial pulls in (unnecessarily) GUI dependencies so it cannot be used in a non-gui application. > >> Seems like there are virtually no posts describing solutions using >> serial... >> > >Here is a unit showing how to open, read and write (blocking) using the >serial unit: >https://github.com/ccrause/debugwire-gdb-bridge/blob/master/serialutils.pas >Unfortunately there is other code for sending a break command and setting >custom baud rates which makes it appear more complicated than it should be. Thank you very much for this! I do not need break or non-standard baudrates so I will cut that away when testing it. Instead I need to add a thread for reading data so I can have an event driven reception of data. It would read available data and fire off a NotifyEvent to handle the incoming data in the main application. -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using built-in serial instead of synaser and the like for Linux console app?
On Fri, Aug 21, 2020 at 12:05 PM Bo Berglund via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > So hence my question: > Is there something bad about serial (built-in to fpc) that makes it > unsuitable for use? > In my limited experience the FPC serial unit is a bit more low level than the components such as synaser etc. There is a bit more of a learning curve and one needs to decide whether to go blocking or not and how to handle async reads etc. I needed to use custom baud rates with auto baud for an application (debugwire-gdb-bridge) so I took the time to figure out some of the details. Since then I've re-used it in other serial based applications - once you get past the learning curve of how things fit together it is relatively easy (I guess like most things). I prefer it now because it reduces external dependencies in a project. > Seems like there are virtually no posts describing solutions using > serial... > Here is a unit showing how to open, read and write (blocking) using the serial unit: https://github.com/ccrause/debugwire-gdb-bridge/blob/master/serialutils.pas Unfortunately there is other code for sending a break command and setting custom baud rates which makes it appear more complicated than it should be. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Using built-in serial instead of synaser and the like for Linux console app?
On Fri, 21 Aug 2020, Bo Berglund via fpc-pascal wrote: What is the advantage of using synaser over serial in a simple non-gui program running in the console in Linux? I have been struggling making LazSerial work in a console app and been adviced to instead use synaser (which is what lazserial is built on). A few months back it seemingly started to work but with some "fixes". Yesterday I needed to quickly make a checkup tool for serial comm and this time (again) I was hit by the appearance of GUI errors. Don't remember how exactly I solved it last time... What I remembered was using widgetset nogui, but it seems impossible to get to such a setting in this simple program. And using 'interfaces' on the line preceding Lazserial was also a fix in the previous app but does not work now. So hence my question: Is there something bad about serial (built-in to fpc) that makes it unsuitable for use? Seems like there are virtually no posts describing solutions using serial... As it is built-in to fpc one would assume it is the preferred way, but for some reason it looks like it is not... Why do you think so ? Why not take it one step at a time ? Write a small console applocation that does what you want (some simple test cases) with the serial unit. You can do the same with synaser and compare your 2 solutions. Then, once satisfied, integrate it in your final solution. That can be GUI program if you need that, but does not have to be so. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Using built-in serial instead of synaser and the like for Linux console app?
What is the advantage of using synaser over serial in a simple non-gui program running in the console in Linux? I have been struggling making LazSerial work in a console app and been adviced to instead use synaser (which is what lazserial is built on). A few months back it seemingly started to work but with some "fixes". Yesterday I needed to quickly make a checkup tool for serial comm and this time (again) I was hit by the appearance of GUI errors. Don't remember how exactly I solved it last time... What I remembered was using widgetset nogui, but it seems impossible to get to such a setting in this simple program. And using 'interfaces' on the line preceding Lazserial was also a fix in the previous app but does not work now. So hence my question: Is there something bad about serial (built-in to fpc) that makes it unsuitable for use? Seems like there are virtually no posts describing solutions using serial... As it is built-in to fpc one would assume it is the preferred way, but for some reason it looks like it is not... (I am using fpc 3.0.4 + Lazarus 2.0.8 on a RaspberryPi (3 and 4)) -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Archive libraries
Il 20/08/2020 17:10, Darius Blaszyk via fpc-pascal ha scritto: To my delight I found out that FPC actually provides quite a few archive handling libraries out of the box. Thanks to all that have contributed to that! So far I found: * tar * tar.gz * zip Are there any other formats out there that I could use like out of the box? I have taken the naked LZH (LH5) by Okumura-Yoshizaki from the SWAG and I added his historical format archive around it, though in a minimal form. You can find it at the link http://digilander.libero.it/oldpumpkin in the entry "Lempel-(Ziv)-Huffman arc". The executable herein is in Dos32 but it compiles even for Windows. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal