Can't open USB serial device

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Can't open USB serial device

Post by FourthWorld » Wed Feb 27, 2019 3:47 pm

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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9287
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Can't open USB serial device

Post by richmond62 » Wed Feb 27, 2019 3:48 pm

Oof: stand corrected. 8)

see3d
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 15
Joined: Tue Apr 11, 2006 12:07 am
Location: Weaverville, NC

Re: Can't open USB serial device

Post by see3d » Wed Feb 27, 2019 4:28 pm

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.

see3d
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 15
Joined: Tue Apr 11, 2006 12:07 am
Location: Weaverville, NC

Re: Can't open USB serial device

Post by see3d » Wed Feb 27, 2019 4:40 pm

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.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Can't open USB serial device

Post by bogs » Wed Feb 27, 2019 10:56 pm

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:
Image

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Can't open USB serial device

Post by Klaus » Thu Feb 28, 2019 1:46 pm

Sorry, no idea.

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

Re: Can't open USB serial device

Post by SparkOut » 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.

Maybe?

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Can't open USB serial device

Post by bogs » Thu Feb 28, 2019 2:44 pm

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
Image

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Can't open USB serial device

Post by Klaus » Thu Feb 28, 2019 3:05 pm

There are so many features in LC, I cannot cover all of them. 8)

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Can't open USB serial device

Post by bogs » Thu Feb 28, 2019 3:17 pm

Alright, who are you, and what have you done with our friend Klaus Image

:mrgreen:
Image

see3d
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 15
Joined: Tue Apr 11, 2006 12:07 am
Location: Weaverville, NC

Re: Can't open USB serial device

Post by see3d » Thu Feb 28, 2019 5:04 pm

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.

Post Reply

Return to “Mac OS”