<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFCC" text="#3333FF">
<div class="moz-cite-prefix">What a lot of people don't realize is
that all entries in the /dev directory are actually "nodes" or
hooks in the various hardware device drivers -- in this case the
serial driver. If you do a "<tt>ls -l</tt> /dev" you will notice
that it shows you both the major node ID, or device driver table
entry, of the various device drivers, and the minor node, which is
the actual hook ID of the driver itself. So for example, if I do
a "<tt>ll -l /dev/tty*</tt>" on my system I get:</div>
<div class="moz-cite-prefix"><br>
</div>
<blockquote>
<div class="moz-cite-prefix"><tt>crw-rw-rw-. 1 root tty 5,
0 Feb 16 04:03 /dev/tty</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 0 Feb 1 23:54
/dev/tty0</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 1 Feb 1 23:54
/dev/tty1</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 2 Feb 1 23:54
/dev/tty2</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 3 Feb 1 23:54
/dev/tty3</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 4 Feb 1 23:54
/dev/tty4</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 5 Feb 1 23:54
/dev/tty5</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 6 Feb 1 23:54
/dev/tty6</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 7 Feb 1 23:54
/dev/tty7</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 8 Feb 1 23:54
/dev/tty8</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 9 Feb 1 23:54
/dev/tty9</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 10 Feb 1 23:54
/dev/tty10</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 11 Feb 1 23:54
/dev/tty11</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 12 Feb 1 23:54
/dev/tty12</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 13 Feb 1 23:54
/dev/tty13</tt><tt><br>
</tt><tt>[...edited for brevity...]</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 59 Feb 1 23:54
/dev/tty59</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 60 Feb 1 23:54
/dev/tty60</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 61 Feb 1 23:54
/dev/tty61</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 62 Feb 1 23:54
/dev/tty62</tt><tt><br>
</tt><tt>crw--w----. 1 root tty 4, 63 Feb 1 23:54
/dev/tty63</tt><tt><br>
</tt><tt>crw-rw----. 1 root dialout 4, 64 Feb 1 23:54
/dev/ttyS0</tt><tt><br>
</tt><tt>crw-rw----. 1 root dialout 4, 65 Feb 1 23:54
/dev/ttyS1</tt><tt><br>
</tt><tt>crw-rw----. 1 root dialout 4, 66 Feb 1 23:54
/dev/ttyS2</tt><tt><br>
</tt><tt>crw-rw----. 1 root dialout 4, 67 Feb 1 23:54
/dev/ttyS3</tt><tt><br>
</tt><tt>crw-rw----. 1 root dialout 188, 0 Feb 1 23:54
/dev/ttyUSB0</tt><br>
</div>
</blockquote>
<div class="moz-cite-prefix">So /dev/ttyNN are all nodes into driver
4, and the minor number pretty much matches the hook number.</div>
<div class="moz-cite-prefix">The /dev/ttySn nodes for the hardware
handshaking ports have their hooks after the first 64 minor nodes
for the driver.</div>
<div class="moz-cite-prefix">Note that the USB port(s) are noded
against a different device driver, 188, and the hooks into the
driver pretty much line up with the /dev/ttyUSBn entries.</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">Pete's Freudian slip about making "hard
links" is not so far off as to what you can do with the "<tt>mknode</tt>"
command. You can make multiple node entries into the same device
driver hook. So if I wanted to make an alias node for the first
USB serial device, I can issue the following command:</div>
<blockquote>
<div class="moz-cite-prefix"><tt>sudo mknod /dev/smarthome_console
c 188 0</tt><br>
</div>
</blockquote>
<div class="moz-cite-prefix"><br>
And the new /dev/ special file becomes:<br>
</div>
<blockquote>
<div class="moz-cite-prefix"><tt>crw-rw-rw-. 1 root root 188, 0
Feb 20 14:11 /dev/smarthome_console</tt><br>
</div>
</blockquote>
<div class="moz-cite-prefix"><br>
Notice that I can change the permission of the new special file
different than the old special file, and have both exist at the
same time.<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">- sgh<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 2/19/21 8:32 PM, Pete Soper via
TriEmbed wrote:<br>
</div>
<blockquote type="cite"
cite="mid:c6fa47e2-719a-8e97-ac0e-3e4e95ad4206@soper.us">My memory
was off: was using symlinks. The script below after === did the
work. After --- are my udev rules. This all ran on Ubuntu
(probably 16.04).
<br>
<br>
Many little local files having meaningful labels. File names with
the file contents to the right of the name:
<br>
<br>
DM01L0P2 SW-GW-CELL
<br>
DM01L2BU GW-USB2
<br>
DM01LZ2F SW-GW-WIFI
<br>
DO00W275 GW-USB4
<br>
DO00WYOK GW-USB0
<br>
DO00WYOT GW-USB3
<br>
DO01TY7B GW-USB1
<br>
L2000G0A X-SP1___
<br>
L20900F01 X-SP2___
<br>
X-NC____ DEB-NC-SERIAL
<br>
X-NE____ DEB-NE-SERIAL
<br>
X-NW____ DEB-NW-SERIAL
<br>
X-SWCELL DEB-SW-CELL-SERIAL
<br>
X-SWWIFI DEB-SW-WIFI-SERIAL
<br>
<br>
<br>
</blockquote>
<p><br>
</p>
<pre class="moz-signature" cols="80">--
Scott G. Hall
Raleigh, NC, USA
<a class="moz-txt-link-abbreviated" href="mailto:ScottGHall1@GMail.Com">ScottGHall1@GMail.Com</a>
<i>Although kindness is rarely a job, no matter what you do it's always an option.</i>
</pre>
</body>
</html>