Page 2 of 2

Re: Can't open USB serial device

Posted: Wed Feb 27, 2019 3:47 pm
by FourthWorld
richmond62 wrote:
Wed Feb 27, 2019 3:39 pm
since LC doesn't yet have USB support officially
Cripes, that's a real case of lagging behind.
viewtopic.php?f=19&t=32133&sid=261b77e1 ... 50#p176221

Re: Can't open USB serial device

Posted: Wed Feb 27, 2019 3:48 pm
by richmond62
Oof: stand corrected. 8)

Re: Can't open USB serial device

Posted: Wed Feb 27, 2019 4:28 pm
by see3d
richmond62 wrote:
Wed Feb 27, 2019 3:39 pm
since LC doesn't yet have USB support officially
Cripes, that's a real case of lagging behind.
USB is a physical transport that the OS virtualizes for device control. I can't see why LC should or could support USB directly. What I am talking about is supporting the OS calls to control the USB virtual RS-232 type serial device, which has lines like DTR that mean something to a device. LC has the serialControlString that is supposed to set all those lines on open driver command, but in MacOS, it does not work as well as in Windows. Also for some devices, those lines need to be changed after it is open. LC does not appear to provide a way to alter those lines outside of the open command. Many other languages allow the lines to be controlled after it is open.

Re: Can't open USB serial device

Posted: Wed Feb 27, 2019 4:40 pm
by see3d
bogs wrote:
Wed Feb 27, 2019 3:01 pm
Hmm, I don't know if you saw this comment (old dictionary) -
francois.chaplais@mines-paristech.fr 2009-09-01 at 08:55:22 wrote:Mac OS X note: the environment variables which are available in the shell function may not be the same as those available in the Terminal app. For instance, it may be necessary to update the $PATH variable to make some commands available to the shell function.
I did not see this, and I am not sure what it means as far as fixing my problem. I am all ears if you do.

Re: Can't open USB serial device

Posted: Wed Feb 27, 2019 10:56 pm
by bogs
see3d wrote:
Wed Feb 27, 2019 4:40 pm
I did not see this, and I am not sure what it means as far as fixing my problem. I am all ears if you do.
Well, in the previous post you said -
see3d wrote:
Wed Feb 27, 2019 2:24 pm
I would love to use shell. I tried it for a day. Internet showed others could not get CLI to work either.
...so I was thinking that perhaps it didn't work because, as that note Francois wrote says, perhaps the $PATH might need to be udpated to gain that access from the shell command.

As to the 'how' to do that, we'd need an (possibly advanced, but at least reasonably skilled) Mac user(s) to chime in, I personally don't have access to a modern mac on any consistent basis ('nix user).

KLAUSSSSSS!!
:wink:

Re: Can't open USB serial device

Posted: Thu Feb 28, 2019 1:46 pm
by Klaus
Sorry, no idea.

Re: Can't open USB serial device

Posted: Thu Feb 28, 2019 2:33 pm
by SparkOut
I'm going to go out on a limb here, and guess there may be some confusion about the use of "shell" in this terminology.

I do not imagine there is a shell command to do the connection and set the change.

If there is a terminal application that can do the job, that application could possibly be called by LiveCode with a get shell command specifying the terminal application and its command.

Maybe?

Re: Can't open USB serial device

Posted: Thu Feb 28, 2019 2:44 pm
by bogs
SparkOut wrote:
Thu Feb 28, 2019 2:33 pm
Maybe?
Could be, if I had access to an actual hardware mac I might give it a shot at testing.
Klaus wrote:
Thu Feb 28, 2019 1:46 pm
Sorry, no idea.
Image

Re: Can't open USB serial device

Posted: Thu Feb 28, 2019 3:05 pm
by Klaus
There are so many features in LC, I cannot cover all of them. 8)

Re: Can't open USB serial device

Posted: Thu Feb 28, 2019 3:17 pm
by bogs
Alright, who are you, and what have you done with our friend Klaus Image

:mrgreen:

Re: Can't open USB serial device

Posted: Thu Feb 28, 2019 5:04 pm
by see3d
SparkOut wrote:
Thu Feb 28, 2019 2:33 pm
I'm going to go out on a limb here, and guess there may be some confusion about the use of "shell" in this terminology.

I do not imagine there is a shell command to do the connection and set the change.

If there is a terminal application that can do the job, that application could possibly be called by LiveCode with a get shell command specifying the terminal application and its command.
I have been deep diving into the shell command stty. It does allow configuring a serial device, but lacks the option to directly change the DTR line.

I have made this work in Python with pyserial installed. In this case LC creates/writes out a dinky (7 line) .py file and calls it with shell, then deletes the file. It would be an acceptable solution except it requires the user to jump through some hoops to install/configure another scripting system to run my LC app. No big deal if it is just me or a few friends, but this is a free app that will be used by hundreds if not thousands of users (though only a fraction of those will be on MacOS where the problem occurs). I wanted to have a stand alone app that would just work for all the users.

I have downloaded and tried many terminal apps. Some of them can fix this problem, but require extensive instructions and much config and typing to make it fix the problem. That is not an acceptable solution.

The most elegant solution for LC would be to have serialControlString set the interface up on MacOS to what it says (an issue with the way MacOS does the open). Alternatively, be able to have it reapplied to an open device and actually set the DTR line according to the string. I don't have the skills to do this myself.

I can't call it a bug in LC, since others have run into this problem with MacOS for many years. It could be fixed in LC though, because other languages and apps have fixed it. I would be happy with any solution that does not require a user of my app to have to do anything other than download and run my app.

In case you were wondering, the app allows a user of a popular low cost 3D printer to perform a bunch of calibrations that are needed to print properly. The LC app would automate most of this tedious task.