About the UART'S lock
When more than one minicom try to connect the /dev/ttyS0, an error “Device /dev/ttyS0 is locked” will be threw out. How to implement this lock? In fact, the UART’s lock is not managed by Kernel, and is done by user program. The analysis is shown as below. If “minicom” uses the /dev/ttyS0, a lock of LCK..TTYS0 is created by minicom. The following is on my PC: hfli@msh-pc1935:~/temp$ ls -l /var/lock/ total 4 drwxr-xr-x 2 www-data root 40 May 7 11:31 apache2 -rw-r--r-- 1 hfli hfli 11 May 7 14:25 LCK..ttyS0 drwxr-xr-x 2 whoopsie whoopsie 60 May 7 11:31 whoopsie The content of lock file is defined by program. In LCK..TTYS0, the content is the process number. hfli@msh-pc1935:~/temp$ cat /var/lock/LCK..ttyS0 18642 hfli@msh-pc1935:~/temp$ ps aux | ...