Serial on MACOS lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- superc · 2022-03-16 13:46 Hello, I've been trying to get pl_synapseVS to work on Lazarus in a MacOs for days, much to my frustration I still haven't figured out if anyone has managed to get any type of serial to work with this operating system: my question then is to know if someone uses serial communication and if so, which library or component they are using. With OPM I tried to install LazSerial 0.5 to my dismay I get a series of errors; with pl_synapseVS I get a total lock of the environment and I can't figure out how to configure (fault of my little experience with MacOS). Thanks in advance. ---------------------------------------------------------------------- MarkMLl · 2022-03-16 13:54 I tested serial.pp on Linux, Solaris/SunOS and Windows (probably 2K, it was that long ago) when I last worked on it. I don't recall anybody explicitly saying they'd checked it on a Mac, but neither do I recall any reports of problems. One particular issue is that Select() works differently on Linux and SunOS. My understanding is that both SunOS and Solaris are derived from the BSD family, which could point a finger to the cause of problems if other developers haven't explicitly tested against at least one member of that lineage. MarkMLl ---------------------------------------------------------------------- superc · 2022-03-16 14:22 On my MacOS installation, if I declare 'Serial' in the uses section I get an error .... But under windows run correctly.... ---------------------------------------------------------------------- MarkMLl · 2022-03-16 14:28 Quote from: superc on March 16, 2022, 03:22:34 pmOn my MacOS installation, if I declare 'Serial' in the uses section I get an error .... But under windows run correctly.... What do you mean "AN ERROR"? *****WHAT***** error? Does FPC build it for Macs? If not what happens if you copy it from the FPC source files to your project directory and compile it there? It's a /very/ thin layer on top of the OS, and I specifically worked on it so I could use it in a background thread and capture timing info etc. MarkMLl ---------------------------------------------------------------------- superc · 2022-03-16 15:33 In windows I've added to my testing program uses serial; well, the same program on MAC inserting the uses 'serial' I receive 'Cannot find serial used by Unit1 of ....'; but if I press CTRL on serial my editor open file Serial .... keep calm, be happy ---------------------------------------------------------------------- MarkMLl · 2022-03-16 16:09 Quote from: superc on March 16, 2022, 04:33:46 pmIn windows I've added to my testing program uses serial; well, the same program on MAC inserting the uses 'serial' I receive 'Cannot find serial used by Unit1 of ....'; but if I press CTRL on serial my editor open file Serial .... keep calm, be happy  Right, so as I said: copy serial.pp into the directory (if Macs have such things) where the rest of your project files are. MarkMLl ---------------------------------------------------------------------- superc · 2022-03-17 07:28 Quote from: MarkMLl on March 16, 2022, 05:09:17 pmQuote from: superc on March 16, 2022, 04:33:46 pmIn windows I've added to my testing program uses serial; well, the same program on MAC inserting the uses 'serial' I receive 'Cannot find serial used by Unit1 of ....'; but if I press CTRL on serial my editor open file Serial .... keep calm, be happy  Right, so as I said: copy serial.pp into the directory (if Macs have such things) where the rest of your project files are. MarkMLl Hello, as you advised me, when I copied serial.pp into project program has compiled correctly; now I'm try to write and read with a serial with a example and I report result ... Thank you MarkMLI. ---------------------------------------------------------------------- MarkMLl · 2022-03-17 07:53 Quote from: superc on March 17, 2022, 08:28:47 amas you advised me, when I copied serial.pp into project program has compiled correctly; now I'm try to write and read with a serial with a example and I report result ... Thank you MarkMLI. I'm interested to know how you get on. I suggest not testing the two functions with timeouts until you have some confidence in the rest, since they're what relies on select(). I use it heavily myself, and have a couple of mods pending... which I'm not doing since I can't test on all platforms. The first is to address the problem that Windows locks the port but Linux (and probably SunOS) doesn't, the second is to investigate some sort of "how much is queued" function. However these can be done fairly easily at the application level, since the functions use a standard handle hence any of the unix ioctls can be used. MarkMLl ---------------------------------------------------------------------- superc · 2022-03-17 09:55 To speed up the tests do you have an example of a program to read and write from the serial? I looked around quickly but found nothing. Thanks in advance. ---------------------------------------------------------------------- MarkMLl · 2022-03-17 10:03 In the interest of a quick response: try https://github.com/MarkMLl/ping-arduino-loader although you'll need to replace the SerReadTimeout() with something simpler initially. Having an Arduino to hand will obviously help, but in any event it's a useful starting point. There was a much more comprehensive test program with the patch when it went to Mantis but it wasn't included with the released files. If you still have problems I'll look in more detail later. Slightly later: I'm appending the interactive test program, but it also uses timeouts and operation is... quirky. MarkMLl ---------------------------------------------------------------------- WayneSherman · 2022-03-17 16:32 Quote from: superc on March 17, 2022, 10:55:01 amTo speed up the tests do you have an example of a program to read and write from the serial? If you have a Windows computer handy, you can use realterm as a test endpoint to test basic serial communications: https://realterm.sourceforge.io/ https://sourceforge.net/projects/realterm/ ---------------------------------------------------------------------- superc · 2022-03-17 19:58 Quote from: WayneSherman on March 17, 2022, 05:32:12 pmQuote from: superc on March 17, 2022, 10:55:01 amTo speed up the tests do you have an example of a program to read and write from the serial? If you have a Windows computer handy, you can use realterm as a test endpoint to test basic serial communications: https://realterm.sourceforge.io/ https://sourceforge.net/projects/realterm/ Very interesting program, Thank you ---------------------------------------------------------------------- MarkMLl · 2022-03-17 20:39 Couple of simple demos attached. Echo bounces anything received on the serial line back, Term sends keyboard input to the line and vice versa. Updated: fixed version of Term.pas now attached. MarkMLl ---------------------------------------------------------------------- Jurassic Pork · 2022-03-18 06:54 Hello, Quote from: superc on March 16, 2022, 02:46:30 pm With OPM I tried to install LazSerial 0.5 to my dismay I get a series of errors; The 0.5 version of TLazserial does'nt work under Os-X (compile errors, blocking open connect, scanports not working). I have missed a patch from rphoover  for OS-X here because during that time, i had no github repository for TLazserial. The patch doesn't work with my version 0.5 because not made with this version. I have made a new version of TLazserial (0.6) with the content of the patch. Quote new in v0.6 version (03/2022)  Fixes for OS-X (thanks to rphoover), SynSer(synaser) properties now persistent, v0.3 of GPS simulator  On OS-X you must set the new property  SynSer/NonBlock to True  in the properties of TLazserial component. it seems now OK on OS-X (see Capture of GPS Simulator (demo program of TLazserial) on OS-X in Attachment). Checked on OS-X Catalina 10.15 Lazarus 2.0.10 with FTDI USB serial adapter. You can download the new package on my Github repository  (master is 0.6) (Code/Clone or Download Zip). If it is OK the new version will go to the OPM. Friendly, J.P ---------------------------------------------------------------------- superc · 2022-03-18 07:33 Hello, I'm trying to install new component but I received an error like same my old post: always these damn libcrypto .... I'm now using BigSur 11.6.4 on MacPro retina 13, with Lazarus 2.2.0 and Fpc 3.2.2 ---------------------------------------------------------------------- Jurassic Pork · 2022-03-18 07:36 no crypto in TLazserial component. Have you the same message when you install another component ? ---------------------------------------------------------------------- superc · 2022-03-18 07:57 I found this link Quotehttps://dev.to/ruivieira/fixing-libcrypto-ansible-crashes-on- macos-mm2 after I reinstalled the components and now works!!!!! Now I try a new program and test it, and after I want try serial.pp Thank you very much ---------------------------------------------------------------------- superc · 2022-03-18 07:58 Quote from: Jurassic Pork on March 18, 2022, 08:36:13 amno crypto in TLazserial component. Have you the same message when you install another component ? Same error when I have Installed pl_synapseVS .... For testing I reinstalled it and now they work too ---------------------------------------------------------------------- trev · 2022-03-18 08:58 superc please do not confuse issues by posting unrelated issues in the same thread. Start a new thread or resume one of your old threads on the libcrypto issues. They have nothing to do with TLazSerial. ---------------------------------------------------------------------- superc · 2022-03-18 09:02 Trev, i don't confuse anything i just wrote what happened after i installed J.P. component and what i did .... i'm trying to get these coms working under mac and i'm not a power user ---------------------------------------------------------------------- MarkMLl · 2022-03-23 13:27 I've further enhanced the serial.pp test programs to include compile- time options for manipulating EOL, and to optionally test SerReadTimeout() rather than just SerRead(). MarkMLl