Commit c0e85cfbcfa4a9180485d797b56a1c6d9e54f977
Committed by
GitHub
Merge pull request #41 from mtitinger/add-udev-rule-rebased
module: add udev rule, so tnt* device file has typical permission
Showing
4 changed files
with
25 additions
and
60 deletions
README deleted
| 1 | - | |
| 2 | - | |
| 3 | -tty0tty - linux null modem emulator v1.2 | |
| 4 | - | |
| 5 | - | |
| 6 | -This is the tty0tty directory tree: | |
| 7 | - | |
| 8 | - module - linux kernel module null-modem | |
| 9 | - pts - null-modem using ptys (without handshake lines) | |
| 10 | - | |
| 11 | - | |
| 12 | -pts (unix98): | |
| 13 | - | |
| 14 | - When run connect two pseudo-ttys and show the connection names: | |
| 15 | - | |
| 16 | - (/dev/pts/1) <=> (/dev/pts/2) | |
| 17 | - | |
| 18 | - the connection is: | |
| 19 | - | |
| 20 | - TX -> RX | |
| 21 | - RX <- TX | |
| 22 | - | |
| 23 | - | |
| 24 | - | |
| 25 | -module: | |
| 26 | - | |
| 27 | - The module is tested in kernel 3.10.2 (debian) | |
| 28 | - | |
| 29 | - When loaded, create 8 ttys interconnected: | |
| 30 | - /dev/tnt0 <=> /dev/tnt1 | |
| 31 | - /dev/tnt2 <=> /dev/tnt3 | |
| 32 | - /dev/tnt4 <=> /dev/tnt5 | |
| 33 | - /dev/tnt6 <=> /dev/tnt7 | |
| 34 | - | |
| 35 | - the connection is: | |
| 36 | - | |
| 37 | - TX -> RX | |
| 38 | - RX <- TX | |
| 39 | - RTS -> CTS | |
| 40 | - CTS <- RTS | |
| 41 | - DSR <- DTR | |
| 42 | - CD <- DTR | |
| 43 | - DTR -> DSR | |
| 44 | - DTR -> CD | |
| 45 | - | |
| 46 | - | |
| 47 | -Requirements: | |
| 48 | - | |
| 49 | - for module build is necessary kernel-headers or kernel source | |
| 50 | - | |
| 51 | - | |
| 52 | -For e-mail suggestions : lcgamboa@yahoo.com |
README.md
| ... | ... | @@ -70,26 +70,37 @@ cd tty0tty-1.2/module |
| 70 | 70 | make |
| 71 | 71 | ``` |
| 72 | 72 | |
| 73 | -Copy the new kernel module into the kernel modules directory | |
| 73 | +Install the new kernel module into the kernel modules directory | |
| 74 | 74 | |
| 75 | 75 | ``` |
| 76 | -sudo cp tty0tty.ko /lib/modules/$(uname -r)/kernel/drivers/misc/ | |
| 76 | +sudo make modules_install | |
| 77 | 77 | ``` |
| 78 | 78 | |
| 79 | -Load the module | |
| 79 | +NOTE: if module signing is enabled, in order for depmop to complete, you may | |
| 80 | +need to create file certs/x509.genkey in the kernel modules include directory | |
| 81 | +and generate file signing_key.pem using openssl, guides are available online. | |
| 82 | + | |
| 83 | +Appropriate permissions are provided thanks to a udev rule located under: | |
| 80 | 84 | |
| 81 | 85 | ``` |
| 82 | -sudo depmod | |
| 83 | -sudo modprobe tty0tty | |
| 86 | +/etc/udev/rules.d/50-tty0tty.rules | |
| 84 | 87 | ``` |
| 85 | 88 | |
| 86 | -You should see new serial ports in ```/dev/``` (```ls /dev/tnt*```) | |
| 87 | -Give appropriate permissions to the new serial ports | |
| 89 | +NOTE: you need to add yourself to the dialout group (and do a full relog), with: | |
| 88 | 90 | |
| 89 | 91 | ``` |
| 90 | -sudo chmod 666 /dev/tnt* | |
| 92 | +sudo usermod -a -G dialout ${USER} | |
| 91 | 93 | ``` |
| 92 | 94 | |
| 95 | +Load the module | |
| 96 | + | |
| 97 | +``` | |
| 98 | +sudo udevadm control --reload-rules | |
| 99 | +sudo depmod | |
| 100 | +sudo modprobe tty0tty | |
| 101 | +``` | |
| 102 | + | |
| 103 | +You should see new serial ports in ```/dev/``` (```ls /dev/tnt*```) | |
| 93 | 104 | You can now access the serial ports as /dev/tnt0 (1,2,3,4 etc) Note that the consecutive ports are interconnected. For example, /dev/tnt0 and /dev/tnt1 are connected as if using a direct cable. |
| 94 | 105 | |
| 95 | 106 | Persisting across boot: | ... | ... |
module/50-tty0tty.rules
0 → 100644