User Tools

Site Tools

blog:2019-07-22_linux_allow_user_program_access_serial_port



2019-07-22 Linux Allow User Program Access Serial Port

  • When I access the com port, I got the access denied if not in root permission.
  • To allow my user-mode program to access the serial port, I need to add my account into the dialout group.

Solution

  • Check COM port used
    • jk@ubuntu:~/code/hello-arm$ dmesg | grep tty
      [    0.004000] console [tty0] enabled
      [    2.773990] 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
      [    2.836452] 00:06: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A
      
  • Open Terminal and type:
    • ls -l /dev/ttyS* 
  • Now we just need to add our user to the group:
    • sudo usermod -a -G dialout $USER
  • We needs to log out and log in again for this change to take effect.
  • Check users in dialout group
    • getent group dialout
      dialout:x:20:jk
      jk@ubuntu:~/code/hello-arm$ 

References

TAGS

  • 268 person(s) visited this page until now.

Permalink blog/2019-07-22_linux_allow_user_program_access_serial_port.txt · Last modified: 2019/07/22 10:35 by jethro

oeffentlich