Page 1 of 1

symlinking devices in /dev

PostPosted: Fri Feb 08, 2019 1:54 pm
by berkinet
I am trying to create a virtual device in /dev that can be found by Indigo, or an Indigo plugin. It is possible to create virtual device servers on other hosts using ser2net or pyserial and then create virtual devices in /dev that connect to the remote service. This can be done using socat or MultiCom and possibly other methods. However, the virtual devices these tools create have \ generic names like ttys001 and the indigo.serialPorts Device description class does not see them. What I want to do is:
    sudo ln -s /dev/ttys001 /dev/cu/usbmodem12345
But, that now fails with Operation not permitted

At this point I have a lot of questions and no direction... But, here are my questions/thoughts:
  • In Mojave, is there a work-around for symlinking devices?
  • Could/Should indigo.serialPort be modified, or modifiable by a plugin, to look for other patterns?
  • Should there be an option to specify a device in a combination pulldown/text field?
  • Should developers just start offering an extra text filled for the full path name to a device? Which would not even have to be in /dev.
  • Is the best answer to this question not even on this list?

Re: symlinking devices in /dev: Progress?

PostPosted: Sat Feb 09, 2019 12:04 pm
by berkinet
I have made some progress, at least in learning, if not actually towards my goal. I found that by turning off System Integrity Protection (SIP) on MacOS I am able to hard-link, symlink and move (rename) devices in /dev. Only one problem, even if I use the proper naming scheme, Indigo doesn't see these devices. See this post for more details.

Re: symlinking devices in /dev

PostPosted: Sat Feb 09, 2019 12:21 pm
by berkinet
BTW... Correction. This is what happens when you don't carefully control your variables. I had previously given terminal.app Full Disk Access in the Security & Privacy preference pane, and that did not seem to help. Then I rebooted and disabled SIP, and then things worked, well, I could change things in /dev. Then I rebooted to enable SIP on again and guess what, I can still make changes in /dev. So, it may be the Security & Privacy changes only take place after a reboot, or at least a logout.

However, I still can't fool Indigo into using my additions to /dev.

lanbrown wrote:
That's why I was asking how Indigo determines what devices to show. It doesn't show all USB devices, so it obviously parses a list.
Jay commented they may be using a POSIX call ti get the device list. I searched for such a call and couldn't find one. I suspect the list is created using something like ioreg.

Re: symlinking devices in /dev

PostPosted: Sun Feb 10, 2019 5:38 am
by berkinet
Some updates.
  1. As Matt has confirmed in this post in another thread, Indigo uses an OSX call to get the list of devices. The internals of the call are not obvious, but it does not iterate over /dev/*
  2. After reporting I could link virtual ports with SIP enabled, it stopped working. But, when when I disabled it, bang, I can link virtual ports again. Seems you do have to have SIP disabled.
  3. It is now obvious there is no straight forward way to fool Indigo plugins into thinking a virtual serial device (like /dev/cu.usbmodem*) is a real serial device. So, it looks like the best/only way to be able to use remotely served serial devices is by having the plugin developers add support for pyserials ability veto select local, socket or rfc2217 interfaces.